Skip to content

Instantly share code, notes, and snippets.

View yeban's full-sized avatar

Anurag Priyam yeban

View GitHub Profile
@yeban
yeban / readline.c
Created March 2, 2010 16:42
A c function to take a string input of arbitrary length.
//the return pointer must be freed
char* readline() {
char buffer;
char *command = NULL;
char *tmp = NULL;
int size = 0;
int last = 0;
while ( 1 ){ //listen indefinitely for characters
@yeban
yeban / jekyll.tag-cloud.rb
Created April 3, 2012 07:36
Flexible, logarithmic distribution, tag cloud for Jekyll.
# Copyright (C) 2011 Anurag Priyam - MIT License
module Jekyll
# Jekyll plugin to generate tag clouds.
#
# The plugin defines a `tag_cloud` tag that is rendered by Liquid into a tag
# cloud:
#
# <div class='cloud'>
@yeban
yeban / SequenceServer CLA
Created October 14, 2020 13:17
sequenceserver_cla
SequenceServer Individual Contributor License Agreement
Thank you for your interest in contributing to SequenceServer.
This contributor agreement ("Agreement") documents the rights granted by contributors to Us. To make this document effective, please sign it and send it to Us, following the instructions at . This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Us.
1. Definitions
"We" or "Us" means the maintaners of SequenceServer: Anurag Priyam and Dr. Yannick Wurm.
"You" means the individual who Submits a Contribution to Us.
"Contribution" means any work of authorship that is Submitted by You to Us in which You own or assert ownership of the Copyright. If You do not own the Copyright in the entire work of authorship, please follow the instructions in .
"Copyright" means all rights protecting works of authorship owned or controlled by You, including copyright, moral and neighboring rights, as appropriate, fo
@yeban
yeban / pre-commit.sh
Created May 6, 2011 09:33
Git pre-commit hook to remove stray debugger statements from your merb project.
#!/bin/sh
# Remove stray debugger statements from the modified files before committing
# get a list of added, modified, copied files
files=`git diff --cached --name-only --diff-filter=ACM`
# remove debugger lines
#
# 1. remove any line containing a debugger
@yeban
yeban / xmonad.hs
Created February 22, 2010 11:39
xmonad.hs used to run xmonad with Xfce4
--
-- xmonad example config file.
--
-- A template showing all available configuration hooks,
-- and how to override the defaults in your own xmonad.hs conf file.
--
-- Normally, you'd only override those defaults you care about.
--
import XMonad
@yeban
yeban / gmail.rb
Created April 11, 2010 16:05
Bare bones Ruby script to send emails using Gmail
=begin
Tested with ruby 1.8.7 on a Debian machine, with my own gmail account.
ruby -rubygems "from name" "from email" "to name" "to email" "subject" "body"
=end
require 'net/smtp'
require 'tlsmail'
Net::SMTP.enable_tls OpenSSL::SSL::VERIFY_NONE
$SERVER = 'smtp.gmail.com'
@yeban
yeban / rooter.sh
Created April 26, 2012 10:30
cd to the project root (identified by the presence of a SCM directory, like .git, or .bzr)
# Copyright (C) 2011 Anurag Priyam - MIT License
#
# cd to the project root (identified by the presence of a SCM directory, like
# .git, or .bzr)
#
# Install
# -------
#
# Put something like this in your .zshrc:
#
@yeban
yeban / nptel-dl.rb
Created March 6, 2012 10:59
Download video lectures from NPTEL.
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
# FEM
page = "http://nptel.iitm.ac.in/video.php?subjectId=112106135"
download = "http://npteldownloads.iitm.ac.in/softlinks_mp4/112106135/lec%02d.mp4"
@yeban
yeban / shell.c
Created March 6, 2012 10:38
Implementing a shell. External commands, builtins, I/O redirection, and pipes.
#include <stdio.h>
#include <string.h>
#include <stdlib.h> //realloc()
#include <unistd.h> //fork(), pipe()
#include <limits.h> //PATH_MAX
//#include <sys/stat.h>
//#include <sys/types.h>
#include <fcntl.h> //access mode constants, and flags for open()
#include <errno.h> //errno
#include <readline/readline.h>
@yeban
yeban / lcs_length.c
Created March 6, 2012 10:28
find the length of longest common sequence
#include <stdio.h>
#include <string.h>
int main()
{
/* read the number of test cases */
int ncases;
scanf("%d", &ncases);
int i;