Skip to content

Instantly share code, notes, and snippets.

View toastdriven's full-sized avatar

Daniel Lindsley toastdriven

View GitHub Profile
@toastdriven
toastdriven / random.go
Created March 3, 2015 06:53
Random (in Python, Javascript, Go & Swift)
// Remove Me
package main
// package random
import (
"fmt"
"math/rand"
"time"
)
import { useState, useEffect } from 'react';
import { useQuery } from 'react-query';
// Pretend this is real & extracts server-side data from a hidden element with
// `data-*` attributes or similar.
import { pageContext } from '../utils/pageTools';
// Again, pretend this is real & handles websocket comms.
import {
followUserActivity,
@toastdriven
toastdriven / RiakHttp10k.txt
Created October 29, 2010 14:26
Benching Riak's performance with the Python client.
[daniel@Europa:Desktop]: python riak_test.py
Inserting 0
Inserting 1000
Inserting 2000
Inserting 3000
Inserting 4000
Inserting 5000
Inserting 6000
Inserting 7000
Inserting 8000
@toastdriven
toastdriven / profiling.rst
Created November 9, 2011 06:42
Getting QCacheGrind Running & Working With Python Profilers

Get QCacheGrind Running

  • brew install qt --with-qt3support
  • brew install graphviz
  • sudo ln -s /usr/local/bin/dot /usr/bin/dot (?)
  • svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdesdk/kcachegrind kcachegrind
  • cd kcachegrind/qcachegrind
  • qmake -spec 'macx-g++'
  • make
@toastdriven
toastdriven / rebuild_environment.sh
Last active December 3, 2019 19:12
Rebuild Environment
brew install git
brew update
brew install readline
brew link readline
brew install python
brew install postgres
brew install tmux
brew install pip
brew install nginx
brew install libevent
@toastdriven
toastdriven / awi_test.py
Created August 19, 2013 23:58
A simple test script for AWS's Web Identity Federation.
# Use the following to generate the necessary values.
# https://web-identity-federation-playground.s3.amazonaws.com/index.html
from boto.sts.connection import STSConnection
sts = STSConnection(anon=True)
# Substitute your own values from the Playground here.
arn = 'arn:aws:iam::XXXXXXX:role/WebIdFed_Amazon'
session_name = 'web-identity-federation'
token = 'Atza|XXXXXXX'
# For Django, at the bottom of ``settings.py`` after all your other settings...
# Setup a BoundLogger for the project/apps to use...
import structlog
structlog.BoundLogger.configure(
context_class=structlog.ThreadLocalDict(dict),
)
@toastdriven
toastdriven / sc2_must_watches.md
Last active July 11, 2016 19:30
Must-Watch VODs for any SC2 player
@toastdriven
toastdriven / haystack.sh
Created October 9, 2009 05:30
haystack.sh
#!/bin/sh
# First, open up GitX
cd ~/Code/Python/django-haystack; gitx
tmux start-server
tmux new-session -d -s Haystack -n git
tmux new-window -tHaystack:1 -n test
tmux new-window -tHaystack:2 -n solr
tmux new-window -tHaystack:3 -n docs
tmux new-window -tHaystack:4 -n runserver
@toastdriven
toastdriven / autocomplete.py
Created February 21, 2011 19:12
How to make multiple word autocomplete work in Haystack.
import operator
from haystack.query import SearchQuerySet, SQ
query = 'lil way'
sqs = SearchQuerySet().filter(reduce(operator.__and__, [SQ(name=word.strip()) for word in query.split(' ')]))