Skip to content

Instantly share code, notes, and snippets.

View durgeshm's full-sized avatar

Durgesh Mankekar durgeshm

View GitHub Profile
@plamb
plamb / gce_auth.ex
Last active December 9, 2020 14:31
Authenticate with Google Cloud using service account json key and Elixir
# https://developers.google.com/identity/protocols/OAuth2ServiceAccount
key_json = File.read!("some-service-account-key-file.json")
key_map = JOSE.decode(key_json)
jwk = JOSE.JWK.from_pem(key_map["private_key"])
jws = %{"alg" => "RS256"}
header = %{
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@staltz
staltz / introrx.md
Last active May 24, 2024 07:56
The introduction to Reactive Programming you've been missing
@arnabdas
arnabdas / example.html
Created August 1, 2013 08:13
Tri-State Checkbox in AngularJS
<!-- http://plnkr.co/edit/N98IKTcHoZMCs18FjSRF?p=preview -->
The directive assumes that the checkboxes array contains objects that have an isSelected property and a desc property.
<tri-state-checkbox checkboxes="listelements"></tri-state-checkbox>
or
<!-- http://plnkr.co/edit/PTnzedhD6resVkApBE9K?p=preview -->
If you prefer to have the directive only render the tri-stated checkbox, hence the individual checkboxes are in the HTML:
<tri-state-checkbox checkboxes="listelements" class="select-all-cb">
</tri-state-checkbox>select all
@mumoshu
mumoshu / run-play-app-in-console.scala
Created January 31, 2012 09:23
Run Play 2.0 app from Play console
// Thanks!
// http://voidy21.hatenablog.jp/entry/2012/01/09/024544
//
// Usage:
// Run `play console` and then :paste the below code
//
// Tested on commit 4727620693 of Play20 master, at Feb 6.
//
// Follow the below steps to enable play.api.test classes in Play console.
// $ set libraryDependencies += "play" %% "play-test" % "2.0-RC1-SNAPSHOT"
@naryad
naryad / CreateTwitterTable.java
Created July 23, 2011 11:09
Minimal implementation of twitter data layer using HBase
package hbase.sandbox;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HBaseAdmin;
@pamelafox
pamelafox / newtalk.html
Created May 23, 2011 18:31
Calculating timezone from city/country
<!DOCTYPE html>
<html">
<head>
<script src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
</head>
<body>
<h2 class="headline">New Talk</h2>
#!/usr/bin/env ruby
if ARGV.size < 2
$stderr.puts 'usage: monitor <path> <command> [arg1 arg2 ...]'
exit 100
end
PATH = ARGV[0]
COMMAND = ARGV[1]
ARGS = ARGV[2..-1]