Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Sugioarto nakal

View GitHub Profile
@nakal
nakal / todo-syn.vim
Created Jun 14, 2018
How to add custom syntax highlighting to C comments
View todo-syn.vim
syntax match CustomTodo '\(REMOVE\|FIX\|COMPLETE\|CHECK\)ME'
syntax cluster cCommentGroup add=CustomTodo
highlight CustomTodo ctermbg=yellow guibg=yellow
@nakal
nakal / messages
Created Dec 29, 2017
error 11 during initial "notmuch new" run
View messages
Dec 28 21:47:41 papika kernel: g_vfs_done():ada0s1h.eli[WRITE(offset=7546634240, length=65536)]error = 11
Dec 28 21:49:05 papika kernel: g_vfs_done():ada0s1h.eli[WRITE(offset=7546732544, length=65536)]error = 11
Dec 28 21:49:05 papika kernel: g_vfs_done():ada0s1h.eli[WRITE(offset=7546830848, length=65536)]error = 11
Dec 28 21:49:05 papika kernel: g_vfs_done():ada0s1h.eli[WRITE(offset=7546961920, length=65536)]error = 11
Dec 28 21:49:05 papika kernel: g_vfs_done():ada0s1h.eli[WRITE(offset=7547289600, length=65536)]error = 11
Dec 28 21:49:05 papika kernel: g_vfs_done():ada0s1h.eli[WRITE(offset=7547453440, length=32768)]error = 11
Dec 28 21:49:05 papika kernel: g_vfs_done():ada0s1h.eli[WRITE(offset=7547551744, length=32768)]error = 11
Dec 28 21:49:05 papika kernel: g_vfs_done():ada0s1h.eli[WRITE(offset=7547617280, length=32768)]error = 11
Dec 28 21:49:05 papika kernel: g_vfs_done():ada0s1h.eli[WRITE(offset=7547748352, length=32768)]error = 11
Dec 28 21:49:05 papika kernel: g_vfs_done():ada0s1h.eli[WRITE(offset=7
View SysInfoBar-Linux.txt
CPU Info: /proc/stat, line "cpu", first 4 columns
Net Info: /proc/net/netstat, IpExt lines, match "octets" column titles with values
Bat Info: /sys/bus/acpi/drivers/battery/PNP0C0A:00/power_supply/BAT0/capacity
Mem Info: /proc/meminfo
ToDo:
- split up SysInfoBar for each OS
View mbsyncrc
MaildirStore maildir
Path ~/.mail/
Inbox ~/.mail/INBOX
Flatten .
IMAPAccount imapaccount
Host HOSTNAME
User USER
Pass PASSWORD
SSLVersions TLSv1.2
@nakal
nakal / year_average.hs
Created Nov 3, 2016
Calculates a diagram of average usage per day from timestamp/value pairs
View year_average.hs
import qualified Data.ByteString.Char8 as C8
import Data.UnixTime
csvTableToTuple :: String -> (Int, Int)
csvTableToTuple line =
let date = takeWhile (/= ';') line
val = tail $ dropWhile (/= ';') line
in (fromEnum (utSeconds (parseUnixTime (C8.pack "%Y-%m-%d") (C8.pack date))), read val)
secondsInDay :: Int
@nakal
nakal / poudriere-cmd.sh
Created Oct 7, 2016
Command wrapper for poudriere
View poudriere-cmd.sh
#!/bin/sh
JAIL=11amd64
FUN="$1"
DEST="$2"
shift 2
PKG="$@"
OPT_EXT=""
View snap-man.pl
#!/usr/bin/env perl
use strict;
use warnings;
my $verbose = 0;
my ($senddiff) = @ARGV;
if (defined($senddiff)) {
$senddiff = 1;
View poudriere-cron.sh
#!/bin/sh
SCRIPTNAME=`basename "$0"`
PORTSTREE="local"
POUDRIERE="/usr/local/bin/poudriere"
URL="https://host.example.org/poudriere/"
poudriere_build() {
for REPO in $REPOS; do
echo "Started $REPO ("`/bin/date | /usr/bin/tr -d '\n'`")"
@nakal
nakal / ssl-ca-check.c
Last active May 3, 2016
SSL self-made CA verification samples
View ssl-ca-check.c
const char * ca_pubkey =
{
"-----BEGIN CERTIFICATE-----\n"
...
"-----END CERTIFICATE-----"
};
void init(void)
{
/* these both are called only once for the entire application */