Skip to content

Instantly share code, notes, and snippets.

@nkmathew
nkmathew / lua-indenter.lua
Last active December 2, 2019 09:38
Yet another Lua indenter
#!/usr/bin/lua5.2
help = [===[
## lua-indenter.lua
**Started:** December 07, 2013, 08:37:25
**Date:** December 15, 2013
**License:** MIT
###Usage
@nkmathew
nkmathew / .gitignore
Last active January 1, 2016 18:09
A Lua indenter in C++. A translation of the Lua version found here http://gist.github.com/nkmathew/7969358
*.exe
@nkmathew
nkmathew / my-gcc.py
Last active January 18, 2018 07:37
A script for running single C/C++ files from SciTE
#!/usr/bin/python2.7
import os
import sys
import platform
import subprocess
import re
"""
This program runs gcc/g++ on a cpp/c source file. It supposed to be used in
#!/usr/bin/python2.7
## @Date: 21st February 2014, 16:00
"""
This code is supposed to help you paste to www.pastebin.com from the command
line as a Guest does in the web interface. The old pastebin
api(www.pastebin.com/api_public.php) has been deprecated in favor of the new
one(www.pastebin.com/api) which requires an api_key that can only be obtained by a
registered user.
@nkmathew
nkmathew / nasm-print-diamond.asm
Last active August 29, 2015 13:56
An assembly(NASM) program that prints a diamond pattern
;; @started: 19th February 2014 20:30
;; @completed: 23rd February 2014 11:20
;; Original C program
;; #include <stdio.h>
;;
;; void print_diamond(int width) {
;; /*
;; ** Every level is has two less or more characters than the next.
@nkmathew
nkmathew / hla_formatter.py
Created March 7, 2014 18:24
Primitive code formatter for the HLA(High Level Assembly) programming language
'''
@Started: 1st March 2014 1630
@Completed: 5th March 2014 0800
A hacked up script to help you survive through the Art of Assembly
Programming's rather awful formatting.
Alas, it has many flaws. It'll be helpful with only the most trivial of scripts.
'''
#!/bin/bash
#
# A script for changing login/desktop/lockscreen backgrounds
RED="\033[0;31m"
NC="\033[0m" # No Color
XML_FOLDER=/usr/share/images/desktop-base
WIDTH=1920
HEIGHT=1200
#!/bin/bash
for i in `seq 1 1542`; do
rm index.html
wget http://xkcd.com/$i/
IMG_URL=$(grep http://imgs.xkcd.com/comics/ index.html | head -1 | awk -F': ' '{print $2}')
IMG_NAME=$(echo $IMG_URL | awk -F'comics/' '{print $2}')
FULL_NAME="xkcd-$i-$IMG_NAME"
wget $IMG_URL -O $FULL_NAME
done
@nkmathew
nkmathew / githubclone.py
Last active April 4, 2017 16:14
Script for cloning all projects and gists
#!/usr/bin/env python3
"""
Date: 9th August 2015
Author: nkmathew
A script for cloning all projects and gists from my Github account when I move to a
new environment
USAGE:
#!/usr/bin/env python3
"""
Runs a simple HTTP Server locally on port 80
Created to handle mime types not handled in http.server
Usage:
python -m MyServer
"""
import time