Skip to content

Instantly share code, notes, and snippets.

View franchb's full-sized avatar
🎯
Focusing

Eliah Rusin franchb

🎯
Focusing
View GitHub Profile
@franchb
franchb / useragents2018.txt
Last active May 13, 2018 19:59
Actual User-Agent strings (April 2018 useragent)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36 OPR/51.0.2830.55
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/64.0.3282.167 Chrome/64.0.3282.167 Safari/537.36
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:59.0) Gecko/20100101 Firefox/59.0
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like G
@franchb
franchb / deadlock-go
Created March 24, 2018 15:10
middleware deadlock go
package main
import (
"log"
"net/http"
"github.com/gin-gonic/gin"
"github.com/go-redis/redis"
"github.com/ulule/limiter"
mgin "github.com/ulule/limiter/drivers/middleware/gin"
@franchb
franchb / go-chromeless-init.go
Created April 2, 2018 09:42
Go chromeless init
/* // create context
ctxt, cancel := context.WithCancel(context.Background())
defer cancel()
var options chromedp.Option
options = chromedp.WithRunnerOptions(
runner.HeadlessPathPort(pathBrowser, 9222),
runner.UserDataDir("D:\\TEMP"),
runner.Flag("headless", true),
runner.Flag("disable-gpu", true),

Install PostgreSQL 10 on Ubuntu

This is a quick guide to install PostgreSQL 10 - tested on Ubuntu 16.04 but likely can be used for Ubuntu 14.04 and 17.04 as well, with one minor modification detailed below.

(Optional) Uninstall other versions of postgres

To make life simple, remove all other versions of Postgres. Obviously not required, but again, makes life simple.

dpkg -l | grep postgres
@franchb
franchb / domains_typos.py
Created August 30, 2018 07:44
Check typos in domain names based on Levenshtein distance
import pandas as pd
import Levenshtein as lev
import numpy as np
white_domains = [
'gmail.com',
'yahoo.com',
'icloud.com',
'mail.ru',
'yandex.ru',
@franchb
franchb / calc_iv.py
Last active June 15, 2021 08:20
Calculate IV for a given DataFrame
# Original -- https://www.kaggle.com/pavansanagapati/weight-of-evidence-woe-information-value-iv
import pandas as pd
import numpy as np
import pandas.core.algorithms as algos
from pandas import Series
import scipy.stats.stats as stats
import re
import traceback
@franchb
franchb / separation_plot.py
Created September 5, 2018 12:09
Separation plot
# separation plot
# Author: Cameron Davidson-Pilon,2013
# see http://mdwardlab.com/sites/default/files/GreenhillWardSacks.pdf
import matplotlib.pyplot as plt
import numpy as np
@franchb
franchb / dist_test.py
Created September 5, 2018 12:23
Python distribution test
#!/usr/bin/env python
#title :distribution_checkX.py
#description :Checks a sample against 80 distributions by applying the Kolmogorov-Smirnov test.
#author :Andre Dietrich
#email :dietrich@ivs.cs.uni-magdeburg.de
#date :07.10.2014
#version :0.1
#usage :python distribution_check.py -f filename -v
#python_version :2.* and 3.*
#########################################################################################
@franchb
franchb / delete_git_submodule.md
Created March 15, 2019 07:30 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
ssh-keygen
-t ed25519 - for greatest security (bits are a fixed size and -b flag will be ignored)
-t rsa - for greatest portability (key needs to be greater than 4096 bits)
-t ecdsa - faster than RSA or DSA (bits can only be 256, 284, or 521)
-t dsa - DEEMED INSECURE - DSA limted to 1024 bit key as specified by FIPS 186-2, No longer allowed by default in OpenSSH 7.0+
-t rsa1 - DEEMED INSECURE - has weaknesses and shouldn't be used (used in protocol 1)
-b 4096 bit size
-a 500 rounds (should be no smaller than 64, result in slower passphrase verification and increased resistance to brute-force password cracking)
-C "First.Last@somewhere.com" comment..