Skip to content

Instantly share code, notes, and snippets.

View timsegraves's full-sized avatar

Tim Segraves timsegraves

View GitHub Profile
@timsegraves
timsegraves / gist:1423711
Created December 2, 2011 15:51
Git Commands

Git Command Cheat Sheet

Restore a deleted file

This grabs the last version of a file and restores it

git checkout $(git rev-list -n 1 HEAD -- "$file")^ -- "$file"

@timsegraves
timsegraves / gist:3178722
Created July 25, 2012 21:17
Tomorrow and tomorrow
TERMAHRER, ERND TERMAHRER, ERND TERMAHRER CRERPS ERN THERS PERTER PERC FRERM DER TER DER T DA LERST
SERLERBL ERF RERCERDERD TERMAH ERND ERL ER YERSTERDERS HERV LERGHTERD FERLS TH WER TER DERSTER DERTH.
ERT, ERT, BRERF CERNDLER LERFERS BERT A WERLKIN SHERDER, A PER PLER THERT STRERTS ERND FRERTS HERS HER
ERPERN DA STERGER ERND THERN ERS HERD NER MAHR. ERT ERS A TERLER TERLD BER ERN ERDERT, FERL ERF SERND
ERND FERER SERGNERFIN NERTHIN.
@timsegraves
timsegraves / gist:3208945
Created July 30, 2012 18:27
Test failures
Failures:
1) Testable::ApidController should return a successful response
Failure/Error: get '/testable/apid'
Errno::ECONNREFUSED:
Connection refused - connect(2)
# ./lib/apid/old_apid.rb:16:in `request'
# ./lib/apid/generic_apid.rb:11:in `generic'
# ./app/controllers/testable/apid_controller.rb:3:in `index'
# ./config/initializers/quiet_assets.rb:6:in `call_with_quiet_assets'
So this should make the first part of the query in the code return nothing and it will be unioned with the second hand which should return bob's user id, my password_hash, and my salt value.
' UNION select id, '<USE VAL FROM PY BELOW>', 'test' from users where username='bob'; --
#!/usr/bin/env python
import hashlib
import json
import logging
@timsegraves
timsegraves / gist:3564743
Created September 1, 2012 05:38
Mary Class
class Mary {
// This is a variable storing the current age
int age = 0;
int weight = 100;
// This is a method to increment the current age variable by the amount passed in
function increaseAge(int amount) {
age = age + amount;
}
@timsegraves
timsegraves / gist:3646311
Created September 5, 2012 22:24 — forked from anonymous/gist:3645770
Austin's Convert Program
import java.util.Scanner;
public class Convert
{
public static void main(String[] args)
{
//allowing us to take input from the keyboard
Scanner keyboard = new Scanner(System.in);
//delcaring variables
@timsegraves
timsegraves / gist:3757848
Created September 20, 2012 19:27
Memcache.yml - Chef'd
# Config settings for memcache servers
defaults: &DEFAULTS
memcache_prefix: 'aaabbbcccddd'
memcache_servers:
- '127.0.0.1'
development:
<<: *DEFAULTS
- if provisions.count > 0
%table.table.table-striped.table-bordered.tablesorter
%thead
%tr
%th ID
%th Username
%th Email
%th Package
%th Created Date
%th Actions
@timsegraves
timsegraves / gist:3831334
Created October 4, 2012 03:38
Austin Reverse Diag
// Reverse Diagonal
for (int i = 0; i < space; i++){
System.out.print(num + " ");
num++;
for(int j = 0; j < space; j++){
if (j + i == 5) {
System.out.print(" *");
}
else {
@timsegraves
timsegraves / gist:3856525
Created October 9, 2012 04:03
Cube for Austin
str = "JAYHAWK"
i = 0
j = 0
builder = ""
# Each item in this loop will be a new line in your cube
while i < str.length do
# Reset the variables (won't need to do this in java for loops)
builder = ""
j = i