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
cmd = ~S""" | |
ruby -e ' | |
require "bundler" | |
require "erlang/etf" | |
require "stringio" | |
require "sinatra" | |
@input = IO.new(3) | |
@output = IO.new(4) | |
@output.sync = true |
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
TOP_5=`(history | awk '{print $2}' | sort | uniq -c | sort -rn | head -n 5)` | |
for score in `echo $TOP_5 | xargs`; do | |
# command="$(echo $score | awk '{print $2}' | tr -d '\n')" | |
score="$(echo $score | awk '{print $1}' | tr -d '\n')" | |
num_hashes="$(echo $score | awk '{print $1 / 25}' | awk -F. '{print $1}')" | |
hashes="$(jot -b '#' - 1 $num_hashes | xargs | tr -d ' ')" | |
echo "$hashes" | |
done | |
###################################################################################################################### | |
## |
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/sh | |
# Reboot netgear CM400 cablemodem via curl | |
curl -s -u admin:password 'http://192.168.100.1'$(curl -s -u admin:password http://192.168.100.1/RouterStatus.htm | grep id=[0-9] | cut -d'"' -f2) --data 'buttonSelect=2&wantype=dhcp&enable_apmode=0' > /dev/null |
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
defmodule Image do | |
defstruct [:grid, :pixel_map] | |
end | |
defmodule RandomImageGenerator do | |
def create(width, bar_size, filename \\ "out.png") do | |
%Image{} | |
|> create_grid(width) | |
|> build_pixel_map(width, bar_size) |
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
" FIXME if it is your first time with this vimrc then run | |
" # git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'VundleVim/Vundle.vim' |
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
# list the flags for `ls` that are NOT valid flags | |
man ls | ruby -n -e 'puts $_ if $_.include? " -"' | ruby -n -e 'a = $_.split(" "); puts a[1]' | ruby -n -e 'puts $_ if $_.include?("-")' > args && ruby -e 'puts http://File.read ("args").split("\n")[0..38]' > args2 && ruby -e 'puts ("a".."z").to_a - http://File.read ("args2").split("\n").map { |el| el.split("")[3] }' |
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 | |
function calculate_stats() { | |
mkdir priv | |
mkdir priv/scripts | |
echo "Gathering stats for umbrella project..." | |
echo | |
APPS_COUNT=$(ls apps | wc -l) | |
echo $(echo "$APPS_COUNT Apps") | |
echo |
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
module NerdNode | |
# Rack app to reject common bot attacks. Returns a random HTTP status and content type, along with some LOLs. | |
# | |
# Usage: | |
# use NerdNode::BotProtector, /phpmyadmin\/scripts|mysql\/scripts/ | |
# | |
# # ...or use the Regexp helper which takes an array of URL strings... | |
# blacklist = BotProtector.build_regex(['phpmyadmin/scripts', 'mysql/scripts']) | |
# use NerdNode::BotProtector, blacklist | |
# |
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
defmodule Services.SchemaCase do | |
use ExUnit.CaseTemplate | |
using(opts) do | |
quote bind_quoted: [opts: opts] do | |
alias Services.Repo | |
import Ecto | |
import Ecto.Changeset | |
import Ecto.Query |
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
a_big_map = %{a: 1, | |
b: 1, | |
c: 1, | |
d: 1, | |
ea: 1, | |
fa: 1, | |
ga: 1, | |
fa: 1, | |
frgwa: 1, | |
fbwa: 1, |
NewerOlder