Skip to content

Instantly share code, notes, and snippets.

View jairamc's full-sized avatar

Jairam Chandar jairamc

View GitHub Profile
@jairamc
jairamc / drone-local
Created January 9, 2020 15:20
Helper script to run drone build locally with some defaults
#!/usr/bin/env bash
command -v drone >/dev/null 2>&1 || { echo >&2 "Could not find drone-cli. Aborting."; exit 1; }
function usage() {
echo "NAME:"
echo " drone-local - Helper to run drone build locally"
echo
echo "USAGE:"
echo " drone-local [options]"
@jairamc
jairamc / migrate.py
Created March 13, 2018 15:59
Migrate from Github to Bitbucket
# Modified version of https://gist.github.com/schwa/5907109
import os
import subprocess
import glob
from github import Github # pip install PyGithub
from pybitbucket.bitbucket import Client # pip install pybitbucket
from pybitbucket.auth import BasicAuthenticator
from pybitbucket.repository import Repository, RepositoryPayload, RepositoryType, RepositoryForkPolicy
@jairamc
jairamc / keybase.md
Created November 23, 2017 13:44
Keybase Proof

Keybase proof

I hereby claim:

  • I am jairamc on github.
  • I am jairamc (https://keybase.io/jairamc) on keybase.
  • I have a public key ASDH90X6-FniXaRsg0al0-W5Ns_bV8gqBWvc6RmV5xfw_wo

To claim this, I am signing this object:

## Checkout all branches from remote as tracking branches. Based on https://stackoverflow.com/questions/379081/track-all-remote-git-branches-as-local-branches/6300386#6300386
UPSTREAM=$1
MYREPO=$2
usage() {
echo "Usage:"
echo "$0 <upstream-remote> <target-remote>"
echo ""
echo "Example which ensures remote named 'maxandersen' have all the same branches and tags as 'origin'"
// Metrics reporter
val kamonVersion = "0.6.6"
val kamonJdbc = "io.kamon" %% "kamon-jdbc" % kamonVersion
val kamonAutoweave = "io.kamon" %% "kamon-autoweave" % kamonVersion
val slick = Seq(
"com.typesafe.slick" %% "slick" % "3.2.0"
, "com.typesafe.slick" %% "slick-hikaricp" % "3.2.0"
)
kamon {
statsd {
hostname = "metrics"
port = 8125
flush-interval = 1 seconds
time-units = "ms"
subscriptions {
jdbc = [ "**" ]
}
}
@jairamc
jairamc / KamonJdbcExample.scala
Created March 30, 2017 13:21
KamonJdbcExample
import SampleDatabase._
import slick.jdbc.H2Profile.api._
import kamon.Kamon
import scala.concurrent.{Await, ExecutionContext, Future}
import scala.concurrent.duration._
@jairamc
jairamc / set-aws-credentials.py
Last active December 21, 2021 02:45
Simple python script to set AWS Credentials in your environment variables
#! /usr/bin/env python
###############################################################
# In your .bashrc/.zshrc add `eval $(python <path to script>)`
# Or simply run `eval $(python <path to script>)`
# This avoids adding your aws credentials to bash/zsh history
###############################################################
import os, sys
from ConfigParser import ConfigParser
@jairamc
jairamc / dockerfile-from-image
Created November 28, 2016 12:44
Build a Dockerfile from Image
#!/bin/bash
########################################################################################
# This will not build a full dockerfile, but will give a good hint to how it was build #
########################################################################################
docker history --no-trunc "$1" | \
sed -n -e 's,.*/bin/sh -c #(nop) \(MAINTAINER .*[^ ]\) *0 B,\1,p' | \
head -1
docker inspect --format='{{range $e := .Config.Env}}
@jairamc
jairamc / sbt-symbols.md
Last active October 8, 2016 11:11
Useful SBT symbols

:= sets a setting to a new value
+= appends a single value to a setting
++= appends a collection of values to a setting
<<= sets a setting to the value/result of another setting/context
<+= appends a single value/result of another setting/context to this setting
&lt;++= appends a collection of values/results of another setting/context to this setting