Skip to content

Instantly share code, notes, and snippets.

View emilyst's full-sized avatar

Emily Strickland emilyst

View GitHub Profile
#!/usr/bin/perl
use Text::CSV;
my $csv = Text::CSV->new();
while (<>) {
$csv->parse($_);
my @row = $csv->fields();
print $row[7];
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
########################################################################
# nifty timings for all commands
########################################################################
function print_dt_before
{
if [[ $(uname) == "Darwin" ]]; then
date_command="gdate"
else
date_command="date"
@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]
@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

[
{
"keys": ["home"],
"command": "move_to",
"args":
{
"to": "bol"
},
},
{
@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),
}
lilix:~ ⚡ gcc -O2 semtex.c -o semtex
lilix:~ ⚡ ./semtex
2.6.37-3.x x86_64
[email protected] 2010
lilix:~ ⚡ whoami
root
lilix:~ ⚡
#!/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:
@emilyst
emilyst / Sample of Melo.txt
Created December 16, 2012 00:48
The "sample" taken from the Activity Monitor while the app 'Melo' is "beachballing" -- non-responsive. Happens frequently, often after switching to a new track. It appears to recover itself spontaneously after several minutes, at which time, it reacts to interactions which happened during this phase which were apparently queued up by the system.
Sampling process 4050 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Melo (pid 4050) every 1 millisecond
Process: Melo [4050]
Path: /Applications/Melo.app/Contents/MacOS/Melo
Load Address: 0x10bc61000
Identifier: fi.mmrr.Melo
Version: 1.1.2 (2082)
Code Type: X86-64 (Native)
Parent Process: launchd [135]