Skip to content

Instantly share code, notes, and snippets.

Technowise /
Created Oct 12, 2016
Shell script to import all MongoDB json files in current folder to remote database
ls -1 *.json | sed 's/.json$//' | while read col; do
mongoimport --host --username john --password sample-password --db sample-db --collection $col --file $col.json
echo $cmd
Technowise /
Last active Nov 7, 2017
import mysql.connector
#CA Bundle file is provided on AWS documentation for RDS:
cnx = mysql.connector.connect(user='sequoia_usr_prod', password='iz8sVGk0TwYxKfJo',
database='sequoia_db_prod', ssl_ca=SSL_CA)
Technowise / validate_fb_auth_token.php
Created May 10, 2013
Validate Facebook Auth-Token. This helper function checks if the Facebook auth-token is valid, and belongs to the said facebook-id
View validate_fb_auth_token.php
// A helper function to validate Facebook Auth-Token.
// This checks if the Facebook auth-token is valid, and belongs to the said facebook-id
function is_facebook_auth_valid($facebook_token, $facebook_id)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
Technowise / play-framework-init.d-script
Created Jan 4, 2017
Play Framework init.d script - Run play application as service in Linux, so that you do not have to do a lot of manual stuff
View play-framework-init.d-script
#To use this script:
#1) Save this file with name of your app in /etc/init.d folder.
#2) Update the APP_NAME to the name of your application in build.sbt.
#3) Update the APP_PATH of the application to the path where you extracted your dist version/snapshot.
#4) Update the value of PORT to the port you would like your application to run on.
#5) Add this script as service using update-rc.d. (Example: sudo update-rc.d your-app defaults).
You can’t perform that action at this time.