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 / replace_text.ipynb
Last active July 18, 2018 13:30
test python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@james-see
james-see / pi-headless.sh
Last active July 30, 2018 19:44
new pi headless setup
#default ssh into raspian after adding ssh to boot volume:
ssh [email protected]
sudo hostnamectl set-hostname whateveryourname
sudo adduser youruser
sudo adduser youruser sudo
sudo apt install ufw
sudo ufw allow 1981
sudo ufw limit ssh/tcp
add ssh stuff
change users
@james-see
james-see / pandora-shortcuts.txt
Created August 30, 2018 03:10
pandora shortcuts
Space bar: Play/pause
n (n): Skip track
Up-arrow: Volume up
Down-arrow: Volume down
Shift-Down-arrow: Mute volume
Shift-Up-arrow: Maximize volume
Plus (+): Thumbs up
Minus (-): Thumbs down
This seems to work fine in pianobar (`brew install pianobar` on OSX)
@james-see
james-see / get-raspberry-pi-macs.py
Last active October 29, 2018 16:25
Get all raspberry pi devices on a network
# check requirements.txt and install via pip3 accordingly
import getmac
currentnum = 1
macme = 'What network do you want to check? (10.2.2.0/24): '
if macme.endswith('/24'):
limit = 256
while currentnum < limit:
checkip = rsplit(macme, '.')[0] + f'.{currentnum}'
print(f'ip checking now: {checkip}')
macaddressfound = getmac.get_mac_address(ip=checkip)
@james-see
james-see / datafetch.html
Last active January 4, 2022 22:44
vue js and axios example
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>Vue js + Axios</title>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
</head>
<body>
<div id="app">
@james-see
james-see / python37-compile.sh
Created November 18, 2018 04:07
python37 install compile from scratch centos
cd /tmp
sudo yum install gcc openssl-devel bzip2-devel
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
tar xzf Python-3.7.1.tgz
cd Python-3.7.1
./configure --enable-optimizations
sudo make altinstall
echo 'alias python3=/usr/local/bin/python3.7' >> ~/.zshrc
source ~/.zshrc
@james-see
james-see / golang-centos.sh
Last active November 18, 2018 04:41
golang 1.11 install centos
cd /tmp
curl -LO https://storage.googleapis.com/golang/go1.11.linux-amd64.tar.gz
sudo tar -C /usr/local -xvzf go1.11.linux-amd64.tar.gz
sudo touch /etc/profile.d/path.sh
sudo sh -c "echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile.d/path.sh"
mkdir -p ~/go/{bin,pkg,src}
# sets paths properly
echo 'export GOBIN="$HOME/go/bin"' >> ~/.zshrc
echo 'export GOPATH="$HOME/go/src"' >> ~/.zshrc
echo 'export GOROOT="/usr/local/go"' >> ~/.zshrc
@james-see
james-see / PYPI-forget-me-not.md
Last active November 18, 2019 19:00
Forget me not file for how to get packages into PYPI

Want to make your python script / app into a pip installable package? So did I, and I keep forgetting when I need to update the versions.

I maintain IPTCInfo3, spry, itunizer, and riskroller.
Make sure to have a setup.py file that is formatted similar to this:

import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()
@james-see
james-see / supervisord-forget-me-not.md
Created February 18, 2019 19:20
How to install and setup supervisord to turn scripts into services and with gunicorn and hug as an example

Followed this great explainer: https://nicksergeant.com/running-supervisor-on-os-x/

Install

  1. brew install supervisor
  2. brew services start supervisor
  3. Install gunicorn by pip3 install git+https://github.com/benoitc/gunicorn.git
  4. cp /usr/local/etc/supervisord.ini /usr/local/etc/supervisord.conf
  5. mkdir /usr/local/etc/supervisor.d
  6. touch /usr/local/etc/supervisor.d/gunicorn.ini
  7. mkdir /$HOME/projects
@james-see
james-see / vscodecustom.css
Created April 3, 2019 12:59
vscode css custom for ligatures and nice font!
/* /// OPTIONAL ///
you can comment out this part if you don't want to change the default font for the UI
*/
.monaco-shell {
font-feature-settings: "ss01";
font-family: "Cartograph Mono CF", monospace;
}