Skip to content

Instantly share code, notes, and snippets.

View harryi3t's full-sized avatar
👻
Just do it

Harendra Singh harryi3t

👻
Just do it
  • Rippling
  • Bangalore
View GitHub Profile
@harryi3t
harryi3t / chrome-default-window-properties.js
Created May 11, 2019 17:13
Default Properties In chrome window object
[
"postMessage",
"blur",
"focus",
"close",
"parent",
"opener",
"top",
"length",
"frames",
@harryi3t
harryi3t / export-transactions-from-budgetbakers-wallet.js
Last active January 24, 2022 06:55
Exports data from wallet web app by budgetbakers
// Wallet is a great app to track your expenses
// I just didn't want to buy premium subscription just to export my own data :shrug:
// First follow this gist to export all the data in indexeddb to console
// https://gist.github.com/harryi3t/d8779d3c0c0c4d41c37fdde81b268fd3
// I will be assuming from here on that the the entire data is in a variable `data`
// All the transactions are store in the table 'by-sequence'
let sequence = data[2]['by-sequence'];
@harryi3t
harryi3t / export-indexeddb.js
Last active December 20, 2023 06:16
Exports a indexeddb from any website
// Use the latest version of your web-browser
// Tested on chrome 72
// A function to inject scripts in the current webpage
async function injectScript (url) {
return new Promise((resolve) => {
let script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.onload = function(){
@harryi3t
harryi3t / html-to-markdown-browserfied.js
Created January 17, 2019 04:04
html-to-markdown-browserfied
This file has been truncated, but you can view the full file.
require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
module.exports = {
trueFunc: function trueFunc(){
return true;
},
falseFunc: function falseFunc(){
return false;
}
};
},{}],2:[function(require,module,exports){
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
@harryi3t
harryi3t / foo.txt
Created September 29, 2018 07:17
foo
hello
@harryi3t
harryi3t / postman-oauth2-refresh-token.js
Created September 20, 2018 18:23
This gist shows how using the pre-request script in Postman, a new Oauth-2 token can be obtained using the a refresh token
/**
** Postman as of the date of this writing does not support auto-refreshing of Oauth-2 tokens.
** This is an exmaple on how in one can refresh their Oauth-2 tokens just using the pre-request scripts.
** Pre-requisites: You need to have a refresh token. You can use the Postman app to get one.
**/
// Set all these variables in an environment or at collection level
let tokenUrl = pm.variables.get('tokenUrl'),
clientId = pm.variables.get('clientId'),
clientSecret = pm.variables.get('clientSecret'),
@harryi3t
harryi3t / benchmark.js
Created March 7, 2018 11:23
Quickly benchmark js code
var Benchmark = require('benchmark'),
suite = new Benchmark.Suite;
var x = new Array(20).fill(0);
// add tests
suite.add('test 1', function() {
// your code here
})
suite.add('test 2', function() {
@harryi3t
harryi3t / update-slack-status-on-lock-events
Created January 10, 2017 10:59
set the slack status as away on screen lock and back to active on screen unlock
#/bin/bash
TOKEN='put your token here. Get a new from https://api.slack.com/docs/oauth-test-tokens'
dbus-monitor --session type='signal',interface='com.canonical.Unity.Session' | while true
do
read x
if echo "$x" | grep -q Locked; then
echo "set yourself away at $(date)"
curl -X GET -H "Cache-Control: no-cache" "https://slack.com/api/users.setPresence?token=$TOKEN&presence=away"
@harryi3t
harryi3t / shippable_eslintrc
Last active April 16, 2017 06:43
Javascript standards at Shippable
module.exports = {
"env": {
"browser": true
},
"plugins": [
"callback-function"
],
"globals": {
"__dirname": true,
"_": true,