View add.mips
.text
main:
li $t1, 1 # load immediate value 1 into $t1
add $t0, $t1, 2 # $t1 + 2 and put result into $t0
li $v0, 10 # 10 is the the exit syscall num
syscall
View example.erl
sum(L) -> sum(L,0).
sum([], Total) -> Total;
sum([H|T], Total) -> sum(T, H+Total).
View gpg.md

GPG Getting Started

  1. Check if you have gpg keys

     gpg --list-secret-keys --keyid-format LONG
    
  2. Import your pub/sec keypair

     gpg --import path/to/pub-key.asc
    
View arrayMap.js
function arrayMap(arr, fn) {
return arr.reduce(function (prev, current) {
return prev.concat(fn(current));
}, []);
};
View gameoflife.ex
# Game of life
# Goal is to have a 2D list that looks like:
[ [false, false, true, false, false],
[true, true, false, false, false],
...
]
# data is a list of coordinates {row, col} where {0,0} is the top-left origin
data = [{0,1}, {2,3}, {3,4}, {4,4}]
View test.ex
iex(6)> for _ <- 1..10 do
...(6)> end
[nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]
iex(7)> Enum.map(1..10, fn _ -> end)
warning: an expression is always required on the right side of ->. Please provide a value after ->
iex:7
[nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]
View game_of_life.ex
def calc_next_grid(grid) do
Enum.reduce(alive_plus_neighbors(grid), MapSet.new, fn({x, y}, grid2) ->
is_alive = MapSet.member?(grid, {x, y})
num_neighbors = count_neighbors(grid, {x, y})
if should_live?(is_alive, num_neighbors) do
MapSet.put(grid2, {x, y})
else
grid2
end
View hosts
# /etc/hosts
# Ad servers
127.0.0.1 101com.com
127.0.0.1 101order.com
127.0.0.1 123found.com
127.0.0.1 180hits.de
127.0.0.1 180searchassistant.com
127.0.0.1 1x1rank.com
View install-quake3.sh
#!/bin/bash
# Install Quake 3: Arena on a mac
# Copyright (c) 2016 simonewebdesign
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,