Skip to content

Instantly share code, notes, and snippets.

Avatar
🍀
make your own luck

JC jamesacampbell

🍀
make your own luck
View GitHub Profile
@jamesacampbell
jamesacampbell / Count lines in Git repo
Created Mar 1, 2021 — forked from mandiwise/Count lines in Git repo
A command to calculate lines of code in all tracked files in a Git repo
View Count lines in Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
View golang1158_installer_ubuntu20.sh
#!/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
@jamesacampbell
jamesacampbell / add_to_cart.user.js
Created Feb 12, 2021 — 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.
View add_to_cart.user.js
// ==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
View pyinstaller-windows-example.sh
# 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
@jamesacampbell
jamesacampbell / runbook.md
Last active Nov 17, 2020
run book to get Ubuntu 20.04 to run on Macbook Pro 16inch
View runbook.md

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

@jamesacampbell
jamesacampbell / plotweeks.py
Last active May 5, 2020
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
View plotweeks.py
# 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
@jamesacampbell
jamesacampbell / email.py
Last active Mar 19, 2020
The best email parser on the planet. Email extraction. You are welcome world.
View email.py
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
@jamesacampbell
jamesacampbell / windows-10-wsl-help.txt
Last active Feb 27, 2020
how to reset wsl password for ubuntu user in windows subsystem linux
View windows-10-wsl-help.txt
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)
View decryptpdf.sh
pdfcrack -f [filename].pdf
qpdf --decrypt --password='[found password]' [filename].pdf output_file.pdf
@jamesacampbell
jamesacampbell / get-status.sh
Created Dec 16, 2019
how to quickly get head status of each url for onion sites
View get-status.sh
#!/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