Skip to content

Instantly share code, notes, and snippets.

View Amar1729's full-sized avatar

Amar Paul Amar1729

View GitHub Profile
# sdkman recommands settings SDKMAN_DIR and sourcing sdkman-init.sh
# this can really slow down shell startup, so here's my attempt to lazy-load sdk()
#
# This snippet lives in my ~/.profile but generally could live in any zsh-related startup file.
#
# the logic of this custom sdk is kind of odd, but it basically checks if the current
# definition of sdk() is too short (less than 10 lines). If so, it tries to source
# the init script and then pass through all the arguments to the real sdk function.
export SDKMAN_DIR="$HOME/.sdkman"
@Amar1729
Amar1729 / _tmux-a.zsh
Last active December 19, 2022 02:38
_tmux-a.zsh completions
#compdef _tmux-a tmux-a
# Complete attached-sessions and detached-sessions as separate tags.
# function __tmux-sessions-separately {
function _tmux-a {
local ret=1
local -a sessions detached_sessions attached_sessions
sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
detached_sessions=( ${sessions:#*"(attached)"} )
attached_sessions=( ${(M)sessions:#*"(attached)"} )
@Amar1729
Amar1729 / enokey.patch
Last active December 19, 2022 02:38
PATCH: enokey (hivexsh)
diff --git a/sh/hivexsh.c b/sh/hivexsh.c
index b925ddb..8676291 100644
--- a/sh/hivexsh.c
+++ b/sh/hivexsh.c
@@ -27,6 +27,9 @@
#include <unistd.h>
#include <assert.h>
#include <errno.h>
+
+#define ENOKEY 126
@Amar1729
Amar1729 / libguestfs-gnulib.patch
Last active December 19, 2022 02:38 — forked from zchee/libguestfs-gnulib.patch
PATCH: libguestfs gnulib
diff --git a/configure b/configure
index 65f1145..068f21f 100755
--- a/configure
+++ b/configure
@@ -24432,9 +24432,9 @@ if ${gl_cv_func_getcwd_abort_bug+:} false; then :
$as_echo_n "(cached) " >&6
else
# Remove any remnants of a previous test.
- rm -rf confdir-14B---
+ # rm -rf confdir-14B---
@Amar1729
Amar1729 / delete_bad_emojis.py
Last active September 28, 2022 19:05
Batch upload icon links as emojis to mattermost
#! /usr/bin/env python3
import os
import sys
import time
from typing import Any, Generator
# local
import iface
@Amar1729
Amar1729 / main.py
Created January 26, 2021 02:56
use telethon to send a bunch of messages (replies to polls) to a telegram chat
#! /usr/bin/env python3
import datetime
import json
from telethon.sync import TelegramClient
from telethon.tl.types import InputPeerChat, MessageMediaPoll
# expects a settings.py in the same directory with these vars defined
from settings import API_ID, API_HASH, CHAT_ID
@Amar1729
Amar1729 / gtkrc
Created September 25, 2020 23:46
gruvbox gtk theme for Deluge.app
# Please keep this gtkrc in sync with the other ones from Clearlooks based themes.
# gruvbox - based colors
gtk-color-scheme = "base_color:#282828\nfg_color:#ebdbb2\ntooltip_fg_color:#bdae93\nselected_bg_color:#458588\nselected_fg_color:#282828\ntext_color:#928374\nbg_color:#3c3836\ntooltip_bg_color:#fabd2f"
style "default" {
xthickness = 1
ythickness = 1
@Amar1729
Amar1729 / upload.sh
Created February 23, 2019 00:29
Batch upload icon links as emojis to RocketChat.
#!/usr/bin/env bash
# Author: Amar Paul
# Add custom emojis to a rocketchat server.
# Usage:
# Expects a yaml/ dir with .yaml files, formatted as such:
# - name: <name_of_emoji>
# src: <src_url>
#
#!/usr/bin/env python3
'''
Import Google Reader starred items to Pocket
============================================
This script will read the list of starred items generated by exporting your
Reader data using [Google Takeout][]. Generally you will use it like this:
python import-to-pocket.py starred.json
@Amar1729
Amar1729 / arch-linux-install.sh
Last active June 15, 2020 23:45 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# boot loaders (helpful when dual-booting): https://wiki.archlinux.org/index.php/Arch_boot_process#Boot_loader
# - GRUB and rEFInd are quite popular
# General recommendations (after install): https://wiki.archlinux.org/index.php/General_recommendations
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux