Skip to content

Instantly share code, notes, and snippets.

View hlissner's full-sized avatar
🛠️
Chipping away at Doom v3.0

Henrik Lissner hlissner

🛠️
Chipping away at Doom v3.0
View GitHub Profile
@hlissner
hlissner / install-yay.sh
Created April 3, 2019 05:46
Install yay on Arch Linux
if ! command -v yay >/dev/null; then
tmp=$(mktemp -d)
function finish { rm -rf "$tmp"; } # clean up after yourself...
trap finish EXIT # ...no matter how you exist
git clone https://aur.archlinux.org/yay.git "$tmp"
pushd "$tmp"
makepkg -sri --noconfirm --needed
popd
@hlissner
hlissner / install-pacaur.sh
Last active May 16, 2019 02:57
Install pacaur on Arch Linux
if ! command -v pacaur >/dev/null; then
tmp=$(mktemp -d)
function finish {
rm -rf "$tmp"
}
trap finish EXIT
pushd $tmp
for pkg in cower pacaur; do
curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$pkg && \
@hlissner
hlissner / iptables.sh
Last active April 18, 2019 07:16
Iptables default rules
#!/bin/bash
IPT="/sbin/iptables"
#### IPS ######
# Get server public ip
SERVER_IP=$(ifconfig eth0 | grep 'inet addr:' | awk -F'inet addr:' '{ print $2}' | awk '{ print $1}')
#### FILES #####
BLOCKED_IP_TDB=/root/.fw/blocked.ip.txt
SPOOFIP="127.0.0.0/8 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8 169.254.0.0/16 0.0.0.0/8 240.0.0.0/4 255.255.255.255/32 168.254.0.0/16 224.0.0.0/4 240.0.0.0/5 248.0.0.0/5 192.0.2.0/24"
@hlissner
hlissner / touch-bending.md
Created April 4, 2019 17:56
Some literature on touch-bending in Unity or HLSL
@hlissner
hlissner / ace-jump-two-char.el
Last active September 20, 2018 07:30
Make ace-jump do a two-char search (like vim-sneak)
;; Thanks to: https://github.com/winterTTr/ace-jump-mode/issues/23
(defun ace-jump-two-chars-mode (&optional query-char query-char-2)
"AceJump two chars mode"
(interactive)
(evil-half-cursor)
(setq query-char (or query-char (read-char ">")))
(setq query-char-2 (or query-char-2 (read-char (concat ">" (string query-char)))))
(if (eq (ace-jump-char-category query-char) 'other)
@hlissner
hlissner / hs-special-modes-alist.el
Created June 21, 2018 23:12
Adds hideshow folding rules for yaml-mode and ruby-mode
(defun +data-hideshow-forward-sexp (arg)
(let ((start (current-indentation)))
(forward-line)
(unless (= start (current-indentation))
(require 'evil-indent-plus)
(let ((range (evil-indent-plus--same-indent-range)))
(goto-char (cadr range))
(end-of-line)))))
(map-put hs-special-modes-alist
'yaml-mode
@hlissner
hlissner / evil-ex-replace-special-filenames.el
Last active May 8, 2017 14:49
A simple hack to add several substitutions to evil-mode's :ex mode, other than % and #...
;; A hack to add vim file modifiers to evil-mode's ex commandline:
;;
;; Requires projectile (https://github.com/bbatsov/projectile) for
;; project-awareness, and f.el (https://github.com/rejeep/f.el) for file
;; functions.
(defun +evil*ex-replace-special-filenames (file-name)
"Replace special symbols in FILE-NAME. Modified to include other substitution
flags. See http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers."
(let* (case-fold-search
(regexp (concat "\\(?:^\\|[^\\\\]\\)"
@hlissner
hlissner / dyndns-linode.sh
Created December 23, 2015 10:34
Steps to set up a linode-based dyndns
# This is not a script! These are notes!
KEY=
DOMAINID=
RESOURCE_ID=
# Getting the domain ID
https://api.linode.com/?api_key=$KEY&api_action=domain.list
# Getting the resource ID
@hlissner
hlissner / repeat-match.vim
Created September 6, 2014 17:50
Using . to repeat last f/F/t/T match in vim
" I remap the leader/localleader, and ; to alias :, but what if I like , and ;?
let mapleader = ','
noremap ; :
" Makes f, F, t and T repeat the search. Support repeating with .
nnoremap <Plug>NextMatch ;
nnoremap <silent> f :<C-u>call repeat#set("\<lt>Plug>NextMatch")<CR>f
nnoremap <silent> F :<C-u>call repeat#set("\<lt>Plug>NextMatch")<CR>F
nnoremap <silent> t :<C-u>call repeat#set("\<lt>Plug>NextMatch")<CR>t
nnoremap <silent> T :<C-u>call repeat#set("\<lt>Plug>NextMatch")<CR>T