Skip to content

Instantly share code, notes, and snippets.

View cs01's full-sized avatar

Chad Smith cs01

View GitHub Profile
@cs01
cs01 / google-oauth2-django-view.py
Last active November 3, 2016 00:47
django view file for google oauth2
"""Example Django views file to use Google's oauth2
Prequisites:
1. You have a the Google+ API enabled at console.developers.google.com
2. You have a OAuth 2.0 client ID
3. In the Client ID you have authorized
- JavaScript origin of http://127.0.0.1:8000
- Redirect URI of http://127.0.0.1:8000/google_callback
4. You have downloaded OAuth 2.0 client credentials to google_auth_data.json
5. You have a urls that direct requests to googlelogin and to google_callback
6. You have run
@cs01
cs01 / .jshintrc.js
Last active September 13, 2016 23:41 — forked from connor/.jshintrc.js
jshintrc example
// NOTE: this file should be stored at ~/.jshintrc
// to see explanation, and full list of options, see jshint/src/options.js
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals that JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
wget https://download.sublimetext.com/sublime-text_build-3126_amd64.deb
sudo dpkg -i sublime-text_build-3126_amd64.deb
print("pipx is working!")
@cs01
cs01 / venvhere in bash
Last active February 21, 2019 17:05
create a virtual enviroment, upgrade pip, and activate it
venvhere(){
python3 -m venv venv --prompt $(basename $PWD) && \
source venv/bin/activate && \
pip install -U pip --quiet
}
@cs01
cs01 / migrate_pipsi_to_pipx.py
Created May 2, 2019 16:16
Script to migrate from pipsi to pipx
#!/usr/bin/env python3
"""
Script to migrate from pipsi to pipx
"""
from pathlib import Path
import os
import subprocess
from shutil import which
@cs01
cs01 / gist:174f417c0857e11d9beffa4d17e600ac
Created August 1, 2019 03:42
pip install pyzmq on python 3.8b3
> pip install pyzmq
Collecting pyzmq
Using cached https://files.pythonhosted.org/packages/a8/5e/7e4ed045fc1fb7667de4975fe8b6ab6b358b16bcc59e8349c9bd092931b6/pyzmq-18.0.2.tar.gz
Installing collected packages: pyzmq
Running setup.py install for pyzmq ... error
ERROR: Command errored out with exit status 1:
command: /tmp/pvenv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6mnvkxwv/pyzmq/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6mnvkxwv/pyzmq/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-57y2pv8f/install-record.txt --single-version-externally-managed --compile --install-headers /tmp/pvenv/include/site/python3.8/pyzmq
cwd: /tmp/pip-install-6mnvkxwv/pyzmq/
Complete output (558 lines):
running install
@cs01
cs01 / video_to_gif.py
Last active August 25, 2022 18:41
convert a video to a gif
#! python3
"""Convert a video to gif with ffmpeg"""
import argparse
import logging
import shlex
import shutil
import subprocess
from pathlib import Path
#!/bin/bash
while getopts ":i:o:t:" opt; do
case $opt in
i) input="$OPTARG"
;;
o) output="$OPTARG"
;;
t) text="$OPTARG"
;;