Skip to content

Instantly share code, notes, and snippets.

@shabin-slr
shabin-slr / README.md
Created August 17, 2016 15:28 — forked from ajcrites/README.md
Minimal AngularJS + AMD (require.js) loading plus `r.js` optimization.

Simple AngularJS + require.js "optimizable" project

NOTE: gists do not allow directories, so / cannot be included in filenames. Instead, - is used in this project. That is to say public-index.html should actually be read as public/index.html relative to the root of the project.

This is a very stripped down seed project for AngularJS-based code that is loaded via the require.js AMD and optimized via r.js

Inspired by:

@shabin-slr
shabin-slr / Some_git_commands.txt
Created October 6, 2016 03:49
Some Git Commands
#Show Remote of current branch
#Reference : http://stackoverflow.com/questions/171550/find-out-which-remote-branch-a-local-branch-is-tracking
git branch -vv
#Create local branch from remote
#http://stackoverflow.com/a/1787014/3370859,
#eg. : "git checkout test", will create local branch test from origin/test
git checkout <branch name without /origin>
#Delete a local branch

Step by step to install Scala + Play Framework in Ubuntu 14.04 with Activator.

Install Scala

sudo apt-get remove scala-library scala
wget http://www.scala-lang.org/files/archive/scala-2.11.6.deb
sudo dpkg -i scala-2.11.6.deb
sudo apt-get update
sudo apt-get install scala
@shabin-slr
shabin-slr / installActivator.sh
Created March 14, 2017 13:59 — forked from mslinn/installActivator.sh
Installs Lightbend Activator on Ubuntu and Cygwin
#!/bin/bash
# From ScalaCourses.com Introduction to Play Framework with Scala course
# https://www.scalacourses.com/student/showLecture/158
set -eo pipefail
function help {
echo "Download or update Typesafe Activator on Linux and Cygwin"
echo "Usage: $(basename $0) [options]"
Base URL : "https://graph.facebook.com/v2.9"
1. Login API
GET "/dialog/oauth?client_id=<CLIENT ID>&redirect_uri=<REDIRECT URI>&scope=<COMMA SEPERATED SCOPES eg public_profile>";
RESPONSE "GET REQUEST ON CALLBACK URL WITH QUERY PARAM 'CODE' "
2. Get access_token for user with 'CODE' parameter
GET "/oauth/access_token?client_id=<CLIENT ID>&redirect_uri=<REDIRECT URI SAME AS ABOVE>&client_secret=<CLIENT SECRET>&code=<CODE RECEIVED IN EARLIER STEP>"
RESPONSE "JSON object containing access_token"
@shabin-slr
shabin-slr / REST_Client.js
Last active August 3, 2017 11:15
An HTTPS REST client for NodeJS apps.
const https = require('https');
/**
*
* @param {String} host eg. : 'graph.facebook.com'
* @param {String} endPoint
* @param {String} method eg. : 'GET', 'POST' etc
* @param {Object} requestOptions = {
* @param {Object} headers eg. : {'Content-Type' : 'application/json'}
* @param {String} body eg. : 'Request body'
@shabin-slr
shabin-slr / gist:6ecb73a6d8334edf96dce246afefec32
Last active November 29, 2018 08:53
Mongo Dump/Restore Commands
Mongo Dump
----------
mongodump --host <HOST> --port <PORT> -d <DB NAME> --username <USERNAME> --password <PASSWORD> --out <PATH TO DUMP TO eg ./> --gzip
Mongo Restore
-------------
mongorestore -d <DESTINATION DB NAME> --host <HOST> --port <PORT> --username <USERNAME> --password <PASSWORD> <PATH TO DUMP FOLDER eg ./dump/$DBNAME>
var findNodes = async function(styleClass="k4xni2cv"){
var elem = document.getElementsByClassName("k4xni2cv");
if(elem.length === 1){
elem = elem[0];
elem.scrollTop = elem.scrollHeight;
await new Promise(resolve => setTimeout(resolve, 5000));
_2020DesignParser();
}
}
@shabin-slr
shabin-slr / eSieve.js
Created January 15, 2019 13:26
Simple implementation of Sieve of Eratosthenes (eSieve) in JavaScript
// https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
var eSieve = function(limit){
var numbers = [];
for(let i = 2; i <= limit; ++i){
numbers.push({
value : i
});
};
# Jenkins connect container docker client to host docker daemon
#1 Copy docker client to container's /usr/bin
docker cp <docker client path> local-jenkin:/usr/bin/
#2 Create volume mapping from host docker daemon's socket to client
docker run -u root --name local-jenkin -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jenkins/jenkins:lts