Skip to content

Instantly share code, notes, and snippets.

@sbsatter
sbsatter / Filebeat
Created December 9, 2018 04:14
Basic guides, steps to setup, initialize and understand elasticsearch, logstash, Filebeat and Kibana.
CONFIGURING FILEBEAT
====================
1. rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
2. vi /etc/yum.repos.d/filebeat.repo and paste
3. Set up to work with logstash.
a. Open filebeat.yml in $path.home.
b. comment, if not already done, the output to elasticsearch part.
c. uncomment, if not already done, the output to logstash.
d. configure port and host ip.
import math
def nextMove(n,r,c,grid):
princess = ()
for row in range(n):
for col in range(len(grid[row])):
if grid[row][col] == 'p':
princess = (row, col)
break
m = (r, c)
x = princess[0] - m[0]
#!/usr/bin/python
import math
def displayPathtoPrincess(n,grid):
#print all the moves here
princess = ()
for row in range(n):
for col in range(len(grid[row])):
if grid[row][col] == 'p':
princess = (row, col)
break
@sbsatter
sbsatter / Creating a CA and SSL Certificate
Created April 1, 2018 04:23
This short guide helps to get started with setting up a Certificate Authority and a certificate for use in SSL.
1. Create a root private key for signing certificates. (Done only once)
$ openssl genrsa -des3 -out rootCA.key 2048
2. Self-sign this certificate
$ openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem
3. Create a certificate (Done once per device)
$ openssl genrsa -out my-cert.key 2048
4. Now generate a CSR
@sbsatter
sbsatter / spring-security-3.1 logs.txt
Last active February 11, 2018 05:35
The logs that are obtained using sprig security 3.1.2 & 3.2.5
Loading the login page by accessing protected resource
======================================================
2018-02-11 11:08:48 [INFO] Spring Security Debugger line: 39 -
************************************************************
Request received for '/spring_security_login':
org.apache.catalina.connector.RequestFacade@5a974e48
@sbsatter
sbsatter / Datasoft PC
Last active December 10, 2017 04:50 — forked from anonymous/-
System: Host: sbsatter Kernel: 4.4.0-101-generic x86_64 (64 bit gcc: 5.4.0)
Desktop: Cinnamon 3.2.7 (Gtk 3.18.9-1ubuntu3.3) dm: mdm Distro: Linux Mint 18.1 Serena
Machine: System: Gigabyte product: N/A
Mobo: Gigabyte model: H170M-D3H-CF Bios: American Megatrends v: F6 date: 03/07/2016
CPU: Quad core Intel Core i5-6500 (-MCP-) cache: 6144 KB
flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 25536
clock speeds: min/max: 800/3600 MHz 1: 800 MHz 2: 800 MHz 3: 800 MHz 4: 800 MHz
Graphics: Card: Intel Sky Lake Integrated Graphics bus-ID: 00:02.0 chip-ID: 8086:1912
Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa)
Resolution: 1366x768@59.79hz
@sbsatter
sbsatter / -
Created April 20, 2017 08:31 — forked from anonymous/-
System: Host: sbsatter Kernel: 4.4.0-72-generic x86_64 (64 bit gcc: 5.4.0)
Desktop: Cinnamon 3.2.7 (Gtk 3.18.9-1ubuntu3.2) dm: mdm Distro: Linux Mint 18.1 Serena
Machine: System: Gigabyte product: N/A
Mobo: Gigabyte model: H170M-D3H-CF v: x.x Bios: American Megatrends v: F6 date: 03/07/2016
CPU: Quad core Intel Core i5-6500 (-MCP-) cache: 6144 KB
flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 25535
clock speeds: min/max: 800/3600 MHz 1: 800 MHz 2: 800 MHz 3: 800 MHz 4: 800 MHz
Graphics: Card: Intel Sky Lake Integrated Graphics bus-ID: 00:02.0 chip-ID: 8086:1912
Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa)
Resolution: 1366x768@59.79hz
@sbsatter
sbsatter / palyndrome.java
Created November 17, 2016 18:04
Easiest and fastest palyndrome checker
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String s=sc.next();
/* Enter your code here. Print output to STDOUT.
@sbsatter
sbsatter / Quicksort.py
Created August 20, 2016 16:59
Quicksort algorithm in python
def partition(alist, first, last):
pivotValue= alist[first]
left= first+1
right=last
done= False
while not done:
while alist[left]<pivotValue and left<right:
left=left+1
class Mergesort{
public static void main(String ... args){
int [] array= {5, 4, 3, 2, 1, 0};
printArray(mergerSort(copyOf(array,0, array.length)));
}
static void printArray(int [] array){
for(int i: array){
System.out.print(i+" ");
}