Skip to content

Instantly share code, notes, and snippets.

💭
shopt -s globstar

Naveen Nathan nnathan

💭
shopt -s globstar
  • 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
View .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 Nov 18, 2019
.offlineimaprc for backing up on MacOS
View .offlineimaprc
# 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 Oct 30, 2019
freenode ##c caze K&R C exercise 1.24 example from https://ideone.com/94U6aJ
View k-and-r-1.24.c
#include <stdio.h>
#include <stdlib.h>
typedef void effector(int);
typedef struct transition transition;
struct transition {
int state;
effector *effect;
};
View transition.c
#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 Oct 26, 2019
Go repository build script.
View check.sh
#!/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 Jun 10, 2019
idea for audio cd burning gui on mac
View burncd.md

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 Jun 5, 2019
Terminal.app profile
View Pro.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 / 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
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 <naveen@lastninja.net>
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://mail.messagingengine.com/"
## set imap_user = "billg@microsoft.com"
## 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)
You can’t perform that action at this time.