Skip to content

Instantly share code, notes, and snippets.

View kingster's full-sized avatar
🏠
Working from home

Kinshuk Bairagi kingster

🏠
Working from home
View GitHub Profile
@kingster
kingster / Option.java
Last active October 19, 2016 09:23
Try & Option in Java
package com.hivefive.ciphernod.scalaz;
import java.util.Collections;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java8.util.function.Function;
/**
* Created by kinshuk.bairagi on 20/02/16.
@kingster
kingster / swagger-cache.php
Created July 13, 2016 10:58
Swagger Cache
<?php
// Access-Control headers are received during OPTIONS requests
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
@kingster
kingster / cleanup-tags.sh
Created June 20, 2016 22:21
cleanup all git tags
#!/bin/bash
# This script will delete *all* local and remote tags from any git repo you run
# it in starting with "release"
#
# This script will not delete branches; just tags.
set -e
REMOTE='origin'
@kingster
kingster / tachyon.patch
Created November 17, 2015 22:09
Tachyon Path for Spark 1.4.1
Index: src/spark/sbin/start-master.sh
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/spark/sbin/start-master.sh (revision 3a38a61d8dafe1584992d10feb2dfb2154da911f)
+++ src/spark/sbin/start-master.sh (revision 652da5558b857355940906760e4112d8b7c2ce62)
@@ -34,6 +34,7 @@
exit -1
@kingster
kingster / bluetooth-agent.sh
Last active May 3, 2022 01:09
Raspberry PI Bluetooth Audio Player
### BEGIN INIT INFO
# Provides: bluetooth-agent
# Required-Start: $remote_fs $syslog bluetooth pulseaudio
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Makes Bluetooth discoverable and connectable to 0000
# Description: Start Bluetooth-Agent at boot time.
### END INIT INFO
#! /bin/sh
@kingster
kingster / HttpPipeline.scala
Created February 25, 2015 09:01
HttpPipeline Spark
package com.flipkart.marketing.bro.mouth.pipeline.http
import akka.actor.{ActorRef, Actor, Props}
import akka.serialization.Serialization
import com.flipkart.marketing.bro.commons.data.models.RawEvent
import com.flipkart.marketing.bro.mouth.akka.AkkaEngine
import com.flipkart.marketing.bro.mouth.pipeline.StreamSource
import org.apache.spark.streaming.StreamingContext
import org.apache.spark.streaming.dstream.InputDStream
import org.apache.spark.streaming.receiver.ActorHelper
@kingster
kingster / ssh-key-enable.sh
Last active August 29, 2015 14:07
SSH Bulk Key Adder
#!/bin/bash
if [ $# -eq 0 ];then
echo "$0 host-prefix{1..5}-postfix.domain.com"
exit 1;
fi;
echo "User : `whoami`"
echo -n "LDAP password: "
read -s password;
@kingster
kingster / apsd
Created August 12, 2014 19:14
APS Demon File
#!/bin/bash
# /etc/init.d/aps
#
# description: APE Daemon
# processname: APE Daemon
# author : me@kinshuk.in
# Define where ape is installed.
APE_DIRECTORY=/var/aps/APS-Deploy
@kingster
kingster / crt2keystore.sh
Created July 19, 2014 17:09
SSL Private Key To Java Keystore
#!/bin/bash
#create pksc12 file
openssl pkcs12 -export -in website.crt -inkey website.key -out website.p12 -name tomcat -CAfile ca.crt -caname root -chain
#create java keystore. [ You may change website.jks to keystore or any existing keystores you have]
keytool -importkeystore -srckeystore website.p12 -srcstoretype pkcs12 -destkeystore website.jks -deststoretype JKS
@kingster
kingster / jQuerySmartPoller.js
Last active December 23, 2020 05:38 — forked from defunkt/gist:158493
Jquery Smart Poller with Stop Support
/*
* a smart poller for jquery.
* (by github)
*
* simple example:
*
* $.smartPoller(function(retry) {
* $.getJSON(url, function(data) {
* if (data) {
* doSomething(data)