Skip to content

Instantly share code, notes, and snippets.

@tnymlr
tnymlr / sway.log
Last active March 23, 2020 09:37
Sway log
2020-03-23 20:35:03 - [sway/main.c:152] Linux outbush 5.5.10-arch1-1 #1 SMP PREEMPT Wed, 18 Mar 2020 08:40:35 +0000 x86_64 GNU/Linux
2020-03-23 20:35:03 - [sway/main.c:168] Contents of /etc/os-release:
2020-03-23 20:35:03 - [sway/main.c:152] NAME="Arch Linux"
2020-03-23 20:35:03 - [sway/main.c:152] PRETTY_NAME="Arch Linux"
2020-03-23 20:35:03 - [sway/main.c:152] ID=arch
2020-03-23 20:35:03 - [sway/main.c:152] BUILD_ID=rolling
2020-03-23 20:35:03 - [sway/main.c:152] ANSI_COLOR="0;36"
2020-03-23 20:35:03 - [sway/main.c:152] HOME_URL="https://www.archlinux.org/"
2020-03-23 20:35:03 - [sway/main.c:152] DOCUMENTATION_URL="https://wiki.archlinux.org/"
2020-03-23 20:35:03 - [sway/main.c:152] SUPPORT_URL="https://bbs.archlinux.org/"
@tnymlr
tnymlr / log.sh
Last active December 21, 2019 22:19
Download photos from an iPhone and convert HEIC to JPGs and MOVs to VP9 MKVs. Details: https://til.tmlr.xyz/notes/linux-ios-photo-sync/
#!/usr/bin/env bash
do_log() {
local scope=$1
local msg=$2
echo "[${scope}]: ${msg}"
}
do_error() {
do_log "$1" "$2" >&2
@tnymlr
tnymlr / repack.sh
Created October 9, 2019 12:05
Repack bunch of epubs to, it seems to be fixing their mime type
while read file; do \
unzip "$file" -d "${file%.*}" && \
pushd "${file%.*}" && \
zip -X "${file%.*}_fixed.epub" mimetype && \
zip -rg "${file%.*}_fixed.epub" META-INF && \
zip -vur "${file%.*}_fixed.epub" * && \
popd && mv "${file%.*}/${file%.*}_fixed.epub" ./ && \
rm -rf "${file%.*}"; \
done < <(find . -name '*.epub' | xargs -i basename "{}")
@tnymlr
tnymlr / script.sh
Created June 2, 2019 14:04
How to choose a window with dmenu in sway
swaymsg -t get_tree \
| jq -r '..| objects | select(.type == "con") | select(.name != null) | select(.nodes | length < 1) | {id: .id | tostring, name: .name, app_id: .app_id} | .id + ": " + .name + " - " + .app_id' \
| dmenu -l 30 \
| cut -d ':' -f 1 \
| xargs -I {} swaymsg '[con_id="{}"] focus'
@tnymlr
tnymlr / youman.py
Last active February 3, 2020 00:02
youman
#!/usr/bin/env python3
import os
import shutil
import subprocess
import random
from argparse import ArgumentParser
from argparse import REMAINDER
from pathlib import Path
@tnymlr
tnymlr / custom.css
Created August 6, 2016 06:05
Vivaldi browser look and feel tweak. Screenshot: http://imgur.com/a/kOAov
button.vivaldi {
display: none !important;
}
#tabs-container.top {
margin-left: -1.8%;
margin-top: -0.5%;
background-color: #0063B1;
}
@tnymlr
tnymlr / Makefile.am
Last active June 23, 2021 11:39
Autotools/Automake unit testing (make check) via CUnit
SUBDIRS=src tests
TESTS=tests/hello
@tnymlr
tnymlr / App.java
Last active August 29, 2015 14:11
Javac (1.8.0_25) bug
package com.ermys;
/**
* Hello world!
*
*/
public class App
{
@FunctionalInterface
public interface FunctionalInterfaceFoo<X, Y> {
@tnymlr
tnymlr / App.java
Created September 12, 2014 14:22
Spring fails to inject dependency in Java 8.
package com.jlectra;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;
import java.util.concurrent.Callable;
@tnymlr
tnymlr / nginx.rb
Last active December 30, 2015 21:49 — forked from mranallo/nginx.rb
require 'formula'
class Nginx < Formula
homepage 'http://nginx.org/'
url 'http://nginx.org/download/nginx-1.4.4.tar.gz'
sha1 '304d5991ccde398af2002c0da980ae240cea9356'
devel do
url 'http://nginx.org/download/nginx-1.4.4.tar.gz'
sha1 '304d5991ccde398af2002c0da980ae240cea9356'