Skip to content

Instantly share code, notes, and snippets.

View jarfil's full-sized avatar

Jaroslaw Filiochowski jarfil

View GitHub Profile
@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 / 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() {
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 / 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
@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 / 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