Skip to content

Instantly share code, notes, and snippets.

View AaronGoldsmith1's full-sized avatar
🎯
Focusing

Aaron Goldsmith AaronGoldsmith1

🎯
Focusing
  • Los Angeles, CA
View GitHub Profile
@DaveBitter
DaveBitter / setAsyncTimeout.js
Last active October 10, 2022 22:44
Async implementation of the setTimeout function
const setAsyncTimeout = (cb, timeout = 0) => new Promise(resolve => {
setTimeout(() => {
cb();
resolve();
}, timeout);
});
// Instead of nesting setTimeout functions...
const doStuff = () => {
setTimeout(() => {
@samir64
samir64 / Behavior.js
Last active March 1, 2019 22:42
Javascript (ES5) Class
'use strict';
/**
* @param {string} behavior
*/
Behavior = Class.extend({
init: function (behavior) {
this.super();
Object.defineProperty(this, "Behavior:" + behavior, {
@bretton
bretton / improved-lnd-bitcoind-mainnet.md
Last active June 26, 2024 16:08
Detailed guide to installing LND and Bitcoind on Ubuntu 16.04 LTS for Mainnet

Intro

This guide is specific to getting LND 0.5-beta and Bitcoind running on Ubuntu 16.04 LTS for mainnet. It is aging rapidly and includes steps not necessary on newer versions of LND. As of April 2021 it is very out of date for bitcoind. As of December 2021 it is outdated for LND too.

Original installation guide:

This guide is broken into the following sections:

  • Install bitcoind and set to start automatically
  • Install development tools and dependancies
@tatemz
tatemz / docker-wordpress.sh
Last active December 29, 2020 17:25
A quick way to get a WordPress installation up and running with Docker
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
version: "2"
services:
my-wpdb:
module.exports = {
up: function (queryInterface, Sequelize) {
return [
queryInterface.addColumn('User', 'name', {
type: Sequelize.STRING
}),
queryInterface.addColumn('User', 'nickname', {
type: Sequelize.STRING,
})
];
@stevengoldberg
stevengoldberg / bst.js
Last active March 16, 2020 13:02
ES6 functions for manipulating a Binary Search Tree
/*
* Based on the work of Nicholas C. Zakas
* https://github.com/nzakas/computer-science-in-javascript/
*/
class Node {
constructor(value = null, left = null, right = null) {
this.value = value;
this.right = right;
this.left = left;
@ashish01
ashish01 / gist:2a4a0f9b525096633ca2
Created December 18, 2014 22:01
python-flask-google-oauth-example.py
import json
from flask import Flask, url_for, redirect, session
from flask_login import (UserMixin, login_required, login_user, logout_user, current_user)
from flask_googlelogin import GoogleLogin
users = {}
app = Flask(__name__)
@alexhawkins
alexhawkins / nativeJavaScript.js
Last active April 28, 2024 08:52
Implementation of Native JavaScript Methods (forEach, Map, Filter, Reduce, Every, Some)
'use strict';
/*****************NATIVE forEACH*********************/
Array.prototype.myEach = function(callback) {
for (var i = 0; i < this.length; i++)
callback(this[i], i, this);
};
//tests
anonymous
anonymous / cryptovisual_qr_encoder
Created August 7, 2014 18:07
create two random-looking images that reveal a QR code when superposed
#!/bin/bash
# This script reads text from stdin, generates its QR code and splits it into two visual cryptographic images. Both images appear random and have as many whites as blacks. Only when print on transparent film (or extremely thin paper) and superposed, the ciphered qrcode appears as gray/black dots.
# We use the program "qrencode" to generate a QR at an average 7% error-correction rate ("low" quality; the lowest available). We create then a random array and we visual-XOR it with the QR code to retrieve the ciphered code. Only the random array (nonce or one-time pad) and the ciphered array are recorded, and only when both are superposed they reveal the QR code.
# The visual-cryptographic scheme used is inspired of http://leemon.com/crypto/VisualCrypto.html . It transforms 0s and 1s into diagonal 2x2 squares (01\10 and 10\01). The visual XOR either repeats (gray superposition; corresponding to a white dot) or flips (black superposition; corresponding to a black dot), following the QR code.
# Security
@scturtle
scturtle / app.py
Created April 14, 2013 04:53
Flask login with google+ oauth
from flask import Flask, request, session, redirect, url_for
import urllib
import requests
app = Flask(__name__)
app.secret_key = 'iwonttellyou'
redirect_uri = 'http://localhost:5000/callback'
client_id = '' # get from https://code.google.com/apis/console
client_secret = ''