Skip to content

Instantly share code, notes, and snippets.

View echojc's full-sized avatar

Jonathan Chow echojc

View GitHub Profile
@echojc
echojc / listen.py
Created May 23, 2013 03:58
Quick 'n' dirty Python script to listen on a port and do nothing with the connection, simulating a server that allows you to connect but does not reply.
#!/usr/bin/python
import socket
import sys
if (len(sys.argv) != 2 or not sys.argv[1].isdigit()):
print 'Usage: listen <port>',
exit()
p = int(sys.argv[1])
l = []
package main
import (
"fmt"
"log"
"sort"
)
func main() {
test1 := []string{
@echojc
echojc / aoc-2021-23.go
Created December 23, 2021 21:59
Interactive tool for manually solving the puzzle
package main
import (
"fmt"
"os"
"github.com/nsf/termbox-go"
)
func main() {
package main
import (
"fmt"
)
func main() {
p1, p2 := 4, 8
p1Score, p2Score := 0, 0
@echojc
echojc / aoc-2021-19.go
Created December 19, 2021 23:13
My solution for Day 19 of Advent of Code 2021.
package main
import (
"fmt"
"log"
"math"
"strings"
)
// ScanResult is just a type alias - we treat this as a set
@echojc
echojc / aoc-2021-14.go
Last active December 14, 2021 06:42
Algorithm for Day 14 of Advent of Code 2021
package main
import (
"fmt"
)
type Output struct {
Pair1, Pair2 string
NewElement string
}
@media print {
a {
text-decoration: none;
}
a::after {
display: none;
content: '';
}
{
init: function (elevators, floors) {
const floor_up_pressed = {};
const floor_down_pressed = {};
floors.forEach(floor => {
const f = floor;
f.on('up_button_pressed', () => {
floor_up_pressed[f.floorNum()] = true;
});
<!doctype html>
<html>
<head>
<title>vim demo</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet">
<style>
html,
body {
height: 100%;
@echojc
echojc / prototyping-area-0.txt
Created November 27, 2016 12:45
Stoked that I hacked together a rudimentary Simon Says game in Shenzhen I/O! http://puu.sh/sw3gW/107bebc92d.png
[name] simon says
[puzzle] SzSandbox
[traces]
......................
..154.....1555554.....
......14..1555D54.15C.
...94.154..14.2...1CA.
..16...14..955555556A.
.....1414.161414....A.