Skip to content

Instantly share code, notes, and snippets.

View rocketraman's full-sized avatar

Raman Gupta rocketraman

View GitHub Profile
@rocketraman
rocketraman / gitrmb
Last active November 12, 2020 18:32
Cleanup merged local and remote git branches
#!/bin/bash
# exclude branches regex, configure as "(branch1|branch2|etc)$"
excludes_default="(master|next)$"
excludes="__NOTHING__"
includes=
merged="--merged"
local=1
remote=1
##
## Makefile to keep the hash symlinks in SSLCACertificatePath up to date
## Copyright (c) 1998-2001 Ralf S. Engelschall, All Rights Reserved.
##
SSL_PROGRAM=
update: clean
-@ssl_program="$(SSL_PROGRAM)"; \
if [ ".$$ssl_program" = . ]; then \
@rocketraman
rocketraman / convert-to-stanford-classifier.sh
Last active November 15, 2016 22:51
Conversion of convert-to-stanford-classifier.csh (http://nlp.stanford.edu/wiki/Software/Classifier/20_Newsgroups) to bourne shell
#!/bin/sh
# The 20 newsgroups documents are traditional 8 bit not utf-8
export LC_ALL=en_US.ISO-8859-1
for dataset in 20news-bydate-train 20news-bydate-test; do
output="$dataset-stanford-classifier-iso-8859-1.txt"
rm -f $output
for newsgroup in $dataset/*; do
for file in $newsgroup/*; do
cls=$(echo $file | cut -d "/" -f 2)
@rocketraman
rocketraman / 0_reuse_code.js
Created February 22, 2017 05:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rocketraman
rocketraman / .gitconfig
Last active January 4, 2026 04:09
.gitconfig aliases useful for gitworkflow (https://github.com/rocketraman/gitworkflow)
[alias]
# Basically `log --oneline --decorate --graph` with different colors and some additional info (author and date)
lg = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(dim black)%d%C(reset)'
# lg (see above) with --first-parent
lgp = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(dim black)%d%C(reset)' --first-parent
# https://stackoverflow.com/questions/61510067/show-specific-commits-in-git-log-in-context-of-other-commits
hl = "!f() { cd -- ${GIT_PREFIX:-.}; grep --color -E \"$(git log --pretty=%h \"$@\" | tr '\n' '|')\" || true; }; f"
hlp = "!f() { cd -- ${GIT_PREFIX:-.}; less -R -p $(git log --pretty=%h \"$@\" | tr '\n' '|'); }; f"
@rocketraman
rocketraman / kafka.yaml
Created October 4, 2017 00:05
Kubernetes deployment and service descriptor for Kafka
apiVersion: v1
kind: Service
metadata:
name: kafka
labels:
app: kafka
tier: backend
spec:
# Lookup: dig -t srv _kafka._tcp.kafka.default.svc.cluster.local
ports:
@rocketraman
rocketraman / zookeeper.yaml
Created October 4, 2017 00:07
Kubernetes service and deployment descriptor for Zookeeper
apiVersion: v1
kind: Service
metadata:
name: zk
labels:
app: zk
tier: backend
spec:
# Lookup: dig -t srv _client._tcp.zk.default.svc.cluster.local
ports:
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class TestLogging {
private static final Logger logger = LogManager.getLogger("HelloWorld");
public static void main(String[] args) {
logger.info("Start");
logger.info("This is a test.", new Exception("Test exception!"));
logger.info("End");
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class TestLogging {
private static final Logger logger = LogManager.getLogger("HelloWorld");
public static void main(String[] args) {
logger.info("This is a test.", new Exception("Test exception!"));
}
}
@rocketraman
rocketraman / scans-init.gradle.kts
Last active April 28, 2020 18:05
Enable build scans for all builds via `~/.gradle/init.d/scans-init.gradle.kts`
import com.gradle.enterprise.gradleplugin.GradleEnterprisePlugin
import com.gradle.scan.plugin.BuildScanPlugin
import org.gradle.util.GradleVersion
initscript {
val pluginVersion = "3.2.1"
repositories {
gradlePluginPortal()
}