Skip to content

Instantly share code, notes, and snippets.

View nviennot's full-sized avatar

Nicolas Viennot nviennot

View GitHub Profile
#!/bin/sh
if [[ $TMUX != "" && `/usr/bin/tmux show-options 2> /dev/null | grep "^status off$"` ]]; then
/usr/bin/tmux set status on \; $@ &> /dev/null
else
if [[ $1 == "--nostatus" ]]; then
/usr/bin/tmux -2 new-session \; set status off
else
/usr/bin/tmux -2 $@
fi
fi
@nviennot
nviennot / tmux-login
Created May 31, 2012 10:24
tmux login script to always have tmux loaded
#!/bin/bash
if [[ -t 0 && -t 1 && -t 2 && $# == 0 ]]; then
exec tmux -q -2 set -g default-shell /bin/zsh \; new-session
else
exec /bin/bash "$@"
fi
import os
import tempfile
import subprocess
import errno
def _popen(cmd, stdin=None, stdout=None, stderr=None, notty=False):
if notty:
try:
p1 = subprocess.Popen(cmd, stdin=stdin,
stdout=subprocess.PIPE,
#!/usr/bin/env ruby
def to_human(t)
ms = ((t-t.floor)*10).floor
sec = t.floor
hour = (sec/3600).floor
sec -= hour * 3600
min = (sec/60).floor
sec -= min * 60
sprintf "%02d:%02d:%02d.%01d", hour, min, sec, ms
#!/usr/bin/env ruby
def to_human(t)
ms = ((t-t.floor)*10).floor
sec = t.floor
hour = (sec/3600).floor
sec -= hour * 3600
min = (sec/60).floor
sec -= min * 60
sprintf "%02d:%02d:%02d.%01d", hour, min, sec, ms
#!/usr/bin/env ruby
pid = fork do
Process.setsid # get immune to our parent's TTY signals
Signal.trap("CLD") { exit } # mplayer died
IO.popen(['mplayer', *ARGV], :err => [:child, :out]) do |io|
begin
loop do
begin
IO.copy_stream(io, STDOUT)
#!/bin/bash
CMD="qemu"
INPUT=""
while (($#)); do
case $1 in
--input|-i) INPUT=$2; shift;;
*) echo "Halp";;
esac
#!/usr/bin/env ruby
# Gemfile
# source 'https://rubygems.org/'
# gem 'stretcher', git: 'git://github.com/PoseBiz/stretcher.git'
# gem "ruby-progressbar", :require => false
# gem 'multi_json'
# gem 'oj'
#!/usr/bin/env ruby
require 'openssl'
require 'tempfile'
# How to use:
# cd assets/data
# find . -type f -print0 | xargs -L1 -0 ./decrypt.rb
input_path = ARGV[0]
user nginx nginx;
worker_processes 1;
error_log /var/log/nginx/error_log info;
events {
worker_connections 1024;
use epoll;
}