Skip to content

Instantly share code, notes, and snippets.

@numberwhun
numberwhun / gist:1399592
Created November 28, 2011 08:20
Project Ideas for class
I actually found this on a college programming course site. Its a list of ideas for the class to draw from for project ideas.
###################################################################3
Ideas for the class project
Here are some rough notes that may be useful for deciding on a topic for the class project. You should treat the following as starting points for further discussion and development, not as canned project suggestions (which you can find elsewhere). In particular, the following are not intended to serve as replacements for discussing project ideas and plans (among project team members and with the instructor and TA).
Note that some of these are too simple for a project and others may be too complex. Treat the following merely as a collection of ideas from which you can pick some you like, combining them to get a project that both interests you and is sufficiently challenging from a technical viewpoint. You are encouraged to stop by during office hours to discuss any of the following that
helpers do
def body(arg = nil)
arg &&= arg.to_json
super(arg)
end
end
@ssp
ssp / git-extract-file.markdown
Created January 23, 2012 13:21
Extract a single file from a git repository

How to extract a single file with its history from a git repository

These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).

First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.

Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.

1. copy the repository to extract the file from and go to the desired branch

@tarcieri
tarcieri / gist:3067720
Created July 7, 2012 19:14
Cryptosphere Key Exchange

Cryptosphere Key Exchange

Assumption #1: For protocol efficiency, we will use UDP, and to avoid packet loss associated with breaking apart large UDP messages, we will attempt to limit all messages to the "minimum maximum reassembly buffer size", which is 512 bytes. Packet loss may result in a failed opportunity to engage with a particular peer, but hopefully we have lots of peers. If we really care about engaging a particular peer we can retry the handshake M times after an N second timeout.

Assumption #2: Satan is watching our packets. We don't want him to be able to be able to track public keys we are using in key exchanges through casual packet inspection. Therefore, all public keys must be sent in encrypted form. Ideally all packets in the

@tonyarnold
tonyarnold / gist:3162762
Created July 23, 2012 09:20
Git config aliases for markdown release notes
[alias]
co = checkout
tagsbydate = for-each-ref --sort=-taggerdate --format='%(refname:short)' refs/tags
previoustag = !sh -c 'git tagsbydate --count 2 | cut -f2 | sed -n 2p'
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
markdownlog = log --color --pretty=format:'* %s `%Cred%h%Creset` - %C(bold blue)[%an](mailto:%ae)%Creset' --abbrev-commit --dense --no-merges --reverse
releasenotes = !sh -c 'git markdownlog ...`git previoustag`'
@postmodern
postmodern / Makefile
Last active March 4, 2024 14:42
A generic Makefile for building/signing/install bash scripts
NAME=project
VERSION=0.0.1
DIRS=etc lib bin sbin share
INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null`
INSTALL_FILES=`find $(DIRS) -type f 2>/dev/null`
DOC_FILES=*.md *.txt
PKG_DIR=pkg
PKG_NAME=$(NAME)-$(VERSION)
@ttscoff
ttscoff / planter.rb
Created September 22, 2012 17:57
Create directory trees from indented text input
#!/usr/bin/ruby
=begin
Planter v1.3
Brett Terpstra 2013
ruby script to create a directory structure from indented data.
Three ways to use it:
- Pipe indented (tabs or 2 spaces) text to the script
- e.g. `cat "mytemplate" | planter.rb
- Create template.tpl files in ~/.planter and call them by their base name
@tarcieri
tarcieri / gist:4590841
Last active December 11, 2015 10:59
Instructions for NaCl's crypto_secretbox
  • What the algorithm does for you: ensures data is kept confidential and that it cannot be undetectably modified by an attacker
  • What the algorithm expects from you: a unique bit of seed data (a nonce) which is never, ever reused (with the same key)
  • What happens if you reuse a nonce: complete loss of the confidentiality of your data (provided nonces are reused with the same key). Do NOT let this happen or you are breaking the security of your system
@grantr
grantr / curvecp_handshake.rb
Last active July 19, 2018 15:16
CurveCP handshake protocol in Ruby
# A demonstration of the CurveCP handshake protocol. This protocol has many
# favorable security properties described at http://curvecp.org.
#
# In addition to its security advantages, it has the following favorable properties:
# * Needs only 2 messages (1 from client, 1 from server) before application
# messages can be exchanged (3 before the server can send application messages)
# * Does not require the server to keep protocol state between handshake messages.
#
# An overview of the protocol:
#
@tarcieri
tarcieri / aefd.md
Last active March 18, 2019 10:51
Authenticated Encryption for Dummies

It might seem like a silly exercise, but I was looking at the "NIST approved" algorithms in NaCl (i.e. AES, HMAC) and wondering if I could build an authenticated encryption system with them. djb lists AES-GCM as a "todo" secretbox primitive so unfortunately NaCl does not presently expose any AES-based authenticated encryption, only aes128ctr.

This is what I came up with using the algorithms available in NaCl:

Diagram

A quick rundown:

Encrypt-then-MAC with AES-CTR (128-bit for now, 256-bit later!) encryption and HMAC SHA-512256 (i.e. SHA-512, truncated to 256-bits by NaCl via crypto_auth_hmacsha512256) authentication. MAC comparisons are performed using a NaCl supplied verifier function which is (hopefully!) constant time.