Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Sep 27, 2017
1 parent 570fa2c commit 1b729c9
Show file tree
Hide file tree
Showing 29 changed files with 506 additions and 105 deletions.
1 change: 1 addition & 0 deletions doas/doas.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
permit martin
5 changes: 5 additions & 0 deletions doas/module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
requires_root = True

files = {
'/etc/doas.conf': 'doas.conf',
}
24 changes: 24 additions & 0 deletions local-bin/local/bin/git-pr
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

set -euC

n=$1

git fetch origin pull/$n/head:pr_$n
git checkout pr_$n


exit 0

#git fetch origin pull/$n/head:pr_$n
# From github.com:fatih/vim-go
# * [new ref] refs/pull/1426/head -> pr_1426

#git checkout pr_$n
#git push git@github.com:user/repo local_branch_name:remote_branch_name

# --
#
# git remote add otheruser https://github.com/otheruser/yourrepo.git
# git checkout -b otheruser-master otheruser/master
# git push otheruser HEAD:master
4 changes: 4 additions & 0 deletions local-bin/local/bin/git-prunebranches
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

git fetch origin --prune
git branch --merged master | grep -v 'master$' | xargs git branch -d
3 changes: 3 additions & 0 deletions local-bin/local/bin/git-undolast
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

git reset HEAD~
15 changes: 15 additions & 0 deletions manage-dotfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ def manage_files(files):
print("Skipping merge of `{}' because it is larger than 1MiB".format(src))
continue

# TODO: temporarily until I implement font-scale
# Check again if the files differ, but this time ignoring lines with
# $dotignore$; this test is comparatively slow, which is why we do it
# here
#dest_data = [ l for l in open(dest, 'r').readlines() if not 'dot-ignore' in l]
#src_data = [ l for l in open(src, 'r').readlines() if not 'dot-ignore' in l ]
#if src_data == dest_data:
# continue
# End temp code

h1 = hashlib.sha256(open(src, 'rb').read()).hexdigest()
h2 = hashlib.sha256(open(dest, 'rb').read()).hexdigest()

Expand Down Expand Up @@ -201,6 +211,11 @@ def proc_module(module, code):
assigns = {}
exec(code, assigns)

if assigns.get('requires_root', False):
# TODO
print('{} requires root -> skiping'.format(module))
return

os.chdir(os.path.dirname(module))
if assigns.get('files'):
manage_files(expand_dict(assigns['files']))
Expand Down
2 changes: 2 additions & 0 deletions mdl/mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
style "/home/martin/.mdlstyle"
ignore_front_matter true
10 changes: 10 additions & 0 deletions mdl/mdlstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
all
exclude_rule 'MD002' # First header should be a top level header
exclude_rule 'MD003' # Header style
exclude_rule 'MD013' # Line length
exclude_rule 'MD014' # Dollar signs used before commands without showing output
exclude_rule 'MD033' # Inline HTML
exclude_rule 'MD041' # First line should be top-lvl header
exclude_rule 'MD010' # Hard tabs
exclude_rule 'MD039' # Spaces inside link text
exclude_rule 'MD040' # "Fenced code blocks should have a language specified" triggers when indent block is used too?!
4 changes: 4 additions & 0 deletions mdl/module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
files = {
'~/.mdlrc': 'mdlrc',
'~/.mdlstyle': 'mdlstyle'
}
3 changes: 3 additions & 0 deletions proselint/module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
files = {
'~/.proselintrc': 'proselintrc'
}
5 changes: 5 additions & 0 deletions proselint/proselintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"checks": {
"typography.symbols": false
}
}
212 changes: 212 additions & 0 deletions trackwall/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# Comments start with #.
#
# All options are in the form of "key value1 [value2 ...]"
#
# All options can be split over multiple lines by indenting the next lines with
# one or more spaces or tabs (the amount don't matter). So this:
#
# user
# _trackwall
#
# is the same as:
#
# user _trackwall
#
# Note that option keys *must not* have leading whitespace, this:
#
# user _trackwall
# chroot /var/trackwall
#
# is seen as:
#
# user _trackwall chroot /var/trackwall
#
# Which is an error, since the user option takes only one argument.
#

