Skip to content

Instantly share code, notes, and snippets.

View karthikraman's full-sized avatar
💭
I may be slow to respond.

Karthik Raman karthikraman

💭
I may be slow to respond.
View GitHub Profile
@karthikraman
karthikraman / transliterator.py
Created August 10, 2015 15:00
Transliterator for ITRANS, HarvardKyoto
""" Transliterate texts between unicode and standard transliteration schemes.
Transliterate texts between non-latin scripts and commonly-used latin
transliteration schemes. Uses standard Unicode character blocks --
e.g. DEVANAGARI U+0900 ... U+097F -- and transliteration schemes --
e.g. the IAST convention for transliteration of Sanskrit to latin-with-dots.
The following character blocks and transliteration schemes are included:
DEVANAGARI

Keybase proof

I hereby claim:

  • I am karthikraman on github.
  • I am karthikraman (https://keybase.io/karthikraman) on keybase.
  • I have a public key whose fingerprint is 65C2 1398 CACA 6508 ED10 0D6B 1472 EF9C 1015 F486

To claim this, I am signing this object:

import networkx as nx
import matplotlib.pyplot as plt
from math import log
def hypercube_graph(n):
"""Create a hypercube graph of size n
(int) -> Graph
"""
H = nx.Graph()
for i in range(2**n):
for j in range(n):
@karthikraman
karthikraman / Beamer-python.sublime-snippet
Last active October 19, 2015 09:24
Snippet TeX python code block
<snippet>
<content><![CDATA[
\begin{python}
${1}
\end{python}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>py</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.tex.latex</scope>
@karthikraman
karthikraman / Beamer-fragile-frame.sublime-snippet
Last active October 19, 2015 09:23
Snippet Beamer Fragile Frame
<snippet>
<content><![CDATA[\\begin{frame}[fragile]{${1:title}}
$2
\\end{frame}]]></content>
<tabTrigger>fframe</tabTrigger>
<scope>text.tex.latex</scope>
<description>Beamer frame</description>
</snippet>
@karthikraman
karthikraman / starred_item.tex
Created October 17, 2015 07:20
starred items in enumerate
% From http://tex.stackexchange.com/questions/52715/modifying-labels-on-some-enumerated-items
\def\asteriskitem{*}
\makeatletter
\def\sitem{%
\expandafter\let\expandafter\originallabel\csname labelenum\romannumeral\@enumdepth\endcsname
\expandafter\def\csname labelenum\romannumeral\@enumdepth\expandafter\endcsname\expandafter{%
\expandafter\asteriskitem\originallabel}%
\item
\expandafter\let\csname labelenum\romannumeral\@enumdepth\endcsname\originallabel
}
@karthikraman
karthikraman / beamer-columns.sublime-snippet
Created July 23, 2015 08:07
Snippet LaTeX Beamer Columns
<snippet>
<content><![CDATA[
\begin{columns}
\begin{column}{${1:2.5in}}
$3
\end{column}
\begin{column}{${2:2.5in}}
\end{column}
\end{columns}
@karthikraman
karthikraman / Beamer-block.sublime-snippet
Created July 23, 2015 08:01
Snippet LaTeX Beamer block
<snippet>
<content><![CDATA[
\begin{block}{${1:title}}
\begin{itemize}
\item ${2:items}.
\end{itemize}
\end{block}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>block</tabTrigger>
@karthikraman
karthikraman / pdfpextr.sh
Last active August 29, 2015 14:22
Bash: PDF page extractor
#Courtesy: http://www.linuxjournal.com/content/tech-tip-extract-pages-pdf
#Add this to your .bashrc
function pdfpextr()
{
# this function uses 3 arguments:
# $1 is the first page of the range to extract
# $2 is the last page of the range to extract
# $3 is the input file
# output file will be named "inputfile_pXX-pYY.pdf"