Skip to content

Instantly share code, notes, and snippets.

View apetresc's full-sized avatar

Adrian Petrescu apetresc

View GitHub Profile
@suewonjp
suewonjp / .tmux.conf
Last active December 17, 2022 19:35
My .tmux.conf ( usable across multi-platforms including OS X | Linux | Cygwin )
set-option -g default-terminal "xterm-256color"
set-window-option -g xterm-keys on
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6-)"
setw -g mode-keys vi
unbind C-b
# remap prefix to Control + Space
@ornicar
ornicar / gameknot.com.js
Last active August 29, 2015 14:10
lol found in gameknot.js homepage: fake changing number of players
var total_players_online = 1903;
var current_players_online;
function update_players_online()
{
if (!current_players_online) current_players_online = total_players_online;
var th = 0.4 + ( current_players_online - total_players_online ) / 200;
if (th<0) th=0;
if (th>1) th=1;
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@pascalpoitras
pascalpoitras / config.md
Last active April 28, 2024 23:12
My WeeChat configuration

WeeChat Screenshot

Mouse


enable


@apetresc
apetresc / IteratorIterator.java
Last active December 26, 2015 08:29
Just your typical interview problem template :)
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* An iterator that flattens an iterator of iterators.
*
* Iterator SQUARED!
*/
public class IteratorIterator<T> implements Iterator<T> {
@matburt
matburt / stream_twitch.sh
Last active December 24, 2015 18:29
Stream to twitch from Linux
#!/bin/bash
API_KEY="<twitch api key>"
FPS="15"
INRES="1920x1080"
OUTRES="1920x1080"
OFFSET="2560,0"
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0+$OFFSET \
-f alsa -ac 2 -i default -vcodec libx264 -s "$OUTRES" \
@planbnet
planbnet / gnome-terminal-zenburn.sh
Created December 2, 2011 09:12
Zenburn color scheme for gnome-terminal
#!/usr/bin/env bash
dir=$(dirname $0)
gconfdir=/apps/gnome-terminal/profiles
echo # This makes the prompts easier to follow (as do other random echos below)
########################
### Select a profile ###
########################
@founddrama
founddrama / gist:1013614
Created June 8, 2011 01:42
a jshint pre-commit hook for git
#!/bin/sh
# A pre-commit hook for git to lint JavaScript files with jshint
# @see https://github.com/jshint/jshint/
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
@jessor
jessor / linux live screencasting with justin.tv
Created March 5, 2011 04:21
linux live screencasting to justin.tv
# 1. Get an account on http://www.justin.tv/
# 2. Copy streaming key from: http://www.justin.tv/broadcast/adv_other
# 2. Install VLC: http://www.videolan.org/vlc/
# 3. Get Win/Mac/Lin Stream Client: \
# http://apiwiki.justin.tv/mediawiki/index.php/Linux_Broadcasting_API
# 4. Adjust the vlc parameters to your liking and run VLC like this
#!/bin/bash
cvlc screen:// \
--screen-width 1576 \
anonymous
anonymous / dropme
Created November 2, 2010 19:41
quick drag and drop hack
#!/usr/bin/python
import gtk
import os
import sys
if len(sys.argv) < 2:
print 'usage: dropme <path>'
sys.exit(1)
path = os.path.abspath(sys.argv[1])