Skip to content

Instantly share code, notes, and snippets.

View Dkendal's full-sized avatar

Dylan C. Kendal Dkendal

View GitHub Profile
@Dkendal
Dkendal / italics.vim
Created January 10, 2018 20:21 — forked from fmoralesc/italics.vim
vim + italics
" cd to the folder where you have xterm-256color.terminfo, run
" $ tic xterm-256color.terminfo
" and add the following to your vimrc.
set t_ZH=
set t_ZR=
#!/bin/zsh
DURATION=$1
BUCKET_NAME=dkendal-gifs
BUCKET=s3:$BUCKET_NAME/
FILE_NAME=`date +%s`.gif
FILE_PATH=~/gifs/$FILE_NAME
UPLOAD_PATH=https://s3.amazonaws.com/$BUCKET_NAME/$FILE_NAME
byzanz-record `xrectsel "-x %x -y %y -w %w -h %h"` -d $DURATION $FILE_PATH
rclone copy $FILE_PATH $BUCKET
defmodule Excourse.Banner.Parser do
###############
# Doman Model #
###############
defmodule Section do
defstruct [
:associated_term,
:attributes,
:campus,
package jcourse
import com.ericsson.otp.erlang._
import org.scalatest.FunSpec
import java.io._
class JcourseSpec extends FunSpec {
describe("convert") {
it("converts an erlang message into the domain model") {
var fis = new FileInputStream("fixtures/sections")
@Dkendal
Dkendal / *scratch*.js
Created April 7, 2017 20:11
Get First parent with computed value in JS
function f (x, k, v) {
return Window.getComputedStyle(x)[k] === v && x || x.parentElement && f(x.parentElement)
}
@Dkendal
Dkendal / grab.sh
Last active April 6, 2017 16:39
Screengrab and upload to s3
#!/bin/sh
BUCKET_NAME=dkendal-screenshots
BUCKET=s3:$BUCKET_NAME/
FILE_NAME=`date +%s`.png
GRAB_PATH=~/screenshots/$FILE_NAME
UPLOAD_PATH=https://s3.amazonaws.com/dkendal-screenshots/$FILE_NAME
escrotum -s $GRAB_PATH
rclone copy $GRAB_PATH $BUCKET
echo $UPLOAD_PATH | xclip -selection p
@Dkendal
Dkendal / scr.txt
Created April 5, 2017 17:58
Filter and aggregate rails log statements based on duration
#!/usr/bin/gawk -f
BEGIN {
capturing = 0;
n = 0
}
/Started GET "\/products\// {
capturing = 1;
}
%% Analysis results:
{ analysis_options,
[{callers, true},
{sort, acc},
{totals, false},
{details, true}]}.
% CNT ACC OWN
[{ totals, 5551, 17.298, 12.796}]. %%%
%% Analysis results:
{ analysis_options,
[{callers, true},
{sort, acc},
{totals, false},
{details, true}]}.
% CNT ACC OWN
[{ totals, 169379, 410.017, 405.826}]. %%%