Skip to content

Instantly share code, notes, and snippets.

View jbenet's full-sized avatar

Juan Benet jbenet

View GitHub Profile
@jbenet
jbenet / If.txt
Created September 18, 2012 05:53
If–, by Rudyard Kipling
If you can keep your head when all about you
Are losing theirs and blaming it on you;
If you can trust yourself when all men doubt you,
But make allowance for their doubting too:
If you can wait and not be tired by waiting,
Or being lied about, don’t deal in lies,
Or being hated don’t give way to hating,
And yet don’t look too good, nor talk too wise;
If you can dream—and not make dreams your master;
If you can think—and not make thoughts your aim,

sftp user

So you want to configure an sftp only user?

Setup a group for sftp only users

groupadd sftponly

Make chroot jail directory

@jbenet
jbenet / test.coffee
Last active December 10, 2015 04:38 — forked from anonymous/model.coffee
class Model
constructor: ->
@data = {}
set: (key, val) ->
@data[key] = val
get: (key) ->
@data[key]
@jbenet
jbenet / extends.coffee
Last active December 10, 2015 18:18
coffeescript's `__extends`
__extends = function(child, parent) {
# copy over all class properties
for (var key in parent) {
if (__hasProp.call(parent, key))
child[key] = parent[key];
}
# new constructor function
function ctor() {
# link back to child class

Here is an essay version of my class notes from Class 1 of CS183: Startup. Errors and omissions are my own. Credit for good stuff is Peter’s entirely.

CS183: Startup—Notes Essay—The Challenge of the Future

Purpose and Preamble

@jbenet
jbenet / pyhash.py
Last active December 22, 2015 16:58
pyhash -- quickly hash some text with md5, sha1, or sha256. Works with piping input.
#!/usr/bin/env python2.7
#
# Install this in your PATH as `pyhash`.
#
# curl https://gist.github.com/jbenet/6502583/raw/pyhash.py -o pyhash
# mv pyhash /usr/bin/local/pyhash
# chmod +x /usr/bin/local/pyhash
#
# If you want more cryptographic hashing functions, try the PassLib module.
#
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@jbenet
jbenet / bar
Last active December 31, 2015 08:19
foo
hotfix
@jbenet
jbenet / wr
Last active August 29, 2015 13:56
open in WriteRoom from commandline
#!/bin/sh
# open in writeroom
if [ "$#" -eq 0 ]; then
echo "Open in WriteRoom"
echo "Usage: $0 <file>"
exit -1
fi
echo "opening $1 in WriteRoom..."
#!/usr/bin/env python
# init post for jekyll
import os
import re
import datetime
text_tmpl = """---
layout: post
title: %(title)s