Skip to content

Instantly share code, notes, and snippets.

View cskonopka's full-sized avatar
📺
stuck inside a television

Christopher Konopka cskonopka

📺
stuck inside a television
  • vondas-network
  • Boston, MA
  • Instagram cskonopka
View GitHub Profile
@kentbrew
kentbrew / node-on-ec2-port-80.md
Last active February 4, 2024 19:14
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

}).listen(80);
@deekayen
deekayen / 1-1000.txt
Last active June 26, 2024 14:19
1,000 most common US English words
the
of
to
and
a
in
is
it
you
that
@fipar
fipar / panic-recover.go
Created November 28, 2012 21:45
Basic example of panic / recover use in golang
package main
import (
"fmt"
"time"
)
func mainLoop() {
fmt.Println("starting main loop, this will die after dividing by 0")
i := 0
@kevincennis
kevincennis / bounce.js
Created July 13, 2013 02:17
Bounce an AudioBuffer to WAV with RecorderWorker.js
// assuming you have an AudioBuffer instance called `buffer`,
// and an AudioContext (or OfflineAudioContext) called `ctx`...
// create a new Worker...
var worker = new Worker('recorderWorker.js');
// get it started and send some config data...
worker.postMessage({
command: 'init',
@wh1tney
wh1tney / deploy-static-site-heroku.md
Last active June 24, 2024 20:17
How to deploy a static website to Heroku

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.

Basic Assumptions

@bitcity
bitcity / gist:d57440ca4240525439c1
Last active October 4, 2021 06:21
Average frame colors of a movie into a single image
ffmpeg -i <your movie file> -vf scale=1:1 <output folder>/%06d.png
convert +append <output folder>/* out.png
mogrify -scale x50\! out.png
Credit : https://www.reddit.com/r/dataisbeautiful/comments/3rb8zi/the_average_color_of_every_frame_of_a_given_movie/cwmn4q2
@arxdsilva
arxdsilva / working_directory.go
Last active February 12, 2024 13:30
How to get the current working directory in golang
package main
// More info on Getwd()
// https://golang.org/src/os/getwd.go
//
import(
"os"
"fmt"
"log"
)
@shashankmehta
shashankmehta / setup.md
Last active January 7, 2024 11:57
Setup PHP and Composer on OSX via Brew

First install Brew on your MAC

  • Setup Brew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • Install PHP 7.0.+ brew install php70
  • Install mcrypt: brew install mcrypt php70-mcrypt
  • Finally, install composer: brew install composer
@nikhita
nikhita / update-golang.md
Last active June 28, 2024 03:14
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

@bolerap
bolerap / alpine_proxy_setting.md
Created September 11, 2017 08:13
Setting proxy for alpine linux
  1. create a file to keep environment variables (called env.sh here) at /etc/profile.d/env.sh
  2. export two proxy variable in /etc/profile.d/evn.sh as below
export http_proxy=http://<ip/name>:<port>
export https_proxy=$http_proxy