This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
cd $HOME/Documents/diary | |
vim -c 'set spell' -c 'hi SpellBad cterm=underline,bold' '+normal Go' diary.md | |
git add . | |
git commit --message "Diary $(date +%Y-%m-%d)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(readr) | |
library(dplyr) | |
library(ggplot2) | |
read_tsv("http://192.168.1.204:8000/temp.log", | |
col_names = c("Time", "Temp", "Temp (Smooth)"), | |
col_types = cols(.default = col_double(), Time = col_datetime())) %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Exponential scales in ggplot with tidy labels | |
p <- ggplot(data, aes(...)) | |
p <- p + scale_x_log10( | |
breaks = 10^seq(0, 6, by = 2), # generate breaks every 2 powers of 10, starting at 1 | |
minor_breaks = 10^seq(0, 6), | |
labels = parse(text = c("1", "100", "10^4", "10^6")) # this makes them pretty | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Generate random passwords according to guidance in | |
# https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/458857/Password_guidance_-_simplifying_your_approach.pdf | |
require 'securerandom' | |
module PassGen | |
VOWELS = %w{a i e o u}.map { |l| l.freeze }.freeze | |
CONSONANTS = (('a'..'z').to_a - VOWELS).map { |l| l.freeze }.freeze | |
SYMBOLS = ['!', '$', '%', '^', '&', '*', '+', '-', '_', '?', '@', '#', '~', '.', ',', '=', '"', '\\', '/', '<', '>', ':', ';'].map { |l| l.freeze }.freeze |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2013 Jonathan Stott | |
# | |
# Permission is hereby granted, free of charge, to any person ob- | |
# taining a copy of this software and associated documentation | |
# files (the "Software"), to deal in the Software without restric- | |
# tion, including without limitation the rights to use, copy, modi- | |
# fy, merge, publish, distribute, sublicense, and/or sell copies of | |
# the Software, and to permit persons to whom the Software is fur- | |
# nished to do so, subject to the following conditions: | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Webapp | |
include Reel::App | |
get '/' do | |
rooms = Actor[:rooms].list_rooms | |
# serialize and stuff here | |
end | |
post '/:room' do | |
# do some stuff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# 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 | |
# - e.g. Create a text file in ~/.planter/site.tpl | |
# - `planter.rb site` | |
# - Call planter.rb without input and it will open your $EDITOR to create the tree on the fly | |
# You can put %%X%% variables into templates, where X is a number that corresponds to the index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Example of friendships and retriving all records. | |
require 'rubygems' | |
require 'dm-core' | |
require 'dm-migrations' | |
# setup the logger | |
DataMapper::Logger.new($stdout, :debug) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Now with a hacky outline too, generated after: http://blog.steveklabnik.com/posts/2011-12-21-redcarpet-is-awesome | |
filename = ARGV.first | |
filename = File.basename(filename) if filename | |
require 'redcloth' | |
require 'redcarpet' | |
require 'yaml' | |
require 'mustache' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>zxcvbn</title> | |
</head> | |
<body> | |
<h1>pass</h1> | |
<input /> | |
<dl> | |
<dt>Entropy</dt> | |
<dd id='e'>0</dd> |
NewerOlder