Skip to content

Instantly share code, notes, and snippets.

🕸

Ivan Kozik ivan

🕸
Block or report user

Report or block ivan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ivan
ivan / postgres.rs
Created Feb 28, 2020
Using rust-postgres to put any 16 bytes into a PostgreSQL uuid and a u32 into an int
View postgres.rs
//! Some wrappers implementing ToSql/FromSql to get things in and of postgres.
use bytes::{BytesMut, BufMut};
use byteorder::{BigEndian, ReadBytesExt};
use postgres_types::{Type, FromSql, ToSql, IsNull, accepts, to_sql_checked};
use postgres_protocol::types;
/// 16 bytes stored in a PostgreSQL uuid
#[derive(Debug)]
pub(crate) struct SixteenBytes {
@ivan
ivan / make-audio-feed.sh
Created Feb 23, 2020
Script to generate a Podcasts/Overcast-compatible RSS feed for audio files on your own web server
View make-audio-feed.sh
#!/usr/bin/env bash
# Generates an RSS feed for a list of audio files, for consumption by Overcast.
#
# Usage: make-audio-feed BASE_URL FILE...
# Example: (cd directory && make-audio-feed 'https://your.server/directory/' * > .feed.rss)
set -eu -o pipefail
# https://gist.github.com/cdown/1163649#gistcomment-2157284
@ivan
ivan / pg_tmp_lets_me_truncate.sh
Created Feb 20, 2020
pg_tmp_lets_me_truncate
View pg_tmp_lets_me_truncate.sh
#!/bin/sh
uri=$(pg_tmp)
psql --no-psqlrc "$uri" -c "SELECT SESSION_USER, CURRENT_USER;"
psql --no-psqlrc "$uri" -c "CREATE TABLE dirs (id bigserial PRIMARY KEY);"
psql --no-psqlrc "$uri" -c "REVOKE TRUNCATE ON dirs FROM current_user;"
psql --no-psqlrc "$uri" -c "TRUNCATE dirs;"
@ivan
ivan / nixpkgs-konsole-master.patch
Created Dec 22, 2019
nixpkgs-konsole-master.patch
View nixpkgs-konsole-master.patch
From a6866872917d38678804c838a4db2abd489508d6 Mon Sep 17 00:00:00 2001
From: Ivan Kozik <ivan@ludios.org>
Date: Wed, 18 Dec 2019 06:36:45 +0000
Subject: [PATCH] konsole: 19.08.3 -> unstable-2019-12-18
This fixes the tab activity highlighting, which does not work at all
in 19.08.3.
---
pkgs/applications/kde/default.nix | 4 ++--
pkgs/applications/kde/srcs.nix | 13 +++++++------
@ivan
ivan / nix-shell-for-cargo
Created Nov 29, 2019
nix-shell wrapper for cargo to make cargo builds work on NixOS
View nix-shell-for-cargo
#!/bin/sh
# A nix-shell that includes many packages, so that Cargo projects can build on NixOS.
set -eu
packages=(
pkgconfig
openssl
@ivan
ivan / vscodium-no-detected-link-underline.patch
Last active Nov 30, 2019
nixpkgs vscodium: don't underline detected links
View vscodium-no-detected-link-underline.patch
@ivan
ivan / firefox-and-push-mozilla.sh
Last active Nov 8, 2019
Share Firefox profile between two Linux machines without Firefox Sync
View firefox-and-push-mozilla.sh
#!/usr/bin/env bash
"$@"
if [[ $HOSTNAME != "ra" ]]; then
push-mozilla
fi
@ivan
ivan / xfce4-panel-window-buttons-icon-size.patch
Last active Nov 8, 2019
xfce4-panel: window buttons: fix tiny icons when labels are enabled
View xfce4-panel-window-buttons-icon-size.patch
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 74119d1a..e694f651 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -651,7 +651,7 @@ xfce_tasklist_get_window_icon (WnckWindow *window,
{
GdkPixbuf *pixbuf;
- if (show_labels || type == CHILD_TYPE_GROUP_MENU || size <= 31)
+ if (size <= 31)
@ivan
ivan / use-ctrl-j-to-open-downloads.patch
Last active Nov 8, 2019
Firefox: use ctrl-j to open downloads on Linux
View use-ctrl-j-to-open-downloads.patch
diff --git a/browser/base/content/browser-sets.inc b/browser/base/content/browser-sets.inc
index c90f3aa340ef..fcd9f17e9971 100644
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -129,11 +129,10 @@
#
# Search Command Key Logic works like this:
#
-# Unix: Ctrl+K (cross platform binding)
-# Ctrl+J (in case of emacs Ctrl-K conflict)
@ivan
ivan / sanitize.ex
Last active Nov 3, 2019
Elixir vs Rust: delete all ?ei= or &ei= from URL
View sanitize.ex
defp sanitize_url(s) do
uri = URI.parse(s)
new_query = case uri.query do
nil -> nil
query ->
query
|> URI.decode_query()
|> Map.delete("ei")
|> URI.encode_query()
end
You can’t perform that action at this time.