Skip to content

Instantly share code, notes, and snippets.

Working from home

suhail suhailvs

Working from home
View GitHub Profile
suhailvs / IndexedDB101.html
Last active Apr 16, 2020 — forked from JamesMessinger/IndexedDB101.js
Very Simple IndexedDB Example
View IndexedDB101.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8" />
<!-- -->
<output id="printOutput"></output>
faelp22 /
Last active Sep 3, 2020
Python3 SimpleHTTPServer for Static Serving (VueJS/ React / Angular / Ember) in HTML5 mode (a la mod_rewrite)
#!/usr/bin/env python
Based on
import os
from http.server import HTTPServer, SimpleHTTPRequestHandler
from urllib.parse import urlparse
johncantrell97 /
Last active Jan 9, 2022
How I Obtained Satoshi's Treasure Keys 1, 2, and 3 in Minutes

Today (April 16th 2019 at noon) the first major clues to discover key #1 was set to be released in a few cities. A QR code with the words 'orbital' were found at these locations and looked like this: ( If you read the QR code with your phone you will be directed to this url:

At this URL you are prompted to input a passphrase to decrypt the first shard. An obvious first guess was to try the word 'orbital' from the QR code. Not suprisingly this worked! This reveals a congratulations page and presents the first key shard:


Now, we were supposed to wait until April 17th to get clues from the other cities for keys #2 and #3 but that wouldn't stop me from digging around with all the new information we had. All that time "playing" notpron ( years ago was going to help me here.

The first thing I noticed was

Toilal / api.module.ts
Last active May 14, 2021
@auth0/angular2-jwt Authorization Service and HttpInterceptor supporting JWT Refresh Token (Angular 4.3+ & 5+)
View api.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { JWT_OPTIONS, JwtInterceptor, JwtModule } from '@auth0/angular-jwt';
import { AuthorizationService } from './authorization.service';
import { environment } from '../../environments/environment';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { RefreshTokenInterceptor } from './refresh-token-interceptor';
function jwtOptionsFactory (authorizationService: AuthorizationService) {
return {
AtulKsol /
Last active Jan 22, 2022
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:


subfuzion /
Last active Jan 24, 2022
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

JamesMessinger / IndexedDB101.js
Last active Jan 27, 2022
Very Simple IndexedDB Example
View IndexedDB101.js
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open ="MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});

Much nicer solution can be used for any stackexchange sites::: First, go to any other stackexchange sites) then define this in your Javascript console(Press F12):

function minec(){ 
  $.getJSON('/unicoin/rock',function(data) {
      .done(function( data ) {
0xdevalias /
Last active Aug 29, 2015
A quick little hack to automagically mine unicoins ( April Fools 2014) <3 /dev/alias (

First, go to then define this in your Javascript console:

var hackMeSomeUnicoins = function(myFkey) {
  console.log("Ok, let's hack you some shiny unicoins! <3 /dev/alias (")
  console.log("The powers that be say you can only mine a rock every 10sec, so we do it every 11sec to be sure.")
    $.get( "", function( data ) {
      var rockId = data.rock;
      $.post( "" + rockId, { fkey: myFkey })
      .done(function( data ) {
suhailvs /
Last active Aug 29, 2015
Openshift python -2.7, django-1.6 example

Steps to create in OPENSHIFT

  1. Create a Python27 app in Openshift

create a python2.7 application in openshift

if you still don't uploaded the ssh publickey to openshift, then doit: