Skip to content

Instantly share code, notes, and snippets.

View amslezak's full-sized avatar

Andy Slezak amslezak

View GitHub Profile
@amslezak
amslezak / find process using port PID
Last active January 24, 2020 22:15
find process using port (PID)
lsof -t -i :PORT_NUMBER
@amslezak
amslezak / haproxy.cfg
Last active January 8, 2022 16:55
Example HAProxy 1.6+ config for serving static content from AWS S3 bucket
# This config will serve up: http://<haproxy>/foo/index.html
#
# This post was indispensable
# https://stackoverflow.com/questions/39964607/haproxy-forward-request-to-s3-hosted-site
global
#debug # Uncomment this line to debug and then comment out daemon
daemon
maxconn 256
@amslezak
amslezak / for-await-of.js
Last active December 8, 2018 03:06
simple for-await-of snippet/example
// for await of
const fetch = require('node-fetch')
const urls = [
'https://swapi.co/api/people/1',
'https://swapi.co/api/people/2',
'https://swapi.co/api/people/3',
'https://swapi.co/api/people/4',
]
// For Visual Studio Code
// Add code below to ~/.zshrc or ~/.bashrc file
// for clicking the red box and bringing up file in question in vscode
export PATH=$PATH:/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin
export REACT_EDITOR=code
// https://stackoverflow.com/questions/30093997/how-to-edit-react-native-tools

Keybase proof

I hereby claim:

  • I am amslezak on github.
  • I am aslezak (https://keybase.io/aslezak) on keybase.
  • I have a public key ASC7TfAC5dAZs4dQ2-EfusyR778i493PoTMTIm-4CC_lwwo

To claim this, I am signing this object:

@amslezak
amslezak / index.html
Created January 17, 2017 17:09
twitch api (bluebird) working
<a href="#" class='hi' onClick="$('.hidden').removeClass('hidden')">show all</a> / <a href="#" onClick="$('.online').addClass('hidden');$('.offline').removeClass('hidden')">offline</a> / <a href="#" onClick="$('.offline').addClass('hidden');$('.online').removeClass('hidden')">online</a>
<p></p>
<div class="yo"></div>
@amslezak
amslezak / gist:dbecd23215a6be215e71edb19337f341
Last active January 24, 2020 22:15
basic key/value object loop pattern
json.forEach(function(val){
var keys = Object.keys(val);
console.log(keys)
html += "<div class='cat'>"
keys.forEach(function(key) {
html += "<strong>" + key + "</strong>: " +val[key]+ "<br>";
});
html += "</div><br>"
})
@amslezak
amslezak / lodash_map_filter.js
Created May 25, 2016 02:54
map filter lodash 4 example
var _ = require('lodash');
var users = [
{id: 1, name: "Nelson", roles: ["admin"]},
{id: 5, name: "Mike", roles: ["admin"]},
{id: 2, name: "Andy", roles: ["registered, moderator"]},
{id: 3, name: "Dan", roles: [""]},
{id: 4, name: "Tim", roles: ["moderator"]},
]
@amslezak
amslezak / cloud9_ide
Last active May 16, 2022 12:26
make cloud9 IDE a native mac app
npm install nativefier -g
curl -sL https://github.com/c9/core/raw/master/build/osx/c9.icns > c9.icns
nativefier --app-name "Cloud9 IDE" --icon c9.icns --conceal --overwrite https://ide.c9.io/[user-name]/[workspace-name]
@amslezak
amslezak / gmail_sidekick_hide.css
Last active January 21, 2016 18:32
Hide Sidekick crap in gmail (with stylebot)
/* Remove Sidekick */
#signals-label > div.UKr6le.aio, div.LrBjie.inboxsdk__navMenu, #signals-label {
display: none;
}
/* Clean up top right bar */
#gb > div.gb_Sd.gb_Me > div.gb_9a.gb_Me.gb_R.gb_Le.gb_T > div.gb_8b.gb_Me.gb_R > div.gb_gc.gb_Vc.gb_R.gb_hc {
display: none;
}