#####################
### Basic options ###
#####################

# Used for controlling the server
control-listen 127.0.0.53:4242

# Listens on TCP and UDP
dns-listen 127.0.0.53:53

# Forward allowed requests to this nameserver.
#dns-forward 127.0.1.1:53
# Get first nameserver value from /etc/resolv.conf that is not dns-listen
# NOTE: you don't want to do this if you're using musl libc, since that sends a
# query to *all* nameservers and uses whichever one responds fastest.
#dns-forward auto
dns-forward 127.0.0.1

# We serve no-op or "surrogate" scripts from a HTTP server
http-listen 127.0.0.53:80
https-listen 127.0.0.53:443

# Root cert; relative to chroot()
# Keep these private!
root-cert /rootCA.pem
root-key /rootCA.key

# Run as this user
user _trackwall

# Chroot directory
chroot /var/trackwall

# Cache DNS responses. Note that trackwall does *not* cache the actual DNS
# responses (that's the resolver's job), it merly caches whatever action is
# taken (forward or spoof).
cache-dns 1h

# Show some colours in the output; to guarantee readability text is never
# coloured, only some whitespace is shown with a different background colour.
color yes

####################
### Adding hosts ###
####################

# Cache remote hosts files for a week, this is especially useful for desktops
# and such which may be turned on and off several times a day.
cache-hosts 1w

# The format is:
# hostlist format url
#
# Where format is any of:
# plain − One host per line. No comments
# hosts − /etc/hosts, comments and the destination address are ignored.
#
# All subdomains are also blocked, so an entry like:
# example.net
# would block:
# example.net
# track.doubleclick.net
# really.track.doubleclick.net
# ...etc...
#
# Don't worry about redundant or duplicate entries from different lists. Those
# are automatically removed.

# These domains are used for serving malware, phising, and other outright crap.
# You probably want to keep them. Many browsers already have some built-in
# protection for this these days, but some extra protection can't hurt.
hostlist plain http://malwaredomains.lehigh.edu/files/justdomains
hostlist hosts http://www.malwaredomainlist.com/hostslist/hosts.txt

# These are a mix of ad domains, malware domains, "shock sites", and other stuff
# that most people don't want to need to visit.
hostlist plain http://pgl.yoyo.org/adservers/serverlist.php?hostformat=plain&showintro=0&mimetype=plaintext
hostlist hosts http://winhelp2002.mvps.org/hosts.txt
hostlist hosts http://someonewhocares.org/hosts/hosts

# You can also use a local file; remember that trackwall uses chroot()!
#hostlist hosts file:///hosts

# If you just want to block a few hosts, you can add rules here as well
#host conservapedia.com

# Or multiple work as well
#host facebook.com twitter.com

###############################################
### Blocking hosts from regular expressions ###
###############################################

# You can also block hosts with regular expressions.
#
# Note that this is a lot slower than using a static hosts file (which is a
# constant-time map lookup), since we need to iterate over the entire array and
# see if an expression matches on every DNS lookup (we do some caching to speed
# up subsequent lookups though).
#

# Regexps
# Only plain is supported
#regexplist plain file:///home/martin/regexps

# Or just here; multiple regexps can be separated by whitespace.
regexp
^count(er)?[0-9]+?\.
^banners?[0-9]+?\.
^ad(s|srv|serv|serve|server|v|vert)?[0-9]+?\.

#########################
### Customizing hosts ###
#########################

# Does a hostlist have hosts you would like to keep? Remove them! unhost takes a
# regexp and removes all hosts that match it. It's always executed *after*
# loading all the hostsfile (so putting this at the top of this file would work
# just as well).

# Listed in someonewhocares, but seems okay?
unhost grokbase.com

# You can also load it from a file (which can be remote).
#unhostlist plain file:///myunhosts

# The same can be done for regexps. Note that this is *not* a regexp (matching
# regexps with a regexp is a bit of a mindfuck).
#unregexp ^count(er)?[0-9]+?\.

# And again, from a file
#unregexplist file:///unregexps


#########################
### Surrogate scripts ###
#########################

