Skip to content

Instantly share code, notes, and snippets.

@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`
@joepie91
joepie91 / README.md
Last active Oct 28, 2015
Uploading to curl.io without a browser (but with a progress bar!)
View README.md

Simply save the script in your home directory (as set-alias.sh or whatever else you want), and add the following to your .bashrc:

source ~/set-alias.sh

Don't forget to use the right filename if you've changed it!

Now you can just use the curlio command:

@yoni
yoni / webm2mp3.sh
Created May 3, 2013
Extract MP3 audio from all WEBM videos.
View webm2mp3.sh
find . -name "*.webm" -exec ffmpeg -i {} -vn -ac 2 -ar 44100 -ab 320k -f mp3 {}.mp3 \;
View showPythonPackages.py
#!/usr/bin/python
from distutils.sysconfig import get_python_lib
print get_python_lib()
@ohhdemgirls
ohhdemgirls / vidble.sh
Created Jan 20, 2014
Simple Vidble.com Album Downloader
View vidble.sh
#!/bin/bash
id="$1"
host="http://vidble.com/album/"
mkdir "$id"
wget -nv -O - "$host$id" |grep -e "<img src='" |grep -Eo '/[^" ]+(jpg|jpeg|JPG|GIF|gif|PNG|png)' |sed -e 's/_med//' -e 's@^@http://vidble.com@' > $id/links.txt
sed -i '/logo/d' $id/links.txt
wget -i $id/links.txt -P $id
@ohhdemgirls
ohhdemgirls / rename.sh
Last active Jan 4, 2016
Rename html files based on title tag
View rename.sh
#!/bin/bash
# Rename the ouput html file from redditPostArchiver with the reddit thread title.
# https://github.com/sJohnsonStoever/redditPostArchiver
for f in *.html;
do
title=$( awk 'BEGIN{IGNORECASE=1;FS="<title>|</title>";RS=EOF} {print $2}' "$f" )
mv -i "$f" "${title//[^a-zA-Z0-9\._\- ]}_$f"
@xr09
xr09 / ubackup.sh
Last active Jan 4, 2016
Minimal rotating backup system
View ubackup.sh
#!/usr/bin/bash
backup_number=8
base_name="backup.gz"
backup_path="/opt/somebackup/"
cd $backup_path
# clean any old temp backup
View full-ffmpeg.sh
# Add multimedia source
echo "deb http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
echo "deb-src http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
apt-get update
apt-get install deb-multimedia-keyring # if this aborts, try again
apt-get update
# Go to local source directory
cd /usr/local/src
@alvinfrancis
alvinfrancis / tmux-newsbeuter-open.sh
Created Aug 1, 2013
newsbeuter open browser script in tmux
View tmux-newsbeuter-open.sh
#!/bin/sh
shellbrowser='elinks'
tmux_current_window=`tmux display-message -p "#W"`
tmux_current_pane=`tmux display-message -p "#P"`
# Check if in the right tmux window
if [ $tmux_current_window != 'news' ];then
elinks $1
exit 0
@drakeguan
drakeguan / bootstrap_for_encoding_server.sh
Last active Jan 12, 2017 — forked from xdamman/install_ffmpeg_ubuntu.sh
Bash script to install latest version of ffmpeg, x264 and libvpx on Ubuntu 14.04 server
View bootstrap_for_encoding_server.sh
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 14.04
# Copyright @ 2014 Shuen-Huei (Drake) Guan <drake.guan@gmail.com>
# References:
# * https://gist.github.com/xdamman/e4f713c8cd1a389a5917
# * https://blog.dlasley.net/2013/05/install-ffmpeg-from-source/
# * http://fermat-little-theorem-blog.logdown.com/posts/203069-solved-when-building-gpac-suffer-usr-local-lib-libswscalea-error-adding-symbols-bad-value