Skip to content

Instantly share code, notes, and snippets.

View james-see's full-sized avatar
🍀
make your own luck

JC james-see

🍀
make your own luck
View GitHub Profile
@james-see
james-see / Count lines in Git repo
Created March 1, 2021 23:16 — forked from mandiwise/Count lines in Git repo
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
@james-see
james-see / golang1158_installer_ubuntu20.sh
Created February 14, 2021 23:08
install golang on ubuntu 20.04
#!/bin/bash
mkdir -p ~/Downloads
cd ~/Downloads
wget https://golang.org/dl/go1.15.8.linux-amd64.tar.gz
sudo tar -xvf go1.15.8.linux-amd64.tar.gz
sudo mv go /usr/local
sudo echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.zshrc
source ~/.zshrc
@james-see
james-see / add_to_cart.user.js
Created February 12, 2021 15:21 — forked from beporter/add_to_cart.user.js
Greasemonkey script to repeatedly refresh a given page, look for specific "Add to Cart" buttons, click them if present, and make a lot of noise on success.
// ==UserScript==
// @name Add Saved Items to Cart
// @namespace https://gist.github.com/beporter/ce76204bcba35d9edb66b395bb5e9305
// @version 0.5
// @description Repeatedly refresh a given "saved items" page (Amazon, Walmart, BestBuy), look for specific "Add to Cart" buttons, click them if present, and make a lot of noise on success.
// @author https://github.com/beporter
// @match https://www.amazon.com/gp/registry/wishlist/*
// @match https://www.amazon.com/hz/wishlist/ls/*
// @match https://www.bestbuy.com/cart
// @match https://www.bestbuy.com/site/customer/lists/manage/saveditems
@james-see
james-see / pyinstaller-windows-example.sh
Last active October 12, 2020 13:51
pyinstaller for windows
# choco install python
# open up admin PowerShell and run:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# then install python which should install the latest at c:\Python3x
choco install python
# then install pip packages
pip install pefile
@james-see
james-see / runbook.md
Last active November 17, 2020 23:29
run book to get Ubuntu 20.04 to run on Macbook Pro 16inch

pre-flight

  1. Install latest Ubuntu to thumbdrive via unetbootin or etcher (now balena bs or whatever)
  2. Install refind after disabling the software integrity lock bs
  3. Create new FAT32 partition like 200GB if you can spare it on a 1TB Mac OS if not, you need at least 20GB
  4. Boot to live Ubuntu GUI install using compability mode (it will fail otherwise)

get wifi working with Cudy dongle

These instructions work: https://github.com/cilynx/rtl88x2bu to achieve 200MB down and up if within LOS

@james-see
james-see / plotweeks.py
Last active May 5, 2020 16:09
your life in 90 years by 52 weeks 4680 total example here https://labs.coruscantconsulting.co.uk/life/weeks/ and this https://waitbutwhy.com/2014/05/life-weeks.html by Tim Urban
# matplotlib version
# import matplotlib.pyplot as plt
# fig, axes = plt.subplots(ncols=24, sharex=True, sharey=True)
# for ax in axes:
# ax.plot([1, 2, 3], [1, 2, 3])
# ax.set(adjustable='box', aspect='equal')
# plt.show()
from PIL import Image, ImageDraw
@james-see
james-see / email.py
Last active April 20, 2022 22:21
The best email parser on the planet. Email extraction. You are welcome world.
import re
def finder(stringer):
EMAIL_REGEX = re.compile("(?:[a-zA-Z0-9!#$%&'*+\-\/\=?^_`{|}~]|\.(?!\.)){1,64}@(?:(?:[a-zA-Z0-9\-]){1,63}\.(?!\.)){1,4}(?:[a-zA-Z0-9]{2,12})")
emails = EMAIL_REGEX.findall(stringer)
return emails
@james-see
james-see / windows-10-wsl-help.txt
Last active February 27, 2020 16:56
how to reset wsl password for ubuntu user in windows subsystem linux
I ran the following commands from the Windows command prompt to reset my password. Anything after the # is a comment:
ubuntu config --default-user root
ubuntu.exe # (to run WSL in the current Windows command prompt)
whoami # (to see who I'm currently logged in as)
tail -3 /etc/passwd # (to see the last three users added to the Ubuntu system)
passwd user01 # (to change the password for user01)
exit # (to exit WSL)
ubuntu config --default-user user01 # (to set the default user for the WSL terminal)
@james-see
james-see / decryptpdf.sh
Created January 28, 2020 18:03
decrypt pdf
pdfcrack -f [filename].pdf
qpdf --decrypt --password='[found password]' [filename].pdf output_file.pdf
@james-see
james-see / get-status.sh
Created December 16, 2019 21:42
how to quickly get head status of each url for onion sites
#!/bin/bash
while read LINE; do
curl -o /dev/null --silent --socks5-hostname 127.0.0.1:9050 --head --write-out "%{http_code} $LINE\n" "$LINE"
done < url-list.txt