Skip to content

Instantly share code, notes, and snippets.

View rumkin's full-sized avatar
🧠
Getting deeper

Paul Rumkin rumkin

🧠
Getting deeper
View GitHub Profile
@rumkin
rumkin / crun.sh
Created July 30, 2011 15:07
G++ compiling
#!/bin/bash
# Exception :)
function error {
echo "Error: "$1
exit
}
#read param
fname=$1;
@rumkin
rumkin / spawn.sh
Created August 13, 2011 18:01
Respawn node application on error. Using for test perpouses
# Default respawn delay value
delay=5
# Default environment value
env="development"
#Show help
if [[ "$@" = "--help" || "$@" = "-h" ]]; then
cat <<EOF
Usage: bash spawn.sh [FILE...] [OPTIONS...]
@rumkin
rumkin / .htaccess
Created August 16, 2012 09:49
Apache general redirects
# Redirect from index
RewriteCond %{QUERY_STRING} ^$ [OR]
RewriteCond %{REQUEST_FILENAME} ^\/index$
RewriteRule ^index$ http://host.tld/ [NC,R=301,L]
# Redirect everythink to php
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z_][a-zA-Z0-9_\-\[\]\/\.]+)$ /?%1&path=$1 [NC,L]
@rumkin
rumkin / social-count.js
Last active October 12, 2015 02:18
Count facebook likes
function fbQuery(url)
{
var fql = 'SELECT share_count FROM link_stat WHERE url="' + url + '"'
, fbUrl = 'https://api.facebook.com/method/fql.query?format=json&query=';
return fbUrl + encodeURIComponent(fql)
}
function vkQuery(url)
{
@rumkin
rumkin / screencast.sh
Created November 16, 2012 00:46
Shell record video with ffmpeg
#!/bin/bash
# Yep, so simple =)
ffmpeg -f x11grab -r 25 -s 1280x1024 -i :0.0 -sameq screencast.mpeg
@rumkin
rumkin / mount.sh
Created November 29, 2012 01:12
Mount fs with special permissions
sudo mount -t ext4 -o umask=0755,gid=XXX,uid=XXX /dev/sdaX /media/laserslut
@rumkin
rumkin / audio.sh
Created January 2, 2013 13:48
Convert audio with ffmpeg
# mp3 to ogg
ffmpeg -i audio.mp3 -acodec libvorbis audio.ogg
# mp3 to aac
ffmpeg -i audio.mp3 -acodec libfaac audio.aac
# ogg to mp3
ffmpeg -i audio.ogg -acodec libmp3lame audio.mp3
@rumkin
rumkin / phpsyntax
Last active December 14, 2015 21:18
PHP syntax check on commit
#!/bin/bash
if [ ! -z $(tput colors) ]; then
bold=`tput bold`
normal=`tput sgr0`
fi
# Git info
commit=$(git log --max-count=1| head -n 1|cut -f 2 -d ' ');
@rumkin
rumkin / Vagrantfile
Last active January 3, 2016 21:19
Default precise32 based vagrant box configuration
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Machine name
config.vm.define "boxname"
# Vagrant box
@rumkin
rumkin / cert.sh
Created February 15, 2014 13:20
Generate open ssl certificate
openssl genrsa -out privatekey.pem 1024
openssl req -new -key privatekey.pem -out certrequest.csr
openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem