Skip to content

Instantly share code, notes, and snippets.

@kks32
kks32 / spacing.tex
Last active December 19, 2015 10:46
Spacing between chapters in LOT and LOF - LaTeX
\makeatletter
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter}#1}%
\else
\addcontentsline{toc}{chapter}{#1}%
\fi
@kks32
kks32 / PhDThesisPSnPDF.cls
Created December 21, 2015 17:18
Scrbook version of PhDThesis template
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% Class ``PhD Thesis PSnPDF'' %%
%% %%
%% A PhD thesis LaTeX template for Cambridge University Engineering Department%%
%% %%
%% Version: v2.0 %%
%% Authors: Krishna Kumar %%
%% License: MIT License (c) 2015 Krishna Kumar %%
%% GitHub Repo: https://github.com/kks32/phd-thesis-template/ %%
@kks32
kks32 / compare_columns_file.sh
Last active June 14, 2018 21:47
AWK command to compare two columns of different files and print required columns from both files.
awk -F',' 'NR==FNR{label[$1]=$1;date[$1]=$2;next}; ($2==label[$2]){print $0 "," date[$2]}' <(sort -k1 file2.csv) <(sort -k2 file1.csv) &> file3.csv
@kks32
kks32 / CLA.md
Created September 3, 2017 12:30
CB-Cities CLA

CB-Cities Contributor License Agreement

The following terms are used throughout this agreement:

  • You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
  • Project - is an umbrella term that refers to any and all CB-Cities open source projects.
  • Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.
  • Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with the contributors or maintainers.

1. Grant of Copyright License. Subject to the terms and conditions of this agreement, You grant to the Projects’ maintainers, contributors, and to users a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, pu

@kks32
kks32 / header-merge-pdfs.sh
Created September 12, 2017 12:44
Filename as a header to PDFs and merge PDFs
#!/bin/bash
mkdir figs
for i in $(find -iname "*.pdf"); do convert -stroke black -pointsize 40 -gravity center -draw "text 0,-500 '$i'" $i figs/$i; echo $i; done
cd figs/
pdf-stapler -cat *.pdf out.pdf
@kks32
kks32 / bay_area.mtx
Created February 15, 2018 02:11
Bay Area routing
This file has been truncated, but you can view the full file.
%%MatrixMarket matrix coordinate real symmetric
%
729287 729287 933736
23 21 4.254637725981646e-02
39 38 3.268393645080242e-01
40 39 1.570601156920997e-01
41 40 3.568266469720252e-01
42 41 5.124912403373735e-02
50 49 4.423989659246390e-01
58 57 1.984531874916027e-01
@kks32
kks32 / reverse.py
Created June 16, 2018 07:59
Python reverse
def reverse(data_list):
length = len(data_list)
s = length
new_list = [None]*length
for item in data_list:
s = s - 1
new_list[s] = item
return new_list
@kks32
kks32 / snake-template.py
Last active June 30, 2018 08:21
Snake template for micropython
import microbit
import random
class SnakeBit():
# Define directions
UP = 0
DOWN = 1
RIGHT = 2
LEFT = 3
# Add snake brightness
import random
#welcoming the user
name = raw_input("What is your name? ")
print "Hello, " + name, "Time to play hangman!"
print "Start guessing..."
#generates random word
@kks32
kks32 / mpm-speed-up.md
Last active November 19, 2018 14:09
CB-Geo MPM code

Plate with hole

32 - 35.730940779 +/- 0.22% 16 - 45.890542910 +/- 0.62% 8 - 70.222314796 +/- 1.24% 4 - 110.781838974 +/- 1.36% 2 - 138.182933579 +/- 3.05% 1 - 80.16 +/- 2.73%

Plate with hole (Singularity TBB)