Skip to content

Instantly share code, notes, and snippets.

View rugbyprof's full-sized avatar

Terry Griffin rugbyprof

View GitHub Profile
@rugbyprof
rugbyprof / backend.php
Created October 26, 2015 21:03
posting form to backend and write to file.
<?php
//create folder "data" that's writable
$command = $_POST['command'];
switch($command){
case 'save': //do something
break;
case 'delete': //do something
@rugbyprof
rugbyprof / run-john.sh
Created February 10, 2016 15:50
Finding weak passwords using john the ripper
#sudo apt-get install john
sudo /usr/sbin/unshadow /etc/passwd /etc/shadow > /tmp/crack.password.db
john /tmp/crack.password.db
@rugbyprof
rugbyprof / bst.cpp
Last active February 22, 2016 17:52
Simple Binary Search Tree Starter
#include <iostream>
using namespace std;
struct Node{
int Data;
Node *left;
Node *right;
};
@rugbyprof
rugbyprof / file_permission.py
Created February 29, 2016 23:38
Use stat to get file permissions and print out in octal format.
import stat
import os
import sys
if len(sys.argv) < 2:
print("Usage: stat_test.py file_name")
file = sys.argv[1]
#print oct(stat.S_IMODE(os.lstat(file).st_mode))
print oct(stat.S_IMODE(os.stat(file).st_mode))
@rugbyprof
rugbyprof / index.js
Created June 28, 2016 04:03 — forked from max-mapper/index.js
cave generator
var observer = require('continuous-observer')
var cave = require('cave-automata-2d')
var fill = require('ndarray-fill')
var zero = require('zeros')
var raf = require('raf')
var canvas = document.createElement('canvas')
var ctx = canvas.getContext('2d')
// Set up the controls, so that we can control
@rugbyprof
rugbyprof / README.md
Created July 11, 2016 22:46 — forked from chrisjacob/README.md
Setup GitHub Pages "gh-pages" branch as a subfolder within the "master" project on your local checkout - a step-by-step guide.

Intro

Setup GitHub Pages "gh-pages" branch as a subfolder within the "master" project on your local checkout.

IMPORTANT

If you plan on switching between different branches (e.g. git checkout master-experiment then revert back with git checkout master) you will loose your child folder from this tutorial (because it's in your .gitignore and is not part of your master branch).

@rugbyprof
rugbyprof / remove.sh
Created August 19, 2016 23:17
remove files of certain size
find . -name "*.tif" -size -160k -delete
@rugbyprof
rugbyprof / gif.sh
Created September 8, 2016 19:34
animated gif using imagemagick
convert -background white -alpha remove -layers OptimizePlus -delay 25x50 *.jpg -loop 1 -morph 5 animation.gif
@rugbyprof
rugbyprof / read_file.sh
Last active September 9, 2016 18:30
Read a file passed in as an argument
#!/bin/bash
# Assuming the "words" file exists.
# Usage ./read_file.sh /usr/share/dict/words
while read -r line
do
word="$line"
echo "Dict word: $word"
done < "$1"
@rugbyprof
rugbyprof / print_markdown_rubric.py
Created September 14, 2016 20:13
Print md rubric
import sys
sys.path
sys.path.append('/usr/local/lib/python3.4/site-packages')
from tabulate import tabulate
if __name__ == '__main__':
table = []