Skip to content

Instantly share code, notes, and snippets.

View encima's full-sized avatar
🐴
selling spare horse kidneys. PM me

Chris Gwilliams encima

🐴
selling spare horse kidneys. PM me
View GitHub Profile
@encima
encima / git_cheatsheet.md
Last active December 1, 2016 19:52
Git cheatsheet

Git Cheatsheet

GOLDEN RULE: PULL BEFORE YOU PUSH!

Initial Steps

  1. git init
    • Creates a git repository locally on your machine. (this is basically a .git folder with config and other things inside)
  2. git remote add origin <link>
    • Addss the link of the remote repository (github, gitlab) etc as the origin alias
@encima
encima / pomo.sh
Last active September 14, 2020 19:49
A basic script to run pomodoro sessions in the terminal. Uses figlet, everything else comes with OS X|-|{"files":{"pomo.sh":{"env":"plain"}},"tag":"Shell"}
#!/bin/bash
# A simple script (for OS X, currently) that runs a pomodoro type session for the specified duration
c=1
while [ $c ]
do
if [ "$#" -ne 2 ]; then
echo "Usage: $0 DURATION BREAK_LENGTH" >&2
echo "Hint: 20 mins is 1200 seconds and 3 minutes is 180 seconds"
exit 1
@encima
encima / find_n_move.sh
Last active September 14, 2020 19:50
Find files based on modified time and move to a directory|-|{"files":{"find_n_move.sh":{"env":"plain"}},"tag":"Shell"}
#!/bin/bash
# 1- file 2- minutes 3- dir
find $1 -mmin $2 -exec mv -t $3 {} \+
@encima
encima / OPENNI_RPI.sh
Last active December 1, 2016 19:52
OPENNI for RPI
sudo apt-get install openjdk-6-jdk libusb-1.0-0-dev
cd ~
mkdir OPENNI
cd OPENNI
mkdir OPENNI_RPI
cd OPENNI_RPI
if [ -f "OPENNI_RPI_SRC.zip"]
then
unzip OPENNI_RPI_SRC.zip
@encima
encima / resize.py
Last active September 14, 2020 19:49
Resizes a set of images found in a directory|-|{"files":{"resize.py":{"env":"plain"}},"tag":"Python"}
# Author: Chris Gwilliams
# Date: 22/7/14
# Usage: python resize.py [dir]
# Requires: PIL
# Purpose grabs every image in specified dir (and subdirs) and resizes according to the size variable
import os, sys
import Image
# set your size here, PIL will try and make it a bit smarter
size = 1280, 720
@encima
encima / github_makerepo.py
Last active September 14, 2020 19:50
Using the PyGithub library to create a new repo and initiate it in the current director.|-|{"files":{"github_makerepo.py":{"env":"plain"}},"tag":"Python"}
from github import Github
import sys, os
if len(sys.argv) == 4:
g = Github(sys.argv[1], sys.argv[2])
g.get_user().create_repo(sys.argv[3])
print '' + sys.argv[3] + ' created!'
print os.getcwd()
os.system('git init')