Skip to content

Instantly share code, notes, and snippets.

Naveen Nathan nnathan

  • Compton
Block or report user

Report or block nnathan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
nnathan /
Created Jun 10, 2019
idea for audio cd burning gui on mac

Audio CD Burning for Mac

When it comes to burning audio CDs on a mac (since at least 10.9) there's really only two options: iTunes or using cdrdao.

iTunes has a very simple GUI and it makes it pretty easy to burn but instead of doing DAO (Disc-At-Once) burning it does TAO (Track-At-Once) which is extremely tempremental and results in more coasters than good burns. It may do DAO for CD-TEXT cds but even then I get a burn success rate of 10%.

cdrdao on the other hand does DAO and is incredibly reliable.

it would be nice to write an open source public domain native mac program that bundles cdrdao and LAME and provides a small GUI that implements the Audio CD burning interface provided by iTunes.

nnathan / Pro.terminal
Created Jun 5, 2019 profile
View Pro.terminal
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
nnathan / urandompoll.c
Last active May 27, 2019
example poll program
View urandompoll.c
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/poll.h>
#define TIMEOUT 5
int main (void)
nnathan / urandom.patch
Last active May 27, 2019
patch for /dev/urandom to block on cold start when random.urandom_can_block=y in kernel cmdline
View urandom.patch
From ad8f2da2749e24ca038ea7d4bd96ce61df937ee1 Mon Sep 17 00:00:00 2001
From: Naveen Nathan <>
Date: Mon, 27 May 2019 10:05:01 +0000
Subject: [PATCH] random: urandom reads block when CRNG is not initialized.
Adds a compile-time option to ensure urandom reads block until
the cryptographic random number generator (CRNG) is initialized.
This fixes a long standing security issue, the so called boot-time
entropy hole, where systems (particularly headless and embededd)
View .muttrc
# imap
## .muttrc_auth should contain the following
## set folder = "imaps://"
## set imap_user = ""
## set imap_pass = "hunter2"
source ~/.muttrc_auth
set imap_idle = yes
set spoolfile = "+INBOX" # specifies default mailbox
set postponed = "+INBOX/Drafts" # stores a copy of message until its sent (draft)
nnathan / .bash_profile
Last active Jun 5, 2019
View .bash_profile
local rc=$?
[[ $(history 1) =~ ^\ *[0-9]+\ +([^\ ]+\ [^\ ]+)\ +(.*)$ ]]
local date_part="${BASH_REMATCH[1]}"
local command_part="${BASH_REMATCH[2]}"
if [ "$command_part" != "$PERSISTENT_HISTORY_LAST" ]
nnathan / r.c
Last active Jan 8, 2019
regex alternation is not commutative
View r.c
/* turns out this is wrong, the regex "quic | noise" contains spaces you need to consider */
* $ ./r
* "quic | noise" matches "high pitched noise coming from car"
* $ ./r s
* "noise | quic" matches "a quick fix"
* "noise | quic" matches "high pitched noise coming from car"
#include <stdio.h>
nnathan / broke.mbox
Created Jan 7, 2019
mbox demonstrating mutt regex ~s "noise | quic" is not the same as ~s "quic | noise"
View broke.mbox
From Tue Jan 8 09:37:45 2019
Date: Tue, 8 Jan 2019 09:37:45 +1100
To: a@b.c
Subject: a quick fix
Message-ID: <20190107223745.GA1689@Administrators-MacBook-Pro-3.local>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.11.1 (2018-12-01)
View qsort.c
/* A simple qsort implementation on linked lists */
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
* A 'node' is an element of the linked list, containing a pointer
* to the next element, and the associated data
* A full list is represented by a pointer to its first element
nnathan / slqueue.c
Created Jan 3, 2019
Understanding BSD queue.h single linked list implementation
View slqueue.c
* See queue(3) or for reference.
#include <stdio.h>
#include <sys/queue.h>
struct Pattern {
char name[100];
/* Following expands to:
You can’t perform that action at this time.