Skip to content

Instantly share code, notes, and snippets.

View chew-z's full-sized avatar

Robert J. chew-z

View GitHub Profile
@chew-z
chew-z / by_line.pl
Last active September 6, 2016 13:27
Prints lines form mutt colorfile in designated colors. Usefull when tuning colors for mutt
#!/usr/bin/perl
# This simple perl scripts prints lines from mutt colorfile
# in actual designated colors.
# I have created that script for finetuning my mutt with
# iTerm color themes.
# I am using here mix of little known library Term::ExtendedColors
# for extended colors and escape codes for base16 colors.
# Term::ExtendedColors is weird with base16
# It looks fuzzy but works!
# Actual colors depend on definitions in terminal color palette first of all
@chew-z
chew-z / 256.pl
Created September 6, 2016 13:38
Prints Lorem ipsum with fore- and background colors
#!/usr/bin/perl
use Term::ExtendedColor qw(:all);
use strict;
use warnings;
use feature qw(say);
say "Throw me two numbers or two color names separated by space(s)";
while (<>) {
# print $_;
@chew-z
chew-z / mail.vim
Created October 17, 2016 14:14
My mail.vim for using mutt with vim. Handles linebreaks, included email etc
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
" safe and simple
setlocal nobackup
setlocal noswapfile
setlocal nowritebackup
@chew-z
chew-z / captive.sh
Last active November 21, 2016 15:11
Login into captive portal
#!/usr/bin/env zsh
if check-hijacking; then
echo "The router doesn't hijack HTTP queries"
else
echo "The router hijacks HTTP queries - DNSCrypt is likely to be blocked"
# kill/stop DNSCrypt
networksetup -getcurrentlocation
networksetup -switchtolocation 'Captive portal'
@chew-z
chew-z / check-hijacking.sh
Created November 21, 2016 15:05
Check router connection hijacking (captive portal)
#!/usr/bin/env zsh
# adapted from Alterstep dnscrypt-proxy OSX client
try_resolution() {
exec alarmer 5 dig +tries=2 +time=3 +short github.com | egrep '^192[.]30[.]' > /dev/null 2>&1
}
try_http_query() {
exec alarmer 5 curl -L --max-redirs 5 -4 -m 5 --connect-timeout 5 -s \
http://icanhazip.com/ 2>/dev/null | \
@chew-z
chew-z / trim_zsh_history.conf
Created February 14, 2017 09:52
Removes silt from .zsh_history file
#
brew\sinstall.*
brew\sinfo.*
brew\sprune.*
brew\sdoctor.*
brew\slink.*
brew\sunlink.*
brew\suntap\s
.*/Dropbox.*
which.*
@chew-z
chew-z / fzf_MacVim.sh
Created February 19, 2017 16:12
Glue between MacVim - fzf - iTerm
#!/usr/bin/env zsh
# https://github.com/junegunn/fzf/wiki/On-MacVim-with-iTerm2
# used for MacVim fzf
# update for iterm2 3.0+
osascript -e \
'on run argv
tell application "System Events"
set old_frontmost to item 1 of (get name of processes whose frontmost is true)
@chew-z
chew-z / .vimrc
Created February 19, 2017 16:15
My precious .vimrc
" :set spelllang=pl,en
" :set spell
" ---- Color scheme ----
" in .gvimrc for MacVim
let g:seoul256_background = 235
colo seoul256
" Make Vim more useful
" Enable syntax highlighting
" syntax on will overrule commands like :highlight
" but syntax enable not - see docs
@chew-z
chew-z / .gvimrc
Created February 19, 2017 16:17
My .gvimrc
" Only MacVim-related options here
"
:cd ~/Documents
"
" start in fullscreen mode
" set fu
set columns=80
set lines=42
set guifont=Hack:h14
" set guifont=Space\ Mono:h14
@chew-z
chew-z / .zshenv
Created February 19, 2017 16:18
My .zshenv
# LOCALE SETTINGS
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
# LC_ALL overwrites all other variables
export LC_ALL=en_US.UTF-8
# PATH
# http://stackoverflow.com/questions/6555751/
# system-wide environment settings for zsh(1)
# if [ -x /usr/libexec/path_helper ]; then
# eval `/usr/libexec/path_helper -s`