Skip to content

Instantly share code, notes, and snippets.

Avatar
⌨️
Click! Clack!

Łukasz Jan Niemier hauleth

⌨️
Click! Clack!
View GitHub Profile
View gist:3012efda82c3ed2e3ee1c46edb2eb639
execve("/usr/bin/systemd-socket-activate", ["systemd-socket-activate", "-l", "8888", "--fdname=tcp", "-E", "ERL_FLAGS=-kernel inet_backend s"..., "_build/prod/rel/echo/bin/echo", "foreground"], 0x7ffece9f2b88 /* 27 vars */) = 0
brk(NULL) = 0x5584132d3000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffdd75bb450) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/systemd/tls/haswell/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/systemd/tls/haswell/x86_64", 0x7ffdd75ba6a0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/systemd/tls/haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/systemd/tls/haswell", 0x7ffdd75ba6a0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/systemd/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/systemd/tls/x86_64", 0x7ffdd75b
View phishing-mail
Delivered-To: ******
Received: by 2002:a92:9c89:0:0:0:0:0 with SMTP id x9csp957441ill;
Fri, 3 Apr 2020 13:35:23 -0700 (PDT)
X-Received: by 2002:a17:907:212f:: with SMTP id qo15mr10368606ejb.326.1585945883463;
Fri, 03 Apr 2020 13:31:23 -0700 (PDT)
X-Google-Smtp-Source: APiQypLvOEHWpSbsJjaOLe+cYvK/167FB8mnZpkrXNCSDDR/YCarZ6oBWN9HNf3qrcV1TGUsRqsN
X-Received: by 2002:a17:907:212f:: with SMTP id qo15mr10368495ejb.326.1585945881753;
Fri, 03 Apr 2020 13:31:21 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1585945881; cv=none;
d=google.com; s=arc-20160816;
View time_format.ex
defmodule TimeFormat do
def format(seconds) do
seconds
|> :calendar.seconds_to_time()
|> do_format()
|> to_string()
end
defp do_format({0, m, s}), do: :io_lib.format("~B:~2..0B", [m, s])
defp do_format({h, m, s}), do: :io_lib.format("~B:~2..0B:~2..0B", [h, m, s])
View lsp.vim
func! s:setup_ls(...) abort
let l:servers = lsp#get_whitelisted_servers()
for l:server in l:servers
let l:cap = lsp#get_server_capabilities(l:server)
if has_key(l:cap, 'completionProvider')
setlocal omnifunc=lsp#complete
endif
View projections.vim
let g:projectionist_heuristics['mix.exs'] = {
\ 'apps/*/mix.exs': { 'type': 'app' },
\ 'lib/*.ex': {
\ 'type': 'lib',
\ 'alternate': 'test/{}_test.exs',
\ 'template': ['defmodule {camelcase|capitalize|dot} do', 'end'],
\ },
\ 'test/*_test.exs': {
\ 'type': 'test',
\ 'alternate': 'lib/{}.ex',
@hauleth
hauleth / pg_graph.sh
Created Apr 17, 2018
Script to generate DOT graph of dependencies between tables in PostgreSQL
View pg_graph.sh
#!/bin/sh
psql -qX "$@" <<EOF
\t on
\timing off
\echo 'Digraph F{'
\echo 'ranksep=1.0; size="18.5, 15.5"; rankdir=LR;'
SELECT
View advent1.exs
defmodule Advent1 do
def sum([h|_]=list),do: do_sum(list++[h],0)
defp do_sum([_],sum),do: sum
defp do_sum([a|[a|_]=rest],sum),do: do_sum(rest,sum+a-?0)
defp do_sum([_|rest],sum),do: do_sum(rest,sum)
end
IO.puts Advent1.sum to_charlist IO.read :all
View SA-MCRN-Donnager.kbd.json
[
{
"backcolor": "#b0b0b0",
"name": "SA MCRN Donnager",
"author": "Łukasz Niemier"
},
[
{
"c": "#e3e2dd",
"t": "#2d3238",
View fix-fmt.sh
#!/bin/sh
set -eo pipefail
in="$(mktemp)"
out="$(mktemp)"
trap "rm '$in' '$out'" EXIT
cat /dev/stdin > "$in"
"$@" < "$in" 2>/dev/null > "$out" && cat "$out" || cat "$in"
@hauleth
hauleth / asyncdo.vim
Created Nov 5, 2017
Minimal async runner
View asyncdo.vim
func! s:populate(file, cmd) abort
unlet! t:job
try
exe 'cgetfile '.a:file
finally
call setqflist([], 'a', {'title': a:cmd})
endtry
endfunc
func! AsyncDo(...) abort