Skip to content

Instantly share code, notes, and snippets.

View harish2704's full-sized avatar

Harish Karumuthil harish2704

View GitHub Profile
mohanpedala /
Last active May 19, 2024 04:52
set -e, -u, -o, -x pipefail explanation
timvisee /
Last active May 18, 2024 18:03
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.


  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
jerinphilip /
Last active June 30, 2023 09:35 — forked from santhoshtr/
PangoCairo Text rendering
#-*- coding:utf8 -*-
# Modified for python3
# python2 version
import cairo
from gi.repository import Gtk, Gdk, Pango, PangoCairo
import cairo
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 600, 100)
context = cairo.Context(surface)
harish2704 / sendmail.js
Last active May 14, 2022 10:55
Psudo sendmail script for testing
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const mailDir = path.join( __dirname, '..', '..', 'test-mails' );
const {stdin} = process;
async function getStdin() {
let result = '';
csswizardry /
Last active April 2, 2024 20:17
Vim without NERD tree or CtrlP

Vim without NERD tree or CtrlP

I used to use NERD tree for quite a while, then switched to CtrlP for something a little more lightweight. My setup now includes zero file browser or tree view, and instead uses native Vim fuzzy search and auto-directory switching.

Fuzzy Search

There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*, e.g.:

:vs **/*<partial file name><Tab>
jack-guy / feathers.d.ts
Last active September 7, 2017 10:34
These are basic typings for Feathers.js based off of those in DefinitelyTyped for Express. This doesn't type feathers plugins, but does have some interfaces that can be used in them. WIP.
// Type definitions for Feathers
// Project:
// Definitions by: Jack Guy <>
// Definitions:
import { Application, Handler, ErrorRequestHandler } from 'express';
type HandlerArgument = Handler | Handler[];
export = Feathers;
<?php header("Content-Type: text/plain"); ?>
<?php header("Content-Disposition: inline"); ?>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
//IMPORTANT: Update the pin and length to match your LED strip!
#define PIN 5
#define LENGTH 150
karpathy /
Last active May 18, 2024 09:02
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
darkxanter /
Last active April 21, 2018 09:15
Python DBus handle hibernate, sleep and resume
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'xanter'
#from datetime import datetime
import signal
import time
import dbus
import gobject
import urllib2
creationix / init.lua
Last active November 1, 2019 11:13
Websocket server in nodemcu using new crypto module.
tmr.alarm(0, 1000, 1, function ()
local ip = wifi.sta.getip()
if ip then