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 | |
if echo ${1} | grep -q '^vmnet[0-9]$'; then | |
ERRCOUNT='0' | |
PIDSNIFF='0' | |
PIDTDUMP='0' | |
CAPINTF="${1}" | |
CAPFILE="$(mktemp -t capture)" |
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 | |
# Install rbenv | |
# https://github.com/sstephenson/rbenv | |
cd ~ | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bash_profile | |
echo 'eval "$(rbenv init -)"' >> .bash_profile |
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
first = {"a" => 4, "b" => 1, "c" => 3, "g" => 201, "h" => 501} | |
second = {"d" => 19, "e" => 18, "c" => 17, "g" => 201, "h" => 501} | |
keys_intersection = first.keys & second.keys | |
merged = first.dup.update(second) | |
intersection = {} | |
keys_intersection.each do |k| | |
intersection[k]=merged[k] unless first[k] != second[k] | |
end |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
local st = require "util.stanza"; | |
local jid_bare = require "util.jid".bare; | |
local xmlns_push = "urn:xmpp:push:0"; | |
local full_sessions, bare_sessions = full_sessions, bare_sessions; | |
local recipients = {}; | |
local function toggle_push(event) | |
local origin, stanza = event.origin, event.stanza; | |
local user = stanza.attr.to or (origin.username..'@'..origin.host); |
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
# Install to /usr/local/Library/Homebrew/cmd/rmtree.rb | |
require 'keg' | |
require 'formula' | |
require 'shellwords' | |
module Homebrew | |
def rmtree | |
raise KegUnspecifiedError if ARGV.named.empty? |
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
error_page 400 404 405 =200 @40*_json; | |
location @40*_json { | |
default_type application/json; | |
return 200 '{"code":"1", "message": "Not Found"}'; | |
} | |
error_page 500 502 503 504 =200 @50*_json; | |
location @50*_json { |
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
CRYSTAL = crystal | |
UNAME = "$(shell uname -ms)" | |
LIBRARY_PATH = $(shell brew --prefix crystal-lang)/embedded/lib | |
LIBS = -levent -lpcl -lpcre -lgc -lpthread | |
LDFLAGS = -Wl,-undefined,dynamic_lookup | |
TARGET = crystal_example_ext.bundle | |
$(TARGET): crystal_example_ext.o | |
$(CC) -bundle -L$(LIBRARY_PATH) -o $@ $^ $(LIBS) $(LDFLAGS) |
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
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
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
/** | |
* Making promises | |
*/ | |
let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok")); | |
/* Simpler promise creation for static values */ | |
Js.Promise.resolve("easy"); | |
Js.Promise.reject(Invalid_argument("too easy")); |
OlderNewer