Skip to content

Instantly share code, notes, and snippets.

@bshyong
bshyong / forge_compile_with_source.ts
Created July 21, 2024 03:29 — forked from ScreamingHawk/forge_compile_with_source.ts
Forge compile with source content
import { exec as execNonPromise } from 'child_process'
import { copyFile, mkdir, readFile, rm, writeFile } from 'fs/promises'
import { join } from 'path'
import util from 'util'
import {
BUILD_DIR,
DEPLOYABLE_CONTRACT_NAMES,
} from './constants'
const exec = util.promisify(execNonPromise)
@bshyong
bshyong / broadcast-channel.md
Created November 27, 2023 01:11 — forked from davestewart/broadcast-channel.md
Example of using BroadcastChannel to communicate with pages in the same domain

screenshot

Keybase proof

I hereby claim:

  • I am bshyong on github.
  • I am bshyong (https://keybase.io/bshyong) on keybase.
  • I have a public key ASBaKNlRicQO1-VBcEz5XZ8220YDdrNB0W8vnxRYPBldowo

To claim this, I am signing this object:

@bshyong
bshyong / Notes.md
Created November 24, 2015 02:57
Getting npm install to work on AWS Elastic Beanstalk
  1. Disable normal asset compilation
  2. Make sure npm is updated to 3.5.0
  3. Add commands to make sure #2 is done before app code is deployed
  4. Use container commands to do npm install and precompile assets
  commands:
  00_update_npm:
    command: "sh /tmp/install_node_npm.sh"
@bshyong
bshyong / sidekiq_cl.md
Last active August 29, 2015 14:23
sidekiq changelog
@bshyong
bshyong / bitcoin.md
Created June 25, 2015 20:14
bitcoinChangelog
@bshyong
bshyong / marks.json
Created December 20, 2014 05:39
stemmed tags
{
"wp platform": [
"wp-platform"
],
"mobil": [
"mobile",
"Mobile"
],
"go": [
"go"
@bshyong
bshyong / wiki_description.rb
Last active October 17, 2015 03:05
Quick scraper to fetch first paragraph of Wikipedia for a list of topics
require 'open-uri'
require 'nokogiri'
require 'csv'
require 'cgi'
# BASE_URL = 'http://en.wikipedia.org/w/api.php?format=json&action=query&prop=revisions&rvprop=content&titles='
BASE_URL = 'http://en.wikipedia.org/wiki/'
while($input_filename.nil?)
puts "Enter input filename (should be a CSV)"
@bshyong
bshyong / python_bst.py
Last active March 11, 2021 23:09
Python BST implementation
class BSTnode(object):
"""
Representation of a node in a binary search tree.
Has a left child, right child, and key value, and stores its subtree size.
"""
def __init__(self, parent, t):
"""Create a new leaf with key t."""
self.key = t
self.parent = parent
self.left = None
@bshyong
bshyong / gist:6257817
Last active December 21, 2015 05:38
Bash script to pull Heroku DB to local environment - note that this creates a manual backup via heroku pgbackups:capture
#!/bin/bash
# call command with bash pull_production_to_local
function LastBackupName () {
heroku pgbackups --app APPNAME | tail -n 1 | cut -d " " -f 1
}
heroku pgbackups:capture --expire --app APPNAME
new_backup=$(LastBackupName)