Skip to content

Instantly share code, notes, and snippets.

View motiejus's full-sized avatar

Motiejus Jakštys motiejus

View GitHub Profile
@motiejus
motiejus / Makefile
Last active May 24, 2023 13:07
zig-cc and rpath
ZIG ?= zig
.PHONY: test
test: t-rpath.zig-cc t-rpath.clang-16 t-plain.clang-16 t-plain.zig-cc x/libfoo.so.2
@echo clang-16 rpath:
@readelf -d t-rpath.clang-16 | grep -E "runpath|foo|bar" | sort
@echo zig cc rpath:
@readelf -d t-rpath.zig-cc | grep -E "runpath|foo|bar" | sort
@echo clang-16 plain:
@readelf -d t-plain.clang-16 | grep -E "runpath|foo|bar" | sort
@motiejus
motiejus / Makefile
Last active June 26, 2018 17:31
read a named socket
.PHONY: test
test: f read_c read_go
bash -c 'while true; do echo yaddda | head -2 >> f; echo written; done' & \
./read_c f; \
./read_go f; \
./read.py f; \
pkill -f "echo yaddda"
f:
mkfifo f
@motiejus
motiejus / t
Last active June 19, 2018 23:29
timer
#!/usr/bin/env python -u
from sys import stdin, stdout
from datetime import datetime
before, line = datetime.utcnow(), 'foo'
while line != '':
line = stdin.readline()
ret = "[%s] %s" % (datetime.utcnow().strftime("%H:%M:%S.%f"), line)
stdout.write(ret)
@motiejus
motiejus / .profile_motiejus
Last active March 19, 2018 14:51
dotfiles 2018-03-19
arc() {
if [[ -z "$(which node)" ]]; then d; fi
env arc "$@"
}
. $HOME/.gg.sh
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] '
@motiejus
motiejus / darzeliai.py
Created November 17, 2016 20:10
Vilniaus Darželiai
"""Parses KML file from the google map of http://www.vilnius.lt/darzeliai/info/.
Outputs a spreasheet-importable CSV.
"""
import sys
import csv
import xmltodict
@motiejus
motiejus / create.sh
Last active January 5, 2017 07:32
gifs from dans.im
#!/bin/bash
if [[ -n "$1" ]]; then
URL=$1
else
URL=https://dans.im/gifs/
fi
set -euo pipefail
@motiejus
motiejus / make_jsons.awk
Last active April 11, 2016 08:14
invalidate s3 versions of a given period
#!/usr/bin/awk -f
# Finds objects between two versions, and creates
# "aws s3api delete-objects"-compatible json file.
# BUG: skips some of the input lines. Should emit the key/val on every line!
# Input:
# aws s3api --bucket=BUCKET list-object-versions --output text
@motiejus
motiejus / aruodas.user.js
Last active May 2, 2016 14:31
Preload full images on aruodas.lt detail page
// ==UserScript==
// @name preload images on aruodas.lt
// @namespace motiejus
// @description Preload images on detail pages in aruodas.lt
// @include http*://*.aruodas.lt/*
// @version 4
// @grant none
// @downloadURL https://gist.github.com/raw/063233890c207c0e9dce/aruodas.user.js
//
// ==/UserScript==
@motiejus
motiejus / graphite.txt
Created November 18, 2014 23:12
graphite server on CoreOS (userdata script)
#!/bin/bash
# Begin graphite.service
set -euo pipefail
cat > /etc/systemd/system/graphite.service <<EOF
[Unit]
Description=graphite server
After=docker.service
Requires=docker.service
[Service]
@motiejus
motiejus / f1.md
Last active August 29, 2015 14:05
piqi showcase

A sample resource:

.resource [
  .url [
    .string.gamelist
    .string.favouritesGet
    .binding.siteid
    .binding.uid
 ]