Skip to content

Instantly share code, notes, and snippets.

@stealthbomber10
stealthbomber10 / scan.sh
Created May 12, 2020 22:45
Make your PDF look scanned
convert -density 150 input.pdf -colorspace gray -linear-stretch 3.5%x10% -blur 0x0.5 -attenuate 0.25 +noise Gaussian -rotate 0.5 temp.pdf
gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite -sColorConversionStrategy=LeaveColorUnchanged dAutoFilterColorImages=true -dAutoFilterGrayImages=true -dDownsampleMonoImages=true -dDownsampleGrayImages=true -dDownsampleColorImages=true -sOutputFile=output.pdf temp.pdf
@stealthbomber10
stealthbomber10 / scrape.py
Created December 4, 2019 19:25
scraping contact info from some real estate broker site
import requests
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup
driver = webdriver.Firefox(executable_path='C:\\Users\\steal\\workplace\\scrape\\geckodriver.exe')
for i in range(1, 24):
@stealthbomber10
stealthbomber10 / hosts
Last active March 6, 2019 22:44
Hosts File to Block Facebook from my Machine (write to /etc/hosts)
127.0.0.1 api.ak.facebook.com
127.0.0.1 api.connect.facebook.com
127.0.0.1 api.facebook.com
127.0.0.1 app.facebook.com
127.0.0.1 apps.facebook.com
127.0.0.1 ar-ar.facebook.com
127.0.0.1 badge.facebook.com
127.0.0.1 blog.facebook.com
127.0.0.1 connect.facebook.com
127.0.0.1 connect.facebook.net
@stealthbomber10
stealthbomber10 / reg.py
Created February 24, 2019 22:22
linear regression help for jp
from xlrd import open_workbook
import numpy as np
import statsmodels.api as sm
'''
HOW TO RUN
Make sure FILE_NAME matches the name of the spreadsheet (change any spaces to underscores).
Make sure DEPEDENT_VAR_COL_NUMBER is set to the number of the column where your depedent variable is.
@stealthbomber10
stealthbomber10 / dups.txt
Created October 22, 2018 10:07
interview cake duplicate files
You left your computer unlocked and your friend decided to troll
you by copying a lot of your files to random spots all over your file
system.
@stealthbomber10
stealthbomber10 / stripe.py
Created October 10, 2018 19:01
stripe interview
from collections import defaultdict
import string
# You're running a pool of servers where the servers are numbered sequentially starting from 1. Over time, any given server might explode, in which case its server number is made available for reuse. When a new server is launched, it should be given the lowest available number.
# Write a function which, given the list of currently allocated server numbers, returns the number of the next server to allocate. In addition, you should demonstrate your approach to testing that your function is correct. You may choose to use an existing testing library for your language if you choose, or you may write your own process if you prefer.
# For example, your function should behave something like the following:
# >> next_server_number([5, 3, 1])
@stealthbomber10
stealthbomber10 / Crypto.py
Created April 21, 2018 11:31
all creds to cubie tom
#!/usr/bin/env python
"""
Created on Thu Mar 22 15:12:20 2018
@author: Cubie, Tom Aarsen
"""
import requests, time
from multiprocessing import Pool
@stealthbomber10
stealthbomber10 / spurdo
Last active January 26, 2018 04:12
make ur own spurdo :DDDDDD (e.g. "cat <text> | spurdo | xclip")
spurdo() {
sed "s/kek/geg/gI;s/epic/ebin/gI;s/america/clapistan/gI;s/right/rite/gI;s/your/ur/gI;s/\./ :DD/gI;s/'//gI;s/,/XDD/gI;s/wh/w/gI;s/th/d/gI;s/af/ab/gI;s/ap/ab/gI;s/ca/ga/gI;s/ck/gg/gI;s/co/go/gI;s/ev/eb/gI;s/ex/egz/gI;s/et/ed/gI;s/iv/ib/gI;s/it/id/gI;s/ke/ge/gI;s/nt/nd/gI;s/op/ob/gI;s/ot/od/gI;s/po/bo/gI;s/pe/be/gI;s/pi/bi/gI;s/up/ub/gI;s/va/ba/gI;s/ck/gg/gI;s/cr/gr/gI;s/kn/gn/gI;s/lt/ld/gI;s/mm/m/gI;s/nt/dn/gI;s/pr/br/gI;s/ts/dz/gI;s/tr/dr/gI;s/bs/bz/gI;s/ds/dz/gI;s/es/es/gI;s/fs/fz/gI;s/gs/gz/gI;s/ is/iz/gI;s/as/az/gI;s/ls/lz/gI;s/ms/mz/gI;s/ns/nz/gI;s/rs/rz/gI;s/ss/sz/gI;s/ts/tz/gI;s/us/uz/gI;s/ws/wz/gI;s/ys/yz/gI;s/alk/olk/gI;s/ing/ign/gI;s/ic/ig/gI;s/ng/nk/gI" \
<<< "${@:-$(cat /dev/stdin)}"
}
journalctl --vacuum-size=100M #remove all logs, only retain 100mb
pacman -Scc #remove all package installation files (obsolete and current)
pacman -S bleachbit #if not installed already
bleachbit -c system.*
pacrmorphans #zsh alias to remove orphaned packages
sudo paccache -ruk0 #remove all that aren't installed
@stealthbomber10
stealthbomber10 / google-advertisement-scanner.js
Created August 30, 2017 02:21
This script opens 2 tabs in your browser and automatically searches the top 1000 keywords for Google Ad Sense on Google
// copied from here: https://jsfiddle.net/icefrogcode/kqdx7cyb/1/
// ALL CREDITS GO TO ICEFROG
// the associated html page for reference:
// <div>
// <h1>
// Google Advertisment Scanner
// </h1>
// <p>
// <b>What does it do?</b> This script opens 2 tabs in your browser and automatically searches the top 1000 keywords for Google Ad Sense on Google. Google Ad Sense is the Advertisement service google runs.
// </p>