Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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
#!/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
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]
@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.
@sbsatter
sbsatter / linear_regression.py
Created June 6, 2019 20:09
Day 6: Multiple Linear Regression: Predicting House Prices (https://www.hackerrank.com/challenges/predicting-house-prices/problem)
# Enter your code here. Read input from STDIN. Print output to STDOUT
import numpy as np
def cost(y, y_):
m = y.shape[1]
cost = 1/(2*m) * np.sum(np.square(y-y_))
return cost
dimensions = input()
# Enter your code here. Read input from STDIN. Print output to STDOUT
n = int(input())
array = sorted(list(map(int, input().split())))
# print(array)
mean = sum(array) / n
if n % 2 == 0:
n1 = n//2
n0 = n1 - 1
# Enter your code here. Read input from STDIN. Print output to STDOUT
n = int(input())
arr = list(map(int, input().split()))
w = list(map(int, input().split()))
s = 0
for i in range(n):
s = s + arr[i] * w[i]
@sbsatter
sbsatter / Navigation.js
Created June 12, 2020 05:30
An updated way to set up React Native Navigation using bottom tabs. Originally, I was following along the tutorial series episode https://www.linkedin.com/learning/create-a-crm-mobile-application-with-react-native-2/create-tab-menu?u=70939946 when I got stuck with deprecated library. Hence, here's the update that solves it. Note, you may need to…
import React from 'react';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { NavigationContainer } from '@react-navigation/native';
import Icon from 'react-native-vector-icons/EvilIcons';
import PeopleList from './PeopleList';
import CompanyList from './CompanyList';
import AddPerson from './AddPerson';
// NOTE: Setting up static navigation options in other individual components is unnecessary now