Skip to content

Instantly share code, notes, and snippets.

View jarfil's full-sized avatar

Jaroslaw Filiochowski jarfil

View GitHub Profile
@jarfil
jarfil / GoiWinMove.ahk
Last active August 29, 2015 14:02
Guns of Icarus: Multi-monitor center window, Auto-fire with OSD
#SingleInstance force
;////////////
;// Hotkeys
^!F8::
WinGetActiveTitle, WActiveTitle
CenterWindow(WActiveTitle)
return
@jarfil
jarfil / .tmux.conf
Created June 17, 2014 18:18
tmux configuration: screen, vi, blue
set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
set-option -g status-style bg=blue
set-option -g mode-keys vi
bind R source-file ~/.tmux.conf
bind + command-prompt "join-pane -t '%%'"
@jarfil
jarfil / setaliases.sh
Last active August 28, 2021 08:59
Common personalized dircolors and aliases
# to be called from ~/.bashrc or similar
# don't apply changes if not logging in from given IP
### IP restriction
#if [ "${SSH_CLIENT//`dig +short fractal.jarfil.net`/}" != "$SSH_CLIENT" ] ; then
export PS1='[$(
if [ "a${USER:-${USERNAME:-$(whoami)}}" == aroot ] ; then
echo "\[\e[01;31m\]"
elif [[ "${GROUPS[@]}" =~ (^| )(114|544)( |$) ]] ; then
import socket
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
class MyHandler(SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/ip':
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
@jarfil
jarfil / frees.sh
Created July 24, 2014 20:56
Free space from all devices
#!/bin/bash
fecho() {
local c
c=`perl -e "print ' ' x(15-${#1}) ; print $1"`
c=`echo "$c" | sed "s/\([^.]\{3\}\)/\1./g;s/\.\$//"`
echo -n "${c// ./ }"
}
tprint() {
@jarfil
jarfil / netstatp.pl
Last active August 29, 2015 14:04
Netstat listening sockets by processess
#!/usr/bin/perl
# get data
@net = `netstat -naptu`;
@ps = `ps xa`;
sort @net;
sort @ps;
$pid_offset = index($net[1], 'PID/');
@jarfil
jarfil / grep-block.awk
Last active February 20, 2022 23:25
Find blocks of text, separated by newline, with occurring regexp
#!/usr/bin/awk -E
BEGIN {
if ( ARGV[1] == "" ) {
print "Usage: grep-block <regexp> [file1 file2 ...]"
exit
}
search = ARGV[1]
print "-" search "-"
ARGV[1]=""
@jarfil
jarfil / setaliases.sh
Created January 1, 2015 09:34
Cygwin aliases
### CYGWIN
# Sublime Text 3
# https://cygwin.com/cygwin-ug-net/using-effectively.html
# https://scotch.io/tutorials/open-sublime-text-from-the-command-line-using-subl-exe-windows
# https://stackoverflow.com/questions/7131670/make-bash-alias-that-takes-parameter
sublimetext() {
"C:/Program Files/Sublime Text 3/subl.exe" "$(cygpath -pw "$1")" $*
#!/bin/bash
# painting2sprites - A simple script to read an ORA, resize and trim output PNGs.
INPUT_FILE="$1"
OUTPUT_DIR="$2"
RESIZE_SCALE="25%"
if [ "$2" == "" ]; then
@jarfil
jarfil / apt-pkg-releases.sh
Created April 26, 2015 00:26
Check version of a package in available releases
#!/bin/bash
PKG="$1"
for f in stable testing unstable experimental ; do
echo -n "$f - "
apt-cache show $PKG/$f 2>/dev/null | grep "Version:" || echo
done