Skip to content

Instantly share code, notes, and snippets.

View leonardehrenfried's full-sized avatar

Leonard Ehrenfried leonardehrenfried

View GitHub Profile
@leonardehrenfried
leonardehrenfried / amazon-mp3-cleaner.py
Created August 16, 2011 18:28
Cleaning the Amazon MP3 download folder
#!/usr/bin/env python3
import getpass,os,subprocess
def find_amazon_dir():
username = getpass.getuser()
possible_dirs=["/Users/%s/Music/Amazon MP3"%username,]
for dir in possible_dirs:
if os.path.exists(dir):
@leonardehrenfried
leonardehrenfried / build-macvim.sh
Last active April 24, 2020 18:06
Build macvim with python3 support
export CC=clang
make clean
./configure --with-features=huge --enable-rubyinterp --enable-pythoninterp --enable-perlinterp --enable-cscope --enable-python3interp
make
open src/MacVim/build/Release/
@leonardehrenfried
leonardehrenfried / index.html
Last active July 1, 2018 10:42
HTML5 template with CDN'd jQuery and Bootstrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>HTML5 & Bootstrap template</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
@leonardehrenfried
leonardehrenfried / Rakefile
Created October 30, 2011 17:54
SSH deployment Rakefile
BASENAME = File.basename(Dir.getwd)
USER = "lenni"
HOST = "lenni.info"
PATH = "www/clients/#{BASENAME}"
task :default => ["deploy"]
desc "Deploys the content of this folder minus the .git directory"
task :deploy do
@leonardehrenfried
leonardehrenfried / rename.sh
Created November 19, 2011 12:49
Rename file consecutively
cnt=1
for file in `ls *.jpg` ; do
mv ${file} ${cnt}.jpg
#echo ${file}
cnt=$(( cnt +1 ))
done
@leonardehrenfried
leonardehrenfried / gist:1477666
Created December 14, 2011 17:52
Find slow requests in apache log with grep
cat /var/log/apache2/access.log|ack " [1-9]\d*/\d*$"
@leonardehrenfried
leonardehrenfried / gist:1493284
Created December 18, 2011 12:44
Installing Ruby 1.9 on Ubuntu 11.10
sudo apt-get update
sudo apt-get install ruby1.9.1 ruby1.9.1-dev \
rubygems1.9.1 irb1.9.1 ri1.9.1 rdoc1.9.1 \
build-essential libopenssl-ruby1.9.1 libssl-dev zlib1g-dev
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \
--slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \
/usr/share/man/man1/ruby1.9.1.1.gz \
--slave /usr/bin/ri ri /usr/bin/ri1.9.1 \
@leonardehrenfried
leonardehrenfried / gist:1493385
Created December 18, 2011 13:13
Passenger configuration
LoadModule passenger_module /var/lib/gems/1.9.1/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.9.1/gems/passenger-3.0.11
PassengerRuby /usr/bin/ruby1.9.1
@leonardehrenfried
leonardehrenfried / gist:1599561
Last active September 29, 2015 12:17
Deleting old rows in SQLite
DELETE FROM eddcalc_query WHERE date < date('now','-60 days');
VACUUM;
@leonardehrenfried
leonardehrenfried / gist:1632046
Created January 18, 2012 08:51
Deleting files older than 6 months
find ./ -type f -mtime +180 -exec rm {} \;