Skip to content

Instantly share code, notes, and snippets.

jadedgnome

Block or report user

Report or block jadedgnome

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View where-my-site-packages.py
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active Sep 20, 2019
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
View node-and-npm-in-30-seconds.sh
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@cdown
cdown / gist:1163649
Last active Sep 18, 2019
Bash urlencode and urldecode
View gist:1163649
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
@mopemope
mopemope / xvideos.py
Created Oct 4, 2011
xvideos downloader
View xvideos.py
import os
from os import path
from werkzeug import secure_filename
from tobikko.core import *
from tobikko.patch import *
patch_all()
import urllib2
from pyquery import PyQuery as pq
import urllib
from urlparse import urlparse
@aerickson
aerickson / rsync_with_progress.py
Created Oct 13, 2011
Get total rsync progress using Python
View rsync_with_progress.py
# from https://libbits.wordpress.com/2011/04/09/get-total-rsync-progress-using-python/
import subprocess
import re
import sys
print('Dry run:')
cmd = 'rsync -az --stats --dry-run ' + sys.argv[1] + ' ' + sys.argv[2]
proc = subprocess.Popen(cmd,
shell=True,
@mbbx6spp
mbbx6spp / README.md
Created Dec 4, 2011
Best UNIX shell-based tools I can't live without with example usages
View README.md

Best UNIX Shell tools

These are a list of usages of shell commands I can't live without on UNIX-based systems.

Install

Mac OS X

Using Homebrew (yes, I am opinionated) you can install the following tools with the following packages:

View gist:1552606
#! /bin/bash
#
# # keepalive #
#
# Keeps your processes running - handy quick-restart for services.
#
# USAGE:
#
# Run a server with:
#
@mkottman
mkottman / twoline_prompt.sh
Last active Aug 20, 2019
A two-line colored Bash prompt (PS1) with Git branch and a line decoration which adjusts automatically to the width of the terminal. Recognizes SVN, Git and Fossil version control systems and shows the current branch/revision.
View twoline_prompt.sh
# A two-line colored Bash prompt (PS1) with Git branch and a line decoration
# which adjusts automatically to the width of the terminal.
# Recognizes and shows Git, SVN and Fossil branch/revision.
# Screenshot: http://img194.imageshack.us/img194/2154/twolineprompt.png
# Michal Kottman, 2012
RESET="\[\033[0m\]"
RED="\[\033[0;31m\]"
GREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"
View thread_pool.rb
# Ruby Thread Pool
# ================
# A thread pool is useful when you wish to do some work in a thread, but do
# not know how much work you will be doing in advance. Spawning one thread
# for each task is potentially expensive, as threads are not free.
#
# In this case, it might be more beneficial to start a predefined set of
# threads and then hand off work to them as it becomes available. This is
# the pure essence of what a thread pool is: an array of threads, all just
# waiting to do some work for you!
@stefl
stefl / scrape_tweets.rb
Created Mar 25, 2012
Download all tweets from the twitter search API for a given search term (limited to their maximum of 1500)
View scrape_tweets.rb
#! /usr/bin/env ruby
require "fileutils"
search_term = ARGV[0]
if search_term
time = Time.now
directory_path = File.dirname(__FILE__) + "/tweets/" + search_term + "_" + time.to_i.to_s
FileUtils.mkdir_p(directory_path)
directory = Dir.new(directory_path)
(1..15).each do |i|
`curl "http://search.twitter.com/search.json?q=#{search_term}&rpp=100&page=#{i}&include_entities=true&result_type=mixed" > #{directory.path}/#{i}.json`
You can’t perform that action at this time.