Skip to content

Instantly share code, notes, and snippets.

@jargnar
jargnar / .vimrc
Created July 17, 2014 06:58
My .vimrc file
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
"
" " let Vundle manage Vundle, required
### Keybase proof
I hereby claim:
* I am jargnar on github.
* I am suhas (https://keybase.io/suhas) on keybase.
* I have a public key whose fingerprint is 2D74 46F7 A8D9 351C 5ADE 8318 2568 336C 3487 B687
To claim this, I am signing this object:
@jargnar
jargnar / LargeFactorial.cpp
Created August 5, 2012 14:49
Factorials of large numbers using C++ Strings
// Suhas SG
// http://suhas.co
// INPUT:
// T - test cases followed by T lines of a number n.
// OUTPUT:
// Factorial of each n, in that order.
#include <iostream>
#include <string>
#define OVERFLOW 2
@jargnar
jargnar / mswin.vim
Created November 28, 2015 15:39
For vim on windows
" Set options and add mapping such that Vim behaves a lot like MS-Windows
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2012 Jul 25
" bail out if this isn't wanted (mrsvim.vim uses this).
if exists("g:skip_loading_mswin") && g:skip_loading_mswin
finish
endif
@jargnar
jargnar / _vimrc
Created November 28, 2015 16:08
vimrc on windows
set nocompatible
source $VIMRUNTIME/mswin.vim
behave mswin
filetype off
set rtp+=$HOME/vimfiles/bundle/Vundle.vim/
call vundle#begin('$HOME/vimfiles/bundle/')
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
@jargnar
jargnar / function_calls_ast.py
Created March 8, 2016 16:53
Lists all function calls in a python file
'''
Get all function calls from a python file
The MIT License (MIT)
Copyright (c) 2016 Suhas S G <jargnar@gmail.com>
'''
import ast
from collections import deque
@jargnar
jargnar / checkcmd.sh
Last active April 12, 2016 07:31
Check if a command exists in linux
#!/bin/bash
if [ $# -eq 0 ]; then
printf "Please specify the command to check for.\n"
printf "Example:\n"
printf "$ ./checkcmd.sh docker\n"
else
if sudo command -v $1 >/dev/null 2>&1; then
printf "Yay! $1 exists.\n"
else
@jargnar
jargnar / Test.Volume.Dockerfile
Created April 12, 2016 08:27
Example Docker image for testing volume mounts
FROM busybox
MAINTAINER Suhas SG <suhas@suhas.co>
RUN mkdir /var/lib
RUN touch /var/lib/data.txt
VOLUME ["/var/lib"]
@jargnar
jargnar / primes.py
Last active April 18, 2016 04:03
Generate prime numbers up to N using the Sieve of Eratosthenes
'''
Get all primes till N (using Sieve of Eratosthenes)
The MIT License (MIT)
Copyright (c) 2016 Suhas S G <jargnar@gmail.com>
'''
import math
def primes(n):
@jargnar
jargnar / topo.html
Created June 4, 2016 08:25
Custom TopoJSON and Leaflet.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Custom map</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
</head>
<body>
<div id="map" style="width: 100%; height: 400px; margin-bottom: 1.5em;"></div>