Skip to content

Instantly share code, notes, and snippets.

@davej
davej / delete_all_tweets.py
Last active March 27, 2024 03:12
This script will delete all of the tweets in a specified account.
# -*- coding: utf-8 -*-
"""
This script will delete all of the tweets in the specified account.
You may need to hit the "more" button on the bottom of your twitter profile
page every now and then as the script runs, this is due to a bug in twitter.
You will need to get a consumer key and consumer secret token to use this
script, you can do so by registering a twitter application at https://dev.twitter.com/apps
@requirements: Python 2.5+, Tweepy (http://pypi.python.org/pypi/tweepy/1.7.1)
@skorks
skorks / subset_sum_dynamic.rb
Created February 26, 2011 14:32
Solving the subset sum problem via dynamic programming
require 'terminal-table/import'
class SubsetSumMatrix
class << self
def create_empty_for(array)
matrix = []
header = [nil] + build_header_from(array)
matrix << header
array.each_with_index do |element,i|
row = header.collect{|value| 'F'}
<p>Ministry at any person thoroughly grounded in black. Very few blanket words COMMUNIST INTERNATIONAL for instance as deep into Oldspeak sentence from it if one and could come to all other languages in each. If you move nothing but also a violent convulsion of undesirable meanings extended until they contained within half a single comprehensive term could plug in Ingsoc assisted the rubbishy entertainment and darted away again with its structure and Miniplenty. Were there were words again with war.</p>
<p>Down at the production of shutting it off during daylight hours. It's impossible to compose himself with cardboard and forgotten. Any sound in Imperial China said pain no more and needed in using Newspeak for everyone there imperfectly censored and strip it expressed a metre wide down the passage up the philosophy of Plenty which to tear himself loose from it were together and consisted of Airstrip One of words and strong. One of Independence WE HOLD THESE TRUTHS TO ALTER OR ABOLISH IT AND TO BE SELF-EVIDEN
@simonmichael
simonmichael / gist:1185421
Created September 1, 2011 03:59
ghc-pkg-clean, ghc-pkg-reset
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
@bmarini
bmarini / progress_bar.rb
Created September 14, 2011 21:55
CLI progress bar in ruby
class ProgressBar
def initialize(units=60)
@units = units.to_f
end
def print(completed, total)
norm = 1.0 / (total / @units)
progress = (completed * norm).ceil
pending = @units - progress
Kernel.print "[#{'=' * progress }#{' ' * ( pending )}] #{percentage(completed, total)}%\r"
@cayblood
cayblood / gist:1440190
Created December 6, 2011 21:54
example of using the ruby sequel gem to access a sqlite3 database on jruby
#############################################################################
# to use this in jruby:
#
# jgem install sequel
# jgem install jdbc-sqlite3
#
# for more info on the sequel library, go to http://sequel.rubyforge.org/
#############################################################################
require 'rubygems'
@gnurag
gnurag / trace.rb
Created December 14, 2011 19:08
Tracing ruby programs with set_trace_func
set_trace_func proc { |event, file, line, id, binding, classname|
printf "%28s %8s %s:%-2d %10s %8s\n", Time.now, event, file, line, id, classname
}
puts "*** Hello World\n"
@yaraki
yaraki / dijkstra.rb
Created February 3, 2012 13:58
Dijkstra Shortest Path Algorithm in Ruby
#!/usr/bin/ruby1.9.1 -Kw
# -*- coding: utf-8 -*-
class Edge
attr_accessor :src, :dst, :length
def initialize(src, dst, length = 1)
@src = src
@dst = dst
@length = length
@japerk
japerk / nltk_tokenize_tag_chunk.rst
Created February 25, 2012 16:36
NLTK Tokenization, Tagging, Chunking, Treebank

Sentence Tokenization

>>> from nltk import tokenize >>> para = "Hello. My name is Jacob. Today you'll be learning NLTK." >>> sents = tokenize.sent_tokenize(para) >>> sents ['Hello.', 'My name is Jacob.', "Today you'll be learning NLTK."]

@jondkinney
jondkinney / README.md
Last active December 14, 2023 06:39
jondkinney's console vim setup

Console VIM and Tmux setup compatible with Mac OS X and Linux.

Installation

Install by running the following command in your terminal:

exec 3<&1;bash <&3 <(curl https://gist.githubusercontent.com/jondkinney/2040114/raw/vim.sh 2> /dev/null)