Skip to content

Instantly share code, notes, and snippets.

View ivan's full-sized avatar
🕸️

Ivan Kozik ivan

🕸️
View GitHub Profile
@ivan
ivan / xscreensaver-wait-for-unlock
Last active December 1, 2017 00:53
xscreensaver-wait-for-unlock
#!/bin/bash
# Run this script under `setsid -w` to avoid killing parent processes
# e.g. your lock script and xfsettingsd
set -u
# Kill `xscreensaver-command -watch` when we exit
# https://stackoverflow.com/a/22644006/738390
trap "exit" INT TERM
@ivan
ivan / xscreensaver-wait-for-unlock
Last active December 1, 2017 00:58
xscreensaver-wait-for-unlock
#!/bin/bash
set -eu
FIFO=/tmp/xscreensaver-wait-for-unlock-$$.fifo
mkfifo -- "$FIFO"
# Kill `xscreensaver-command -watch` when we exit
# https://stackoverflow.com/a/22644006/738390
trap "exit" INT TERM
@ivan
ivan / fix-qemu-guest-resolution
Last active July 31, 2022 08:00
fix-qemu-guest-resolution
#!/bin/bash
# SPICE clipboard sharing is not safe to use:
# https://bugzilla.redhat.com/show_bug.cgi?id=1320263
# but guests that have <clipboard copypaste='no'/> can't fix their screen
# resolution with `xrandr --output Virtual-0 --auto`, so use this program
# to fix the screen resolution for a qemu guest over ssh. This should be
# run on the host machine, not the guest.
set -eu -o pipefail
@ivan
ivan / thelounge.user.js
Last active July 29, 2018 16:24
Fix thelounge styling
// ==UserScript==
// @name thelounge: Fix styles
// @namespace thelounge_styles
// @include http://YOURDOMAIN:9000/*
// @version 1
// @grant GM_addStyle
// @run-at document-start
// ==/UserScript==
GM_addStyle(`
@ivan
ivan / 0001-Activate-IME-to-use-Hiragana-input-by-default.patch
Created April 5, 2018 07:47
Fix mozc to use Hiragana input by default
From 2777305b6b2cf2302c1e91592a7afd2f743b021e Mon Sep 17 00:00:00 2001
From: Ivan Kozik <[email protected]>
Date: Sat, 3 Mar 2018 11:30:13 +0000
Subject: [PATCH] Activate IME to use Hiragana input by default
---
src/unix/ibus/property_handler.cc | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/unix/ibus/property_handler.cc b/src/unix/ibus/property_handler.cc
@peti
peti / README.md
Last active January 29, 2024 00:21
Make NixOS provide version-specific LOCALE_ARCHIVE environment variables

This NixOS code ensures that the system provide version-specific $LOCALE_ARCHIVE environment variables to mitigate the effects of NixOS/nixpkgs#38991.

To deploy it, copy the file into your /etc/nixos folder using a file name like multi-glibc-locale-paths.nix. Then edit your configuration.nix file to contain the attribute:

imports = [ ./multi-glibc-locale-paths.nix ];
@ivan
ivan / gron.py
Last active July 16, 2018 10:08
gron in Python
#!/usr/bin/python3 -SB
import re
import sys
import json
def main():
o = json.loads(sys.stdin.read())
gron(["json"], o)
//
// Author: Jonathan Blow
// Version: 1
// Date: 31 August, 2018
//
// This code is released under the MIT license, which you can find at
//
// https://opensource.org/licenses/MIT
//
//
@ivan
ivan / google-chrome.sh
Last active September 10, 2018 05:55
Share a Chrome profile on multiple Linuxes without Chrome Sync
#!/bin/bash
set -eu -o pipefail
# We share a Chrome profile on multiple machines using a network filesystem,
# but we can't have more than one Chrome using it at the same time.
#
# Read SingletonLock to determine which machine Chrome is running on
# and Chrome's PID, then quit it on the remote machine if necessary.
@ivan
ivan / about:config prefs
Last active February 26, 2024 07:19
Firefox settings and extensions
# Disable about:config warning
general.warnOnAboutConfig -> false
# Start up with tabs from last session
browser.startup.page -> 3
# Use blank new tab page
browser.newtabpage.enabled -> false
# Denser UI