This file contains 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
# Finds your longest man pages by counting `man n foo | wc -l` | |
# for all man pages available. | |
man -k . | | |
sed -e 's/(//' -e 's/)//' | | |
awk '{ print $2, $1 }' | | |
xargs -n 1 -I {} bash -c "echo -n -e "{}"'\t'; man "{}" | wc -l" 2>/dev/null | | |
awk -F$'\t' 'BEGIN { max = 0 } { if ($2 > max) { max = $2; print "max found: " max " (" $1 ")" } }' |
This file contains 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
# | |
# Show all lines added to `some-dir/` in the last week (on all branches), restricted to: | |
# | |
# * only newly added files, | |
# * those by author matching "adam". | |
# | |
git log --author=adam --since={1.week.ago} --all --diff-filter=A -p -- some-dir/ | | |
# lines added | |
grep -E '^\+' | |
This file contains 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
#!/bin/bash | |
USERNAME=your-username | |
# ----- | |
film_for_year() { | |
output=$(curl -s "http://letterboxd.com/$1/films/diary/year/$2/" | grep -Eo '([0-9]+) films' | grep -Eo '[0-9]+') | |
if [ -z "$output" ]; then |
This file contains 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
def permissions_string(integer) | |
triplet_to_string = lambda { |x, s| x.tr("01", "-#{s}") } | |
integer.to_s(2).rjust(9, "0").chars.each_slice(3).map do |r, w, x| | |
[ | |
triplet_to_string[r, "r"], | |
triplet_to_string[w, "w"], | |
triplet_to_string[x, "x"] | |
].join("") | |
end.join("") |
This file contains 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
layout: none | |
<?xml version="1.0" encoding="utf-8"?> | |
{% assign feed_url = "http://example.com/feed" %} | |
{% assign feed_title = "Example Feed" %} | |
{% assign feed_alternate = "http://example.com/blog" %} | |
{% assign feed_global_unique_id = "tag:example.com,2013:TOTALLY-RANDOM-STRING-OF-CHARACTERS-GOES-HERE" %} | |
{% assign feed_author_name = "J. Smith" %} |
This file contains 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
// | |
// Take a user's selected content in the page, as HTML, and | |
// place it inside a blockquote. | |
// | |
// Allows the possibility of automatically converting it | |
// to Markdown with toMarkdown. | |
// | |
// the selection in the document -- Selection object | |
var sel = document.getSelection(); |
This file contains 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
/* | |
* Save as the URL of a bookmark, and the next time your BT HomeHub takes you to a | |
* "problem with your connection" page, click the bookmark to go to the actual URL. | |
* | |
* This simply grabs the "org_url" parameter out of their error page and visits it. | |
* | |
* Useful if: | |
* | |
* 1. You don't want to retype URLs or open tabs repeatedly while checking to see | |
* the connection is up again. Just keep clicking the bookmark. |
This file contains 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
require 'benchmark' | |
n = 100_000 | |
mock_methods = ('a'..'z').to_a | |
class Mock | |
end | |
mock_methods.each do |m| | |
Mock.class_eval do |
This file contains 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
# an attempt at showing only commits where a single character has been changed. | |
# | |
# lots of false positives. | |
git rev-list --all --no-merges | | |
while read commit; do | |
files_changed=$(git diff $commit^ $commit --name-only | wc -l) | |
diffcontent="$(git diff --numstat --minimal -U0 --word-diff=porcelain --word-diff-regex=. $commit^ $commit | grep -e '^\+.$')" | |
if [ $files_changed -eq 1 ] && [ $(echo "$diffcontent" | wc -l) -eq 1 ] && [ ! -z "$diffcontent" ]; then |
This file contains 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
/* | |
* Just a user stylesheet for yoleoreader.com. No affiliation. | |
* | |
* Author: Adam Prescott (aprescott.com) | |
* Copyright: CC BY-NC-SA - Creative Commons Attribution-NonCommercial-ShareAlike | |
*/ | |
.article-contents { | |
font-family: "Georgia", serif; | |
font-size: 1.1em; |