Skip to content

Instantly share code, notes, and snippets.

View vyuh's full-sized avatar

Prashant Karmakar vyuh

View GitHub Profile
@vyuh
vyuh / trymathwords.tex
Created January 4, 2018 19:50
A nice plain tex macro for tryin control sequences in math mode.
\magnification=1200
\def\endmathwords{$$}
\def\trymathwords#1{%
$$
\begingroup
\edef\@tempa{#1\space}%
\expandafter\endgroup
\expandafter\readwords\@tempa\relax
}
\def\readwords#1 #2\relax{%
@vyuh
vyuh / cogeo.pl
Created December 22, 2017 08:28
Coordinate Geometry Functions
use List::Util qw/sum0 pairmap/;
sub zip2 {
@_[ map { $_, $_ + @_ / 2 } 0 .. ( @_ / 2 - 1 ) ];
}
sub zip3 {
@_[ map { $_, $_ + @_ / 3, $_ + 2 * ( @_ / 3 ) } 0 .. ( @_ / 3 - 1 ) ];
}
@vyuh
vyuh / fonts.conf
Created December 20, 2017 04:54
Fontconfig file for better firefox fonts on *NIX on websites like Github and Twitter
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Set preferred serif, sans serif, and monospace fonts. -->
<alias>
<family>serif</family>
<prefer><family>Droid Serif</family></prefer>
</alias>
<alias>
<family>sans-serif</family>
@vyuh
vyuh / cheatsheet_link.txt
Created December 17, 2017 06:56
Links to Cheatsheets
@vyuh
vyuh / typesetting_devnagari.xelatex
Created December 16, 2017 08:00
Typesetting Devnagari in XeLaTeX
\documentclass{article}
\usepackage{fontspec}
\setmainfont[Script=Devanagari,Mapping=velthuis-sanskrit]{Nakula}
\catcode`\~=12
\setlength\parindent{0pt}
\begin{document}
@vyuh
vyuh / .fonts.conf
Last active November 11, 2017 06:58
Reject Bland fonts in Ubuntu
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<include ignore_missing="yes">/absolute/path/to/select.conf</include>
</fontconfig>
@vyuh
vyuh / build-elm-platform-on-freebsd-11-1.sh
Last active October 26, 2017 17:59
Trying to document how I built Elm Platform on FreeBSD 11.1
# make sure lzlib exists on system.
# run `pkg install lzlib`
# this is the only step that required superuser privileges.
# USAGE
# For building at <PREFIX>/Elm-Platform/<VERSION>, run:
# sh build-elm-platform-on-freebsd-11-1.sh <PREFIX> <VERSION>
# SIDE EFFECTS
# Blindly downloads ghc 7.10.2, keeps it beside Elm-Platform in <PREFIX>
@vyuh
vyuh / install_heroku_without_sudo_linux.sh
Last active September 21, 2022 13:42
Install heroku without sudo on linux
#!/bin/sh
{
HEROKU_CLIENT_URL="https://s3.amazonaws.com/assets.heroku.com/heroku-client/heroku-client.tgz"
sh <<SCRIPT
# set appropriate HEROKU_DIR env variable
# default is ~/.local/heroku
# download and extract the client tarball
@vyuh
vyuh / SQLITE_CLI_GARBLES_STRINGS.md
Last active November 18, 2016 15:25
Potential Bug Fix: Sqlite CLI removes CR characters in end of line even if they are inside quoted string literals.

BUG

SQLite CLI removes '\r' even from inside quoted strings that appear in SQL input piped into sqlite (CLI). These are never replaced later. A program should not tamper literals in this undocumented way.

DEMONSTRATION

Files in this repository face automatic CRLF translation

@vyuh
vyuh / android_application_structure.clj
Created October 4, 2016 16:01
Stucture of an Android Application Project as a clojure map.
{:build.gradle {},
:gradle.properties {},
:settings.gradle {},
:local.properties {},
:modules
{:alib
{:build.gradle {},
:progaurd-rules.pro {},
:manifests {:AndroidManifest.xml {}},
:java {:androidTest {}, :test {}, :main {}},