Skip to content

Instantly share code, notes, and snippets.

View nega0's full-sized avatar
🌴
I may be slow to respond.

nega nega0

🌴
I may be slow to respond.
View GitHub Profile
@nega0
nega0 / drac.md
Last active February 2, 2022 03:58
dracula example

emacs + dracula

included files:

  • init.el -- minimal ~/.emacs.d/init.el
  • nega_basic.terminal -- Terminal.app settings (i think it's the default "Basic" profile)
  • nega_tn_iterm2.json -- my iTerm2 profile

TERM is set via the terminal emulator settings (xterm-256color). i don't touch it my shell init files.

from back-to-front... chrome, Emacs 27.2, same in Terminal.app, same in iTerm2

@nega0
nega0 / dashes.py
Last active June 3, 2022 02:55
display the list of unicode dashes/hyphens
#!/usr/bin/env python3 # -*- coding: utf-8; -*-
# table sourced from http://jkorpela.fi/dashes.html
## - U+002D - hyphen-minus the Ascii hyphen, with multiple usage, or “ambiguous semantic value”; the width should be “average”
## ~ U+007E ~ tilde the Ascii tilde, with multiple usage; “swung dash”
## ­ U+00AD ­ soft hyphen “discretionary hyphen”
## ֊ U+058A ֊ armenian hyphen as soft hyphen, but different in shape
## ־ U+05BE ־ hebrew punctuation maqaf word hyphen in Hebrew
## ᐀ U+1400 ᐀ canadian syllabics hyphen used in Canadian Aboriginal Syllabics
## ᠆ U+1806 ᠆ mongolian todo soft hyphen as soft hyphen, but displayed at the beginning of the second line
@nega0
nega0 / opt.pl
Created July 24, 2019 14:22
create an optimized regular expression (regex/regexp) from list of strings
#!/usr/bin/perl -w
use feature qw(say);
use strict;
use Regexp::List;
my @s = <STDIN>;
my $l = Regexp::List->new;
say $l->list2re(@s);
@nega0
nega0 / wipe.bat
Created June 8, 2019 21:20
wipe partition table with debug.exe
debug <wipe.in
@nega0
nega0 / init.el
Created February 24, 2019 15:27
minimal init.el w/ package.el initialization and tramp
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)
;; Bootstrap 'use-package'
(eval-after-load 'gnutls
@nega0
nega0 / svnhacks.sh
Last active November 11, 2019 21:28 — forked from scrooloose/svnhacks.sh
This script hijacks calls to svn and adds color and pagination to some svn commands. Source it from your ~/.zshrc.
#Author: Martin Grenfell [http://github.com/scrooloose]
#License:
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#
#This script hijacks calls to svn and adds color and pagination to
@nega0
nega0 / iptables_color_with_grc.txt
Last active June 29, 2017 18:11
colorize `iptables` with grc
## based on https://gist.github.com/nega0/1d232622a1fa3dad176869bbfe747602
## conf file for https://github.com/garabik/grc
## put in ~/.grc/conf.iptables
# chain section headers
regexp=^Chain.*
colors=underline
=======
# column headers
regexp=^num.*
@nega0
nega0 / iptables_color.txt
Last active June 14, 2024 11:24
colorize your `iptables` output
## based on the blogpost here: http://blog.sjas.de/posts/colored-iptables-output.html
iptables --line-numbers -vnL |\
sed -E 's/^Chain.*$/\x1b[4m&\x1b[0m/' |\
sed -E 's/^num.*/\x1b[33m&\x1b[0m/' |\
sed -E '/([^y] )((REJECT|DROP))/s//\1\x1b[31m\3\x1b[0m/' |\
sed -E '/([^y] )(ACCEPT)/s//\1\x1b[32m\2\x1b[0m/' |\
sed -E '/([ds]pt[s]?:)([[:digit:]]+(:[[:digit:]]+)?)/s//\1\x1b[33;1m\2\x1b[0m/' |\
sed -E '/([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}(\/([[:digit:]]){1,3}){0,1}/s//\x1b[36;1m&\x1b[0m/g' |\
sed -E '/([^n] )(LOGDROP)/s//\1\x1b[33;1m\2\x1b[0m/'|\
## This macro takes 2 arguments. The first, _d, is an "integer date"
## in the format of "YYYYmmdd". The second, _m, is a message that will
## be passed to message(WARNING ...) or message(FATAL_ERROR ...). A
## one line message is recomended.
##
## It is recomended that you provide some explanitory warning prior to
## calling this macro.
## An example follows ...
@nega0
nega0 / snap.sh
Created March 24, 2016 21:06
bash script to "snap" the current terminal emulator to an aspect ratio
#!/bin/bash
## bash script to "snap" the current terminal emulator to an aspect
## ratio maintaining either the width or the height. note that your
## terminal will actually snap to the closest size that has no
## partial character cells
ar="16/10" ## set your aspect ratio here
ar=$(bc -l <<< "$ar")