- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
- They are the people who get things done. Effective Engineers produce results.
#create sites-enabled directory to hold config symlinks | |
sudo mkdir -p /etc/nginx/sites-enabled | |
#symlink the webapps directory to /var/www/apps | |
sudo mkdir -p /var/www | |
sudo ln -ns /home/minhajuddin/webapps /var/www/apps | |
#symlink an nginx config file to a webapps config file | |
sudo ln -ns /var/www/apps/ramanujan/config/nginx.conf /etc/nginx/sites-enabled/ramanujan.conf | |
#hookup /etc/init.d/nginx to auto-start at startup | |
/usr/sbin/update-rc.d -f nginx defaults |
# This is the target module which will be overwritten after dynamic compilation | |
# You'll be using this to read configuration in your code. For instance, if you | |
# have a configuration key called `:redis_timeout`, you could read it using | |
# `MM.Config.get(:redis_timeout)` | |
defmodule MM.Config do | |
# we use a default implementation which raises an error when our code tries | |
# to read configuration before it is compiled. | |
def get(_key), do: raise("Config has not been compiled yet!") | |
end |
defmodule SearchWorker do | |
use GenServer | |
@idle_timeout_ms 10 * 60 * 1000 | |
# client api | |
def touch(pid) do | |
GenServer.cast(pid, :touch) | |
end |
defmodule SearchWorker do | |
use GenServer | |
@idle_timeout_ms 10 * 60 * 1000 | |
@impl GenServer | |
def init(state) do | |
# send ourselves a message after 10 seconds and cleanup the proc tree when we get this | |
Process.send_after(self(), :idle_timeout, @idle_timeout_ms) | |
{:ok, state} |
defmodule SearchWorker do | |
use GenServer | |
@idle_timeout_ms 10 * 60 * 1000 | |
@impl GenServer | |
def init(state) do | |
# send ourselves a message after 10 seconds and cleanup the proc tree when we get this | |
Process.send_after(self(), :idle_timeout, @idle_timeout_ms) | |
{:ok, state} |
import XMonad | |
main = do | |
xmonad $ defaultConfig | |
{ terminal = myTerminal | |
, modMask = myModMask | |
, borderWidth = myBorderWidth | |
} | |
myTerminal = "urxvt" |
#!/usr/bin/env ruby | |
class Sync | |
def initialize(gitpart) | |
@from, @to, @ref = gitpart.split | |
@branch = @ref.split('/').last | |
end | |
def exec |
curl --include \ | |
--no-buffer \ | |
--header "Connection: Upgrade" \ | |
--header "Upgrade: websocket" \ | |
--header "Host: example.com:80" \ | |
--header "Origin: http://example.com:80" \ | |
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \ | |
--header "Sec-WebSocket-Version: 13" \ | |
http://example.com:80/ |
# Ticker | |
defmodule Ticker do | |
use GenServer | |
def start_link(%{module: module, function: function, interval: interval} = state) | |
when is_atom(module) and is_atom(function) and is_integer(interval) and interval > 0 do | |
GenServer.start_link(__MODULE__, state) | |
end | |
def init(state) do |