Skip to content

Instantly share code, notes, and snippets.

@porterjamesj
porterjamesj / timelens.rb
Created August 14, 2019 04:02
Homebrew formula for timelens (timelens.io)
class Timelens < Formula
desc "Timelens command-line client"
homepage "https://timelens.io"
url "https://github.com/timelens/timelens/archive/0.1.1.tar.gz"
sha256 "b7777d655945c3ee52909efcc6d38029a6db12438ae2aa4616291f04f1f776b1"
depends_on "rust" => :build
depends_on "gstreamer"
depends_on "gst-plugins-base"
depends_on "gst-plugins-good"
@porterjamesj
porterjamesj / three.jl
Last active December 15, 2018 12:48
Advent of Code day 3 (https://adventofcode.com/2018/day/3) solution in Julia (https://julialang.org/)
function count_overclaims(claims)
fabric = zeros(1000, 1000)
for claim in claims
claimed_area = view(
fabric,
claim[:x]+1:claim[:x]+claim[:width],
claim[:y]+1:claim[:y]+claim[:height],
)
claimed_area .+= 1
end
-----------------------------------------------------
2017/09/25 03:15:10.559235 s3.DEBUG {
Bucket: "locker",
Key: "playlist_test/【Silent Siren】「八月の夜」MUSIC VIDEO full ver.【サイレントサイレン】-TuRm1JzAsVg.mp4.part",
UploadId: "2~g-5U_pGnYJrH_6i6AQZKJDgFxoQ9ZBa"
}
2017/09/25 03:15:10.559409 s3.DEBUG {
Body: buffer(0xc42120b0c0),
Bucket: "locker",
Key: "playlist_test/【Silent Siren】「八月の夜」MUSIC VIDEO full ver.【サイレントサイレン】-TuRm1JzAsVg.mp4.part",
@porterjamesj
porterjamesj / sqlalchemy_test.py
Last active January 22, 2017 17:29
Demonstration that SQLAlchemy doesn't facilitate the first bug described in http://kevinmahoney.co.uk/articles/django-orm-mistakes/
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import Column, Integer, create_engine
Base = declarative_base()
class Thing(Base):
__tablename__ = "thing"
g
g
g
quuz
az
5
quuz
6
@porterjamesj
porterjamesj / fix-venv.sh
Created October 2, 2016 22:10 — forked from pv8/fix-venv.sh
Fix virtualenv symlinks after upgrading python with Homebrew and running brew cleanup
#!/usr/bin/env bash
#
# Fix virtualenv symlinks after upgrading python with Homebrew and then running
# `cleanup`.
#
# After upgrading Python using Homebrew and then running `brew cleanup` one can
# get this message while trying to run python:
# dyld: Library not loaded: @executable_path/../.Python
# Referenced from: /Users/pablo/.venv/my-app/bin/python
# Reason: image not found

Code Review

A consolidation of advice and stuff from the internet

What is code review?

Code review one person reading over another's code and offering comments, suggestions, and feedback about how it could be improved. Often this is done at companies or in open source projects as a required step before proposed changes can be merged into a

i feel like all of those things are intended to be used in larger programs
so like, you could fit them into a smaller algorithm problem, but they
yeah?
so like, read the bit on transducers, and then implement one that
does a caeser cipher
and then getting more ambitious you could do stuff like more
complex encryption, or compression, or whatever
@porterjamesj
porterjamesj / how_to_learn_git.md
Last active April 6, 2017 17:34
How to learn Git

Before doing any of this, remember that no learning method is perscriptive and will work for all people. This approach was very effective for me, it might not work as well for you! Modify or use parts of it as you see fit. I recommend spending several days going through the steps outlined below. It might seem like a large amount of time to spend not making progress on anything else, but you will have a much better understanding of git afterwards, and this will pay huge dividends in time.

  1. Start reading the Pro Git Book (https://git-scm.com/book/en/v2).
  • If you've never used version control, there will be some stuff at the beginning about comparisons between git and other version control systems that might not make sense to you. Feel free to just ignore this, it's not important.
  1. After you have git installed and have learned about git init, make a practice repository with a bit of content you wouldn't actually mind losing (e.g. a few small text files you just type something silly into). For example,
package main
import (
"errors"
"fmt"
"github.com/docker/go-p9p"
"golang.org/x/net/context"
"log"
"net"
"time"