Skip to content

Instantly share code, notes, and snippets.

View toastdriven's full-sized avatar

Daniel Lindsley toastdriven

View GitHub Profile
@endolith
endolith / Has weird right-to-left characters.txt
Last active October 26, 2024 13:55
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@toastdriven
toastdriven / .tmux.conf
Created October 8, 2009 20:12
.tmux.conf
set -g prefix C-a
unbind C-b
bind C-a send-prefix
set bell-action none
set-option -g status-left ""
set-option -g status-right "#S"
set -g status-bg black
set -g status-fg white
set utf8-default on
@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
=============================================================
Installing Multicore Solr 1.3.0 / Tomcat 6.0.X on Ubuntu 8.10
=============================================================
Install OpenJDK (comes from universe)::
aptitude install openjdk-6-jre
Download Tomcat 6.X and move it in place::
@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
I needed to find info on a sequence that was causing problems with one of our apps, and couldn't find any info online. Here's what I ended up doing.
\d <sequence> wasn't telling me anything except that it did exist. I couldn't find out what was using it in order to determine if it was safe to eliminate.
select oid from pg_class where relname='<sequence>'; # retrieves the internal ID in PostgreSQL
select refobjid from pg_depend where objid = <found_oid>; # retrieve depenencies for the sequence in question.
select relname from pg_class where oid in (<ref_oid1>, # ... if others); # get the names that are linking to it
\d <found_tables> for each item found above - see if there's any mention of the index blowing up.
OR, after figuring this out, I kept working. Here's one query to rule them all:
i
me
my
myself
we
our
ours
ourselves
you
your
"""
I've been thinking lately about how perfect Redis would be for storing a
simple social graph. I posited that it would be relatively few lines of code,
and that it'd be clean code too. So here it is: a basic social graph built on Redis.
"""
class FriendGraph(object):
def __init__(self, ring):
self.ring = ring
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
// call this when we're done.
var done = function(err, result) {
console.log(result);
};
var EXPENSIVE_OPERATION_ON = function(data, callback) {
callback(/*error, data, etc*/);
};