Skip to content

Instantly share code, notes, and snippets.

View nakal's full-sized avatar

Martin Sugioarto nakal

View GitHub Profile
#!/bin/sh
#
# $FreeBSD$
# PROVIDE: phabricator_phd
# REQUIRE: DAEMON mysql
# KEYWORD: shutdown
. /etc/rc.subr
#!/bin/sh
#
# $FreeBSD$
# PROVIDE: phabricator_aphlict
# REQUIRE: phabricator_phd
# KEYWORD: shutdown
. /etc/rc.subr
#!/bin/sh
IRCSERVER="$1"
CHANNEL="$2"
TEXT="$3"
WEECHAT_PID=`pgrep -U weechatuser weechat`
WEECHAT_PIPE="/home/weechatuser/.weechat/weechat_fifo_${WEECHAT_PID}"
if [ -p "$WEECHAT_PIPE" ]; then
echo "irc.$IRCSERVER.$CHANNEL *$TEXT" > "$WEECHAT_PIPE"
@nakal
nakal / ssl-ca-check.c
Last active May 3, 2016 13:55
SSL self-made CA verification samples
const char * ca_pubkey =
{
"-----BEGIN CERTIFICATE-----\n"
...
"-----END CERTIFICATE-----"
};
void init(void)
{
/* these both are called only once for the entire application */
#!/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'`")"
#!/usr/bin/env perl
use strict;
use warnings;
my $verbose = 0;
my ($senddiff) = @ARGV;
if (defined($senddiff)) {
$senddiff = 1;
@nakal
nakal / poudriere-cmd.sh
Created October 7, 2016 14:18
Command wrapper for poudriere
#!/bin/sh
JAIL=11amd64
FUN="$1"
DEST="$2"
shift 2
PKG="$@"
OPT_EXT=""
@nakal
nakal / year_average.hs
Created November 3, 2016 16:57
Calculates a diagram of average usage per day from timestamp/value pairs
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
MaildirStore maildir
Path ~/.mail/
Inbox ~/.mail/INBOX
Flatten .
IMAPAccount imapaccount
Host HOSTNAME
User USER
Pass PASSWORD
SSLVersions TLSv1.2