Skip to content

Instantly share code, notes, and snippets.

View starkers's full-sized avatar

David Stark starkers

  • London, UK
  • 01:46 (UTC +01:00)
View GitHub Profile
@starkers
starkers / youtubehelper
Last active May 20, 2016 11:46
simple youtube downloader, crude cleanup and tagging
#!/usr/bin/env bash
##This is very crude.. but its enough for me [meh]
# contents of this text file is a youtube URL per line.. EG:
#--
#cat listofvideos.txt
#https://www.youtube.com/watch?v=RrLAaDCPc3I
#--
fileVideoList=listofvideos.txt
@starkers
starkers / iptables.generic
Last active May 25, 2016 16:09
Simple iptables
cat > /tmp/iptables.generic <<EOF
*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:LOGGING - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -d 127.0.0.0/8 ! -i lo -j REJECT --reject-with icmp-port-unreachable
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
@starkers
starkers / redis_purge.py
Created June 6, 2016 15:25
iterate over redis and delete keys
#!/usr/bin/env python
from optparse import OptionParser
import redis
def main():
parser = OptionParser()
parser.add_option("-d", "--database", default=0, help="target redis database, default is 0", dest="database")
parser.add_option("-a", "--address", default="127.0.0.1", help="target redis host, default is 127.0.0.1")
parser.add_option("-p", "--port", default=6379, help="target redis host, default is 127.0.0.1")
@starkers
starkers / v
Last active October 6, 2016 14:24
v for vagrant
#!/usr/bin/env bash
# v for vagrant david@starkers.org
#get a list of vagrant VMs..
#...I know its ugly
loremipsums="$(vagrant global-status | grep -A999 "^----" | grep -v "^----" | grep -B99 "The above shows information about all known Vagrant environments" | grep -v "^ $" | grep -v "The above shows information about all known Vagrant environments" | awk '{print $5,$4}')"
oldIFS=$IFS
@starkers
starkers / docker-enter.sh
Last active July 4, 2017 12:44
docker-enter gcp
#!/usr/bin/env bash
if [ -e $(dirname "$0")/nsenter ]; then
# with boot2docker, nsenter is not in the PATH but it is in the same folder
NSENTER=$(dirname "$0")/nsenter
else
NSENTER=nsenter
fi
" "========================================================================"
" "========== vim-plug for plugin management"
" "========================================================================"
call plug#begin('~/.local/share/nvim/plugged')
" "========================================================================"
" "========== completions and linting"
function! BuildYCM(info)
" function to automatically run install.py for you
# Normal shortcuts
<ctrl-/> comment/uncomment a line or visual block
<ctrl-f> open "files" in the same dir as current file
<ctrl-p> "CtrlP" file browser (fuzzy finding)
<ctrl-n> "new" buffer
<ctrl-o> "open" previous files from MRU (most recently used)
<leader>? view vim cheatsheet / "help"
<leader>e show/disable "expand tab" toggle
<leader>f toggle the "file browser" pane, ? for help or :help NERDtree
<leader>g toggle "git" hints
" "========================================================================"
" "========== vim-plug for plugin management"
" "========================================================================"
call plug#begin('~/.local/share/nvim/plugged')
" "========================================================================"
" "========== completions and linting"
function! BuildYCM(info)
" function to automatically run install.py for you
# i3 config
#AKA Super/Windows/Apple
set $mod Mod4
set $terminal terminator
#How to alise colors EG:
# set_from_resource $darkred color1 #000000
# set_from_resource $red color9 #000000
" "========================================================================"
" "========== vim-plug for plugin management"
" "========================================================================"
call plug#begin('~/.local/share/nvim/plugged')
" "========================================================================"
" "========== completions and linting"
function! BuildYCM(info)
" function to automatically run install.py for you