Skip to content

Instantly share code, notes, and snippets.

@Technowise
Technowise / cowin_schedule_v3.js
Last active May 17, 2021 — forked from debarko/cowin_schedule_district_wise.js
Get an update on console as soon as a slot opens up in https://selfregistration.cowin.gov.in/ . Login to the website and then run this script on Console.
View cowin_schedule_v3.js
// This script will alert you whenever some slot opens up on the given date within the given pincodes
// Change the pincodes to your needs as per your city
// Optionally: the next_days variable can be set to number of days it has to check. (If you set to 3, will check for next three days.)
// How To setup Video -> https://www.youtube.com/watch?v=3_N5FFegtI4
// Steps to use
// 1. Update Config
// 2. Login to https://selfregistration.cowin.gov.in/
// 3. Rigt Click on the website
View Connecting-to-RDS-using-SSL-in-Python.py
import mysql.connector
#CA Bundle file is provided on AWS documentation for RDS: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html
#Link: https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem
SSL_CA='rds-combined-ca-bundle.pem'
cnx = mysql.connector.connect(user='db-user', password='xxxx',
host='xxxx.xxxx.us-west-2.rds.amazonaws.com',
database='db-user', ssl_ca=SSL_CA)
cnx.close()
@Technowise
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
#!/bin/bash
#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).
#
APP_NAME="your-app-name"
@Technowise
Technowise / shell-script-import-all-mongo-db-json-files-from-folder-to-remote-server.sh
Created Oct 12, 2016
Shell script to import all MongoDB json files in current folder to remote database
View shell-script-import-all-mongo-db-json-files-from-folder-to-remote-server.sh
ls -1 *.json | sed 's/.json$//' | while read col; do
mongoimport --host sample-mongodb-host.com --username john --password sample-password --db sample-db --collection $col --file $col.json
echo $cmd
done
@Technowise
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
<?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();
$url="https://graph.facebook.com/me?access_token=".$facebook_token;
curl_setopt($ch, CURLOPT_URL,$url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);