Skip to content

Instantly share code, notes, and snippets.

⌨️
Click! Clack!

Łukasz Jan Niemier hauleth

View GitHub Profile
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
View sudo_lecture
 ╓▄≡≡▄╖
 ╓▀ ⸜⏋⎾⸝ ▀╖
 ,▓⸜▚▃`´▃▞⸝▓,
 █  `⸜▀▀⸝´  █
 . ▓▐  ∕≡≡∖  ▌▓ .
 #⌉'╯ ║▌  ∣≡≡∣  ▐║ ╰'⌠#
 ¬"  ▐V  ▀▄_∕≡≡∖_▄▀ V▌ "⌐
 w╜ ▐▄ ,:« "▀▀▀▀" »:, ▄▌ ╙w
 ▐╖▄▄▄▄²▌^ ▐ ▌ ^▌²▄▄▄▄╓▌
 ▐╡W▐║ ▐  / ,, \  ▐ ║▌W╞▌
View .gitlab-ci.yml
## Build
build:
stage: build
tags:
- elixir
script:
- eval $(ssh-agent -s)
- echo "$SSH_BUILD_KEY" | tr -d '\r' | ssh-add -
- git branch -f master HEAD
- mix edeliver build release --revision="$CI_BUILD_REF" --auto-version=revision
View zadanie.cpp
This file has been truncated, but you can view the full file.
# 1 "zadanie.cpp"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 337 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "zadanie.cpp" 2
# 1 "/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iostream" 1 3
# 37 "/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iostream" 3
You can’t perform that action at this time.