Skip to content

Instantly share code, notes, and snippets.

Avatar

Prashant Karmakar vyuh

View GitHub Profile
@vyuh
vyuh / export_data_from_j.md
Last active May 26, 2020
Exporting data to file from jconsole
View export_data_from_j.md

exporting data from [jconsole][j installation zip].

rlo =. 4 : 'a; (,.b); +/@:*: (b =. ? 0 $~ # y)+ y - (a =. ? 0 $~ #@> y;x) +/ . * x'
iter =. 3 : 'y; 1 2 3 rlo 5 7 8 9'
data =: iter"0 i.50
outstr =: ": data
require 'files'
outstr fwrite 'out.txt'
(": $ outstr) fappend 'out.txt'
@vyuh
vyuh / data-walk-email-bug-report.txt
Last active May 14, 2018
Data::Walk Bug Report and Patch
View data-walk-email-bug-report.txt
Subject: Top Level Object should not have a container
Data::Walk Version 2.01 assigns `container` and `type` for top-level objects
in an inconsistent way. On one hand, A scalar at top level gets the
arrayref of `@args` as `container`, and `ARRAY` as `type`. Whereas
a hashref, or arrayref, at top-level gets *ITSELF* as the `container`,
and its own ref type (`ARRAY|HASH`) as `type`. The latter behaviour
is not consistent because it implies that the item is contained in
itself.
@vyuh
vyuh / trymathwords.tex
Created Jan 4, 2018
A nice plain tex macro for tryin control sequences in math mode.
View trymathwords.tex
\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 Dec 22, 2017
Coordinate Geometry Functions
View cogeo.pl
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 Dec 20, 2017
Fontconfig file for better firefox fonts on *NIX on websites like Github and Twitter
View fonts.conf
<?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 Dec 17, 2017
Links to Cheatsheets
View cheatsheet_link.txt
@vyuh
vyuh / typesetting_devnagari.xelatex
Created Dec 16, 2017
Typesetting Devnagari in XeLaTeX
View typesetting_devnagari.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 Nov 11, 2017
Reject Bland fonts in Ubuntu
View .fonts.conf
<?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 Oct 26, 2017
Trying to document how I built Elm Platform on FreeBSD 11.1
View build-elm-platform-on-freebsd-11-1.sh
# 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 Jul 13, 2020
Install heroku without sudo on linux
View install_heroku_without_sudo_linux.sh
#!/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
You can’t perform that action at this time.