Skip to content

Instantly share code, notes, and snippets.

View emilyst's full-sized avatar

Emily Strickland emilyst

View GitHub Profile
#!/usr/bin/python
# Copyright (c) 2013 Adam Knight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
lilix:~ ⚡ gcc -O2 semtex.c -o semtex
lilix:~ ⚡ ./semtex
2.6.37-3.x x86_64
sd@fucksheep.org 2010
lilix:~ ⚡ whoami
root
lilix:~ ⚡
@emilyst
emilyst / fib.rs
Last active January 2, 2016 07:35
Simple Fibonacci algorithm in Rust.
fn main() {
let number = 20;
println(fmt!("%?th fib number is: %?", number, fib(number)));
}
fn fib(x: int) -> int {
match x {
0 | 1 => x,
_ => fib(x - 1) + fib(x - 2),
}
[
{
"keys": ["home"],
"command": "move_to",
"args":
{
"to": "bol"
},
},
{
@emilyst
emilyst / regex.md
Last active December 25, 2015 08:19
An introduction to regular expressions for users and programmers

Regular expressions are a feature common to a lot of technical programs which work with lots of text. Most programming languages also incorporate them as a feature to use.

Regular expressions are (usually) short pieces of text (strings) which describe patterns of text. These patterns can be used to identity text which conform to them. When this happens, the string is said to match the pattern. In this way, unknown text can be scanned for patterns, ranging from very simple (a letter or number) to dramatically complex (URLs, e-mail addresses, phone numbers, and so on).

One common use of regular expressions is to cull down a body of text to just that which matches a pattern—in other words, to find something. Another common use is to search and replace. Yet another is to validate text: You (or your program) may only care about text which matches a pattern, and all other text is irrelevant.

A regular expression, like I said, is essentially itself a short piece of text. Often, it's written in a spe

@emilyst
emilyst / gif.py
Last active December 29, 2015 14:19
#!/usr/local/bin/python3
# save to: ~/Library/Application\ Scripts/com.codeux.irc.textual/gif.py
# use as '/gif searchterm'
# prints a link to the first GIF to match the term to the current window
import sys
import random
search_term = sys.argv[2]
########################################################################
# nifty timings for all commands
########################################################################
function print_dt_before
{
if [[ $(uname) == "Darwin" ]]; then
date_command="gdate"
else
date_command="date"
function! s:SwitchToFromTest() " {{{
let currentfilename = expand("%:t")
let pathtocurrentfile = expand("%:p:h")
let endofpath = fnamemodify(pathtocurrentfile, ":t")
if endofpath == "TEST"
let filename = fnamemodify(pathtocurrentfile, ":h") . "/" . currentfilename
else
let filename = pathtocurrentfile . "/TEST/" . currentfilename
endif
#!/usr/bin/perl
use Text::CSV;
my $csv = Text::CSV->new();
while (<>) {
$csv->parse($_);
my @row = $csv->fields();
print $row[7];
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]