Skip to content

Instantly share code, notes, and snippets.

View xshyamx's full-sized avatar
🎯
Life before death, strength before weakness, journey before destination

shyam xshyamx

🎯
Life before death, strength before weakness, journey before destination
View GitHub Profile
@xshyamx
xshyamx / emacs-sendto-shortcut
Last active August 29, 2015 13:58
Emacs target for shortcut to be placed in C:\Users\xshyamx\AppData\Roaming\Microsoft\Windows\SendTo
E:\software\emacs-24.2\bin\emacsclientw.exe -n -a e:\software\emacs-24.2\bin\runemacs.exe --server-file c:\Users\xshyamx\AppData\Roaming\.emacs.d\server\server
@xshyamx
xshyamx / to-emacs
Created July 17, 2014 11:19
Pipe output of a shell command into a new emacs buffer from Git Bash
#!/bin/sh
fn="$RANDOM"
while read -r line
do
echo $line >> /tmp/$fn
done
/e/software/emacs-24.3/bin/emacsclientw -n /tmp/$fn
@xshyamx
xshyamx / cypher-mode.sh
Last active December 16, 2020 13:27
Extract Neo4j Cypher keywords, clauses & functions
#!/bin/sh
url=http://m2.neo4j.org/content/repositories/snapshots/org/neo4j/neo4j-cypher-compiler-2.2/2.2-SNAPSHOT/neo4j-cypher-compiler-2.2-2.2-20140807.002630-9-sources.jar
fn=$(echo $url | sed -re 's/^.*\/([^/]*)$/\1/')
curl -s -o $fn -L $url
jar xf $fn org/neo4j/cypher/internal/compiler/
echo Cypher Keywords
grep --no-filename -re 'keyword(' org/neo4j/cypher/internal/compiler/ \
| sed 's/keyword(/\n\0/g' \
| awk '/keyword\("/ { print tolower($0) }' \
@xshyamx
xshyamx / Boot2Docker.md
Created February 25, 2015 12:04
Boot2Docker Windows Proxy

Setup proxy on Boot2Docker Windows

  1. Start Boot2Docker
  2. Add HTTP_PROXY and HTTPS_PROXY variables in /var/lib/boot2docker/profile
  3. Restart docker daemon sudo /etc/init.d/docker restart
@xshyamx
xshyamx / LineCount.java
Created March 5, 2015 13:26
Line Count Benchmark
import java.io.BufferedReader;
import java.io.FileReader;
public class LineCount {
public static void main(String[] args) throws Exception {
String filename = "csv/order-details-filtered.csv";
if ( args.length > 2 ) {
filename = args[2];
}
@xshyamx
xshyamx / Web Resource Optimization Tools Roundup.md
Last active August 29, 2015 14:16
Web Resource Optimization Tools Roundup

Web Resource Optimization Tools

Comparison of 3 web resource optimization tools available for Java/JEE development.

[wro4j][wro4j]

  • Maven support
  • Taglib support (not built-in but community developed [wro4j-taglib][wro4j-taglib] available)
  • XML/Groovy configuration
  • Uglify javascript compression supported
  • Command line processor available
@xshyamx
xshyamx / Build guideline for MSYS2-MinGW-w64 system.md
Created December 8, 2015 06:49
Build guideline for MSYS2-MinGW-w64 system

Build guideline for MSYS2-MinGW-w64 system

Set up the MSYS2/MinGW-w64 build environment

Download the x86_64 version of MSYS2 in here and install in your preferred directory, e.g. C:\msys64. Note that path containing spaces may causes problems. Run msys2_shell.bat in the C:\msys64 and you will see a BASH window opened. In the BASH prompt, use the following commands to install the necessary packages:

pacman -S base-devel mingw-w64-x86_64-toolchain \
mingw-w64-x86_64-xpm-nox mingw-w64-x86_64-libtiff \
mingw-w64-x86_64-giflib mingw-w64-x86_64-libpng \

mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-librsvg \

@xshyamx
xshyamx / toggle-wifi.sh
Created December 8, 2015 06:55
Toggle WiFi on and off from the command line
# simple commands to (dis)connect from wifi network
# docker-machine and docker are unable to handle the changing ip addresses :(
# but once, disconnect and reconnect everything is happy in paradise :)
wifi_off() {
netsh wlan show interfaces > /tmp/wifi_status
status=$(awk -F: '/State/ {gsub(/^ *| *$/, "", $2); print$2; }' /tmp/wifi_status)
name=$(awk -F: '/Name/ { gsub(/^ *| *$/, "", $2); print$2; }' /tmp/wifi_status)
if [ "$status" = "connected" ]; then
netsh wlan disconnect interface="$name"
fi
@xshyamx
xshyamx / docker-machine.md
Created June 21, 2016 09:21
Create docker machine behind a proxy

To create a docker machine VM which connects via a proxy running on the host machine on port 9090

docker-machine create -d virtualbox \
               --engine-env HTTP_PROXY=http://10.0.2.2:9090 \
               --engine-env HTTPS_PROXY=http://10.0.2.2:9090 \

dm-name

@xshyamx
xshyamx / yasnippet.md
Created July 14, 2016 08:22
Yasnippet prevent major-mode indentation

Yasnippets which get included usually have the major mode indentation applied. In cases where you need to disable this use # expand-env: ((yas-indent-line 'fixed)) to prevent this (Thanks to this stackoverflow quesion).