Skip to content

Instantly share code, notes, and snippets.

View royseto's full-sized avatar

Roy Seto royseto

  • San Francisco
  • 16:49 (UTC -07:00)
  • LinkedIn in/royseto
View GitHub Profile
# Adapted from https://gist.github.com/kees-jan/5768479
# Install oh-my-zsh first: see https://ohmyz.sh/#install
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \
git clone git://github.com/andsens/homeshick.git $HOME/.homesick/repos/homeshick && \
source $HOME/.homesick/repos/homeshick/homeshick.sh && \
homeshick -b clone https://github.com/royseto/dotfiles.git && \
homeshick -f link && \
source $HOME/.zshrc
const functions = require('firebase-functions');
const { App } = require('@slack/bolt');
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET
});
// Listens to incoming messages that contain "hello"
app.message('hello', ({ message, say }) => {
@royseto
royseto / indent_sql.el
Last active February 3, 2019 22:23 — forked from stuntgoat/indent_sql.el
An indentation heuristic for Emacs' sql-mode
(defun get-previous-indentation ()
"Get the column of the previous indented line"
(interactive)
(save-excursion
(progn
(move-beginning-of-line nil)
(skip-chars-backward "\n \t")
(back-to-indentation))
(current-column)))
@royseto
royseto / start-tensorflow.sh
Created November 12, 2017 20:06
Run a tensorflow notebook
# https://hub.docker.com/r/tensorflow/tensorflow/
docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow:latest-py3
@royseto
royseto / Dockerfile
Last active June 5, 2016 23:08
Docker beta13.1 issue with named volume persistence
FROM busybox
RUN /bin/mkdir -p /mnt/data && /bin/touch /mnt/data/hello.txt
VOLUME ["/mnt/data"]
#!/bin/bash
fpm -s dir -t deb -n postgres9.4.1-postgis2.1.5 -v 9.4.1-2.1.5-local1 \
-d build-essential -d libreadline-dev -d zlib1g-dev -d flex \
-d bison -d libxml2-dev -d libxslt-dev -d libssl-dev -d wget \
--description "PostgreSQL 9.4.1 with PostGIS 2.1.5 built on Ubuntu 14.04 in /usr/local/" \
-x /usr/local/bin/fpm -x /usr/local/lib/python3.4 -x /usr/local/lib/site_ruby \
/usr/local/bin /usr/local/include /usr/local/lib /usr/local/pgsql /usr/local/share
@royseto
royseto / parallel.log
Created October 25, 2015 14:45
suspected_parallel_bug_with_slot_numbers_and_eta
➜ tmp seq 1 10 | parallel -j4 --eta echo '{%} {}'
Computers / CPU cores / Max jobs to run
1:local / 16 / 4
Computer:jobs running/jobs completed/%of started jobs/Average seconds to complete
ETA: 0s Left: 10 AVG: 0.00s local:4/0/100%/0.0s 1 1
ETA: 0s Left: 9 AVG: 0.00s local:4/1/100%/0.0s 2 2
ETA: 0s Left: 8 AVG: 0.00s local:4/2/100%/0.0s 3 3
ETA: 0s Left: 7 AVG: 0.00s local:4/3/100%/0.0s 4 4
roysetosmacbook:~ royseto$ cd 'VirtualBox VMs/boot2docker-vm'
roysetosmacbook:boot2docker-vm royseto$ pwd
/Users/royseto/VirtualBox VMs/boot2docker-vm
roysetosmacbook:boot2docker-vm royseto$ ls -lh
total 80549936
drwx------ 6 royseto staff 204B Aug 1 10:00 Logs
drwx------ 2 royseto staff 68B Aug 1 10:01 Snapshots
-rw------- 1 royseto staff 8.4K Aug 13 08:09 boot2docker-vm.vbox
-rw------- 1 royseto staff 8.4K Aug 1 10:01 boot2docker-vm.vbox-prev
-rw------- 1 royseto staff 38G Aug 13 08:09 boot2docker-vm.vdi
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Prototype for transforming a set of time intervals with arrival and departure
# timestamps into utilization by hour
library(lubridate)
# Period start and end
period_start <- ymd("2015-04-01")
period_end <- ymd("2015-05-01")