Skip to content

Instantly share code, notes, and snippets.

View Tjorriemorrie's full-sized avatar
💭
most repos are private

Tjorriemorrie Tjorriemorrie

💭
most repos are private
  • South Africa
  • 06:03 (UTC +02:00)
View GitHub Profile
@Tjorriemorrie
Tjorriemorrie / loader.py
Last active November 16, 2015 07:44
multiprocessing
import os
import time
import requests
import argparse
from config import *
from logger import Logger
from bigquery import BigQuery
from storage import Storage
from solr import Solr
from oauth2client.client import GoogleCredentials
@Tjorriemorrie
Tjorriemorrie / install-pre-commit.sh
Created November 4, 2015 13:27 — forked from stefansundin/install-pre-commit.sh
Git pre-commit check to stop accidental commits to master and develop branches. There is also a variant with a core.whitespace check.
#!/bin/sh
# This script will install a Git pre-commit hook that stop accidental commits to master and develop branches.
# There is also a variant that includes a core.whitespace check. See pre-commit-2 below.
# Install in current Git repo:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh
# Install with core.whitespace check:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh -s pre-commit-2
# Install with core.whitespace check and EOF-newline-check:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh -s pre-commit-3
# Install only core.whitespace check:
@Tjorriemorrie
Tjorriemorrie / The Technical Interview Cheat Sheet.md
Created October 29, 2015 12:07 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@Tjorriemorrie
Tjorriemorrie / for your app
Created October 9, 2015 07:53
Python logging verbosity
parser.add_argument('-v', '--verbose', action='count', default=0)
parser.add_argument('-q', '--quiet', action='count', default=0)
logging_level = logging.WARN + 10*args.quiet - 10*args.verbose
# script -vv -> DEBUG
# script -v -> INFO
# script -> WARNING
# script -q -> ERROR
# script -qq -> CRITICAL
@Tjorriemorrie
Tjorriemorrie / json_encoder.py
Created July 23, 2015 13:35
Flask-SqlAlchemy encoder
# refer http://stackoverflow.com/questions/5022066/how-to-serialize-sqlalchemy-result-to-json#answer-31569287
from sqlalchemy.ext.declarative import DeclarativeMeta
from flask import json
class AlchemyEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o.__class__, DeclarativeMeta):
data = {}
#!/usr/bin/env python2
#
# Copyright 2014 Google, Inc.
# All Rights Reserved.
"""gsa_feed.py pushes an xml feed file to the GSA.
1. pushes an XML file to the GSA
2. show examples feed for each feedtype
3. validates GSA XML feed with a DTD
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@Tjorriemorrie
Tjorriemorrie / main.py
Created April 18, 2015 10:13
Does not work
import argparse
import random
from os import path
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Entelect Challenge Python Bot Player', epilog='Good luck!')
parser.add_argument('output_path', help='the output path where files will be saved')
args = parser.parse_args()
if not path.exists(args.output_path):
@Tjorriemorrie
Tjorriemorrie / test.py
Created July 14, 2014 14:10
POC for forex using RF
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.dates import YearLocator, MonthLocator, DateFormatter
from sklearn.ensemble import RandomForestRegressor
from sklearn.cross_validation import cross_val_score
import sklearn as sk
df = pd.read_csv(
@Tjorriemorrie
Tjorriemorrie / .htaccess
Created March 7, 2014 08:17
Symfony2 shared hosting htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>