Skip to content

Instantly share code, notes, and snippets.

View nnathan's full-sized avatar
💭
shopt -s globstar

Naveen Nathan nnathan

💭
shopt -s globstar
  • Compton
  • 22:51 (UTC +10:00)
View GitHub Profile
@nnathan
nnathan / pingpong.c
Created December 30, 2023 01:25
Ping pong a byte over pipes and measure the exchanges (xv6 1.6 exercise)
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
size_t n_read;
void handle_alarm(int signum) {
printf("n_read = %lu\n", n_read);
fflush(NULL);
@nnathan
nnathan / example-ngate.json
Created February 5, 2020 01:06
Sample of n-gate entries as JSON.
[
{
"title": "Amazon Launchpad for Startups",
"titlelink": "https://www.amazon.com/gp/launchpad",
"date": "September 01, 2016",
"hnlink": "http://news.ycombinator.com/item?id=12398823",
"addendums": [],
"context": [],
"text": "Amazon would like to sell your shitty kickstarter products. Hackernews cannot decide if they're concerned enough about this centralization of power to post on medium about how dangerous it is; doing so would take away from the time they need to write android apps and monitor their adsense income and check their gmail accounts to make sure they're not missing a hangout. One-third of them complain that the images on the program website are not huge enough. Others are disgruntled because someone may compete with them."
},
@nnathan
nnathan / Pro - bash5.terminal
Created January 15, 2020 10:23
Pro\ -\ bash5.terminal
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlueColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGKyxYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKcHCBMZHSQoVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T
Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPEB4wIDAuMDU4ODYw
MTk2MjYgMC42NzY4NjYwOTQ2IDFPEBEwIDAgMC42MTI5OTM2NTc2ABABgAKABtMUFQ0W
@nnathan
nnathan / .mbsyncrc
Created November 19, 2019 01:13
.mbsyncrc
# this config is to facilitate one-way backups from fastmail to local maildir,
# it is specifically set to "Sync Pull" on the IMAP account to ensure
# read-only access.
#
# to run:
#
# brew install isync
# mbsync -a
BufferLimit 1024m
@nnathan
nnathan / .offlineimaprc
Created November 18, 2019 02:25
.offlineimaprc for backing up on MacOS
# to do a one-shot backup:
#
# $ offlineimap -a fastmail
[general]
accounts = fastmail
ui = blinkenlights
[Account fastmail]
@nnathan
nnathan / k-and-r-1.24.c
Created October 30, 2019 06:47
freenode ##c caze K&R C exercise 1.24 example from https://ideone.com/94U6aJ
#include <stdio.h>
#include <stdlib.h>
typedef void effector(int);
typedef struct transition transition;
struct transition {
int state;
effector *effect;
};
@nnathan
nnathan / transition.c
Created October 30, 2019 06:39
caze transition table from https://ideone.com/DdKmwq
#include <stdio.h>
#include <stdlib.h>
typedef void effector(int);
typedef struct transition transition;
struct transition {
int state;
effector *effect;
};
@nnathan
nnathan / check.sh
Last active October 26, 2019 22:19
Go repository build script.
#!/usr/bin/env bash
set -e
if [ -t 1 ]
then
CYAN='\033[0;36m'
YELLOW='\033[0;33m'
GREEN='\033[0;32m'
RED='\033[0;31m'
@nnathan
nnathan / burncd.md
Created June 10, 2019 01:24
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
nnathan / Pro.terminal
Created June 5, 2019 11:05
Terminal.app profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlueColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGKyxYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKcHCBMZHSQoVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T
Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPEB4wIDAuMDU4ODYw
MTk2MjYgMC42NzY4NjYwOTQ2IDFPEBEwIDAgMC42MTI5OTM2NTc2ABABgAKABtMUFQ0W