Skip to content

Instantly share code, notes, and snippets.

View rocketraman's full-sized avatar

Raman Gupta rocketraman

View GitHub Profile
@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:
@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 / .gitconfig
Last active November 7, 2024 21:42
.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 / 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 / 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)
##
## 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 / 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
#%RAML 1.0
title: Test
version: v1
baseUri: http://localhost:8080
types:
GeoPoint:
properties:
coordinates:
type: number[]
example:
@rocketraman
rocketraman / pom.xml
Last active May 24, 2024 07:05
Karaf-maven-plugin example
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- ... -->
<packaging>karaf-assembly</packaging>
<build>
<plugins>
<plugin>
@rocketraman
rocketraman / equals-hash-tostring.java
Last active April 29, 2020 01:48 — forked from rocketraman/equals-hash-tostring.java
Example of JDK7+ Objects equals, hash and Guava 18+ toString implementations
import com.google.common.base.MoreObjects;
import java.util.Objects;
public class Address {
...
@Override
public boolean equals(Object obj) {