Skip to content

Instantly share code, notes, and snippets.

View knowsuchagency's full-sized avatar
💭
hustlin'

Stephan Fitzpatrick knowsuchagency

💭
hustlin'
View GitHub Profile
@knowsuchagency
knowsuchagency / models.py
Last active November 10, 2015 09:03
my sqlalchemy eve experiment
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy import Column, String, Date, ForeignKey, Integer, Enum, DateTime, func
Base = declarative_base()
class CommonColumns(Base):
__abstract__ = True
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <set>
using namespace std;
vector<int> get_indexes(string input_string, char letter){
/* Return a vector of integers indicating the indexes where the char is
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <set>
using namespace std;
vector<int> get_indexes(string input_string, char letter){
/* Return a vector of integers indicating the indexes where the char is
@knowsuchagency
knowsuchagency / example.py
Created August 27, 2016 18:06
in-class assignment
"""
Hello foo.
This line won't output.
Foo Bar.
foooooooooo
"""
# The above text is in the ./file.txt file
def lines_with_foo(filepath):
with open(filepath) as infile:
@knowsuchagency
knowsuchagency / main.cpp
Created September 13, 2016 05:19
poker hands
#include <iostream>
#include <array>
#include <map>
using namespace std;
// prototype swapArrays
void swapArrays(array<int, 5>& stdArray, int oldArray[5]);
bool containsPair(int hand[]) {
// Return a true if hand contains a pair else false
@knowsuchagency
knowsuchagency / gitless.rb
Created October 3, 2016 21:03
gitless homebrew formula template
class Gitless < Formula
desc "Gitless: a version control system"
homepage "http://gitless.com/"
url "https://github.com/scottsideleau/gitless/archive/master.tar.gz"
version "0.8.3"
sha256 "df212d6a3d377f90c46d03fd4216ecbbeb40055b62c0fe73b9c3aa165ea8f0af"
depends_on :python if MacOS.version <= :snow_leopard
depends_on "libgit2"
@knowsuchagency
knowsuchagency / 04.pip
Created October 20, 2016 21:14
Gitless installation error log
2016-10-14 14:41:25 -0700
/usr/local/Cellar/gitless/0.8.4/libexec/bin/pip
install
-v
--no-deps
--no-binary
:all:
--ignore-installed
/private/tmp/gitless--cffi-20161014-50894-1qhyea5/cffi-1.8.3
@knowsuchagency
knowsuchagency / bash-cheatsheet.sh
Created October 21, 2016 03:56 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@knowsuchagency
knowsuchagency / decorators_example.py
Last active October 29, 2016 18:53
decorators example
import json
def introspect(func):
def inner(*args, **kwargs):
result = func(*args, **kwargs)
print('name:', func.__name__)
print('doc:', func.__doc__)
print('args:', args)
return result
@knowsuchagency
knowsuchagency / example.script
Last active December 5, 2016 22:58
pair client server example
Script started on Mon 05 Dec 2016 02:54:46 PM PST
[sfitzpa1@hills pair]$ ls
example.script users_client.py users_service.py
[sfitzpa1@hills pair]$ echo "Run server in background by appending & to command" && ./users_service.py &
[1] 7158
[sfitzpa1@hills pair]$ Run server in background by appending & to command
running server:
echo "Communicate with server using client script" && ./users_client.py fitz boyd
Communicate with server using client script
127.0.0.1 - - [05/Dec/2016 14:55:41] "GET /?strings=fitz,boyd HTTP/1.1" 200 -