# Some sites will break when they can't load some JavaScript. It'll error out
# and none of the JavaScript works (which in some cases means the entire site
# stops working).
# To fix this, trackwall can serve surrogate scripts, the format is simple:
#
# surrogate domain_regex JavaScript to serve
#
# @@ will be replaced by function(){}

# AddThis
surrogate ^s\d+\.addthis\.com$
addthis={init:@@,layers:@@,toolbox:@@,button:@@,counter:@@}

# Google tag manager
surrogate .*googletag(manager|services)\.com$
var googletag;
googletag={
enableServices:@@, refresh:@@, defineOutOfPageSlot:@@, setTargeting:@@,
display:@@, setRefreshUnfilledSlots:@@, enableAsyncRendering:@@,
enableSyncRendering:@@, enableSingleRequest:@@, collapseEmptyDivs:@@,
cmd:{push:@@},
defineSlot:function(){return googletag},
addService:function(){return googletag},
companionAds:function(){return googletag},
pubads:function(){return googletag},
publish:function(){return googletag}
}

# http://ak.sail-horizon.com/horizon/v1.js
surrogate ak\.sail-horizon\.com$
window.Sailthru={setup:@@}

#???
# http://tags.bkrtx.com/js/bk-coretag.js
# http://regdev.idge.int/api/"
# "http://reg.idgenterprise.com/api/";
surrogate .*bkrtx\.com$
window.bk_addPageCtx=@@;
window.bk_doJSTag=@@

###########################
### Add your own config ###
###########################

source /etc/trackwall/config.added
#source /etc/trackwall/config.local

# vim:ft=config
28 changes: 28 additions & 0 deletions trackwall/config.added
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# vim:ft=config
# This is a list of hosts I found which are *not* in the other hostlists.

host
api.parsely.com # arstechnica.co.uk
symcb.com
symcd.com
marketo.com # what.cd
adhese.com # nrc.nl
shoppingminds.com # vk.nl
worldgravity.com
gravityrd-services.com
adnxs.com
connect.facebook.net # Facebook tracker
ic-live.com # Some markething crap; https://cookiepedia.co.uk/host/ic-live.com
cdn.segment.com # Some analytics crap

host
accounts.google.com # Don't need google
clients1.google.com
googleapis.com
getdrip.com # Marketing
providesupport.com # Annoying services I don't need
abtasty.com
intercom.io
intercomcdn.com
adobe.com # Hmm..
adobelogin.com
6 changes: 6 additions & 0 deletions trackwall/module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
requires_root = True

files = {
'/etc/trackwall/config': 'config',
'/etc/trackwall/config.added': 'config.added',
}
9 changes: 7 additions & 2 deletions vim/autocmd.vim
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ augroup my_filetypes
" Don't like the default one at all; it's far too opinionated on all sorts
" of stupid stuff.
autocmd FileType gitcommit
\ setlocal tw=80 filetype=mygitcommit
\| syn match gitcommitComment "^#.*"
\ setlocal ft=mygitcommit ts=8 tw=72
\| syn match gitcommitComment "^#.*"

" Reset some settings that these ftplugins or syntax files reset :-/
autocmd FileType python setlocal ts=4
Expand Down Expand Up @@ -111,3 +111,8 @@ augroup angering_zed_shaw
\ raw_input reduce reload unichr unicode
\ xrange apply buffer coerce intern
augroup end

augroup init_new_file
autocmd!
autocmd BufNewFile *.py exe "normal O#!/usr/bin/env python" | exe "normal j"
augroup end
5 changes: 3 additions & 2 deletions vim/keys.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ inoremap <F1> <C-o>:helpclose<CR>
nnoremap <F1> :buffers<CR>
nnoremap <F2> :registers<CR>
nnoremap <F3> :UndotreeToggle<CR>
nnoremap <F4> :SyntasticToggleMode<CR>
nnoremap <F5> :GitGutterToggle<CR>
"nnoremap <F4> :SyntasticToggleMode<CR>
nnoremap <F4> :ALEToggle<CR>
"nnoremap <F5> :GitGutterToggle<CR>
nnoremap <F6> :TricycleToggle<CR>
nnoremap <F9> :set shiftround!<CR>:set shiftround?<CR>
Expand Down
Loading

0 comments on commit 1b729c9

Please sign in to comment.