As configured in my dotfiles.
start new:
tmux
start new with session name:
require 'stringio' | |
require 'timeout' | |
class Object | |
def methods_returning(expected, *args, &blk) | |
old_stdout = $> | |
$> = StringIO.new | |
methods.select do |meth| | |
Timeout::timeout(1) { dup.public_send(meth, *args, &blk) == expected rescue false } rescue false |
As configured in my dotfiles.
start new:
tmux
start new with session name:
DEPS = $(CURDIR)/deps | |
DIALYZER_OPTS = -Wunderspecs | |
# List dependencies that should be included in a cached dialyzer PLT file. | |
# DIALYZER_DEPS = deps/app1/ebin \ | |
# deps/app2/ebin | |
DEPS_PLT = {{name}}.plt |
%%% -*- coding: utf-8; Mode: erlang; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | |
%%% ex: set softtabstop=4 tabstop=4 shiftwidth=4 expandtab fileencoding=utf-8: | |
%%% | |
%%%------------------------------------------------------------------------ | |
%%% @doc | |
%%% ==Abstract Code Insertion== | |
%%% A method to get the abstract code representation directly from the | |
%%% binary beam module representation. | |
%%% | |
%%% Other methods could be used, but they are not as efficient. |
A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."
package main | |
import ( | |
"fmt" | |
"os" | |
"os/exec" | |
"syscall" | |
) | |
func main() { |
#!/bin/bash | |
# | |
######################################################################### | |
#This software code is made available "AS IS" without warranties of any # | |
#kind. You may copy, display, modify and redistribute the software # | |
#code either by itself or as incorporated into your code; provided that # | |
#you do not remove any proprietary notices. Your use of this software # | |
#code is at your own risk and you waive any claim against Amazon # | |
#Digital Services, Inc. or its affiliates with respect to your use of # | |
#this software code. (c) 2006-2007 Amazon Digital Services, Inc. or its # |
package main | |
import ( | |
"bytes" | |
"encoding/binary" | |
"fmt" | |
"golang.org/x/sys/unix" | |
"os" | |
"syscall" | |
) |
Hugepages are a hardware feature designed to reduce pressure on the translation lookaside buffer (TLB) for applications that operate on large contiguous memory regions.
Take a program that operates on a large 2MB internal structure as an example. If the program accesses that space in such a way that one byte in each regular 4k page is accessed, 2M/4k = 512 TLB entries are needed. Each TLB miss at the hardware level requires and interrupt and kernel intervention to resolve. However, if the allocation is backed by a 2M hugepage by mmap()
ing with MAP_HUGETLB
, only 1 TLB entry is required.
On x86_64, there are two hugepage sizes: 2MB and 1G. 1G hugepages are also called gigantic pages. 1G must be enabled on kernel boot line with hugepagesz=1G
. Hugeages, especially 1G ones, should to be allocated early before memory fragments (i.e. at/near boot time) to increase the likelihood that they can be allocated successfully with minimal memory migration (i.e. defreg) required