Skip to content

Instantly share code, notes, and snippets.

@adnils
adnils / vim-highlight
Last active August 29, 2015 14:25
highlight occurrences of word under cursor on spacebar
let g:highlighting = 0
function! Highlighting()
if g:highlighting == 1 && @/ =~ '^\\<'.expand('<cword>').'\\>$'
let g:highlighting = 0
return ":silent nohlsearch\<CR>"
endif
let @/ = '\<'.expand('<cword>').'\>'
let g:highlighting = 1
return ":silent set hlsearch\<CR>"
endfunction
@adnils
adnils / nginx.conf
Last active August 29, 2015 14:24 — forked from plentz/nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@adnils
adnils / server.ex
Last active August 11, 2020 16:37
Elixir TCP echo server
defmodule Echo.Server do
def start(port) do
tcp_options = [:binary, {:packet, 0}, {:active, false}]
{:ok, socket} = :gen_tcp.listen(port, tcp_options)
listen(socket)
end
defp listen(socket) do
{:ok, conn} = :gen_tcp.accept(socket)
spawn(fn -> recv(conn) end)
@adnils
adnils / README.md
Last active August 29, 2015 14:20 — forked from joakimk/README.md

This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible. It's not been run for very long so I don't know if it caches too much or of there is any other issues.

It should be generic enough to work on any elixir app using mix.

@adnils
adnils / irccloud-solarized.css
Created October 14, 2014 11:11
IRCCloud Solarized
td.nickcell a.nick,
td.inputcell textarea,
div.log div.messageRow,
div.log div.me a.user {
/* font-family: "Consolas", "Monaco", "Source Code Pro", "Droid Sans Mono", monospace !important; */
font-size: 14px !important;
}
body,
.mainContainer,
@adnils
adnils / keybase.md
Created September 18, 2014 08:00
keybase.md

Keybase proof

I hereby claim:

  • I am adnils on github.
  • I am adnils (https://keybase.io/adnils) on keybase.
  • I have a public key whose fingerprint is DE2C DB3C 1736 C967 76E0 CB86 261D 2FEC 4776 D3EE

To claim this, I am signing this object:

@adnils
adnils / gist:0ecf778f54bca92fe698
Created September 8, 2014 09:03
sublime config
{
"caret_style": "phase",
"close_windows_when_empty": false,
"theme": "Spacegray.sublime-theme",
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"font_face": "Droid Sans Mono Slashed",
"font_size": 13,
"line_padding_bottom": 1,
"line_padding_top": 1,
"rulers":
function Y(le) {
return (function (f) {
return f(f);
}(function (f) {
return le(function (x) {
return f(f)(x);
});
}));
}
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}
cluster.on('exit', function(worker, code, signal) {
@adnils
adnils / d3mergesort.html
Last active August 29, 2015 13:58
d3 merge sort
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
margin-top: 225px;
}
line {
stroke: #000;