Skip to content

Instantly share code, notes, and snippets.

@scwood
scwood / undo.vim
Last active July 18, 2017 17:34
Persistant undo for Vim
if has('persistent_undo')
if !isdirectory($HOME . "/.vim/backups")
call mkdir($HOME . "/.vim/backups", "p")
endif
set undodir=~/.vim/backups
set undofile
endif
{
"mysql": {
"primary_datasource": "mysql:dbname=UnderArmour;host=uat2.crl42zznvecl.us-west-2.rds.amazonaws.com;charset=utf8",
"oauth_datasource": "mysql:dbname=Oauth;host=uat2.crl42zznvecl.us-west-2.rds.amazonaws.com;charset=utf8",
"user": "dba",
"password": "peterkwan4ever"
},
"mongo": {
"datasource": "10.1.12.106",
"user": "root",
public int add(Person person) throws DatabaseException {
PreparedStatement stmt = null;
ResultSet keyRS = null;
try {
String query = "INSERT INTO person (user_name, password, first_name, last_name, email, number_indexed) VALUES (?, ?, ?, ?, ?, ?)";
stmt = db.getConnection().prepareStatement(query);
stmt.setString(1, person.getUserName());
stmt.setString(2, person.getPassword());
stmt.setString(3, person.getFirstName());
stmt.setString(4, person.getLastName());
@scwood
scwood / WeakAuras.lua
Last active February 11, 2016 06:10
Rest Druid WA
WeakAurasSaved = {
["displays"] = {
["Wild Mushroom Low"] = {
["color"] = {
1, -- [1]
1, -- [2]
1, -- [3]
1, -- [4]
},
num_pics = int(input())
for i in range(num_pics):
lines = []
for j in range(10):
line = input().rstrip()
lines.append(line)
for j in range(-1, -16, -1):
for l in lines:
print(l[j], end='')
print()
import re
class Solver(object):
def solve_sudoku(self, board):
if self._solve(board):
return board
return None
def _solve(self, board):
for r in range(9):
@scwood
scwood / freeze_files.py
Last active May 11, 2016 15:29
File Freezer for Dr. Es's Chemistry Research
#! /usr/bin/env python
import os
import sys
def generate_permutations(value_1, value_2, increment, iterations):
permutations = set()
for i in range(iterations):
value_1 += increment * i
@scwood
scwood / grade_compare.cpp
Created June 29, 2016 00:02
Comparison operator
bool operator<(Grade const &a, Grade const &b) {
return a.className < b.className ||
(a.className == b.className && a.score < b.score);
}
@scwood
scwood / hash.py
Last active March 15, 2023 16:20
python hash table using linear probing
class HashTable(object):
def __init__(self):
self.max_length = 8
self.max_load_factor = 0.75
self.length = 0
self.table = [None] * self.max_length
def __len__(self):
return self.length

Keybase proof

I hereby claim:

  • I am scwood on github.
  • I am spencerwood (https://keybase.io/spencerwood) on keybase.
  • I have a public key whose fingerprint is DD9C 241A 1736 3C31 29F6 1AFB DCCD 522B 1498 671F

To claim this, I am signing this object: