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 'socket' | |
sock1 = Socket.new(:INET, :STREAM) | |
addr1 = Socket.pack_sockaddr_in(8888, '0.0.0.0') | |
sock1.bind(addr1) | |
sock1.listen(10) | |
sock2 = Socket.new(:INET, :STREAM) | |
addr2 = Socket.pack_sockaddr_in(9999, '0.0.0.0') | |
sock2.bind(addr2) |
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
function! Fzz(...) | |
let l:fzz_executable = "fzz" | |
if !executable(l:fzz_executable) | |
echoe "Fzz command '" . l:fzz_executable . "' not found. Is in your $PATH?" | |
return | |
endif | |
let l:ag_cmd = "ag --nogroup --nocolor" | |
let l:ag_executable = get(split(l:ag_cmd, " "), 0) | |
if !executable(l:ag_executable) |
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 | |
# ag is the_silver_searcher (https://github.com/ggreer/the_silver_searcher) | |
ag TODO | while read line; do | |
file=$(echo ${line} | awk -F ':' '{print $1}'); | |
lineno=$(echo ${line} | awk -F ':' '{print $2}'); | |
git blame --line-porcelain "./${file}" -L ${lineno},${lineno} | grep author-mail | cut -d ' ' -f 2; | |
done | sort | uniq -c |
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
class Brainfuck | |
attr_accessor :memory | |
attr_accessor :memory_pointer | |
attr_accessor :code | |
attr_accessor :ip | |
attr_accessor :input | |
attr_accessor :output |
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
#include <string.h> | |
#include <stdio.h> | |
#define MEM_SIZE 30000 | |
char mem[MEM_SIZE] = {0}; | |
char *memp = mem; | |
void bf_eval(char *code, int len, FILE *in, FILE *out) | |
{ |
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
class TestGlobFormatConstraints < ActionDispatch::IntegrationTest | |
Routes = ActionDispatch::Routing::RouteSet.new.tap do |app| | |
app.draw do | |
ok = lambda { |env| [200, { 'Content-Type' => 'text/plain' }, []] } | |
# tests fail with these: | |
get '/*id', to: ok, constraints: { format: 'html' } | |
#get '/*id', to: ok, constraints: { format: /html/ } | |
# tests succeed with this: |
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
#!/usr/bin/env bash | |
set -e | |
# Requirements: | |
# fzz - github.com/mrnugget/fzz | |
# selecta - github.com/garybernhardt/selecta | |
# the_silver_searcher/ag - github.com/ggreer/the_silver_searcher | |
# Usage: | |
# n [name] - Create note |
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
#!/usr/bin/env ruby | |
ENV['RAILS_ENV'] = 'test' | |
require 'benchmark' | |
rails_loading_time = Benchmark.measure { require './config/environment' } | |
puts "Rails env loaded in #{rails_loading_time}" | |
NUM_FORKS = 2 | |
test_groups = `find ./spec -type f -iname "*foobar*"`.split("\n").in_groups(NUM_FORKS).to_a |
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
#!/usr/bin/env bash | |
set -e | |
# Requirements: | |
# fzz - github.com/mrnugget/fzz | |
# selecta - github.com/garybernhardt/selecta | |
# the_silver_searcher/ag - github.com/ggreer/the_silver_searcher | |
# Usage: | |
# n [name] - Create note |
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
#ifdef __linux__ | |
#define _XOPEN_SOURCE 700 | |
#endif | |
#include <arpa/inet.h> | |
#include <errno.h> | |
#include <netdb.h> | |
#include <netinet/in.h> | |
#include <signal.h> | |
#include <stdio.h> | |
#include <stdlib.h> |