Skip to content

Instantly share code, notes, and snippets.

#include <time.h>
#ifdef _MSC_VER
/**
* implementation of clock_gettime(CLOCK_MONOTONIC, tv) from unistd.h for Windows
*/
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
@Masterxilo
Masterxilo / gist:492c5c169ef6be54f43fc5e8a9a01232
Created November 26, 2022 23:31
Typescript @types for Google Play Billing/Google Play Developer Console Real-time developer notifications rtdn (Cloud Pub Sub Messages) https://developer.android.com/google/play/billing/rtdn-reference
// couldn't find this anywhere, so here you go
// it's ugly, you can clean it up
/** https://developer.android.com/google/play/billing/rtdn-reference */
// TODO no one made typescript @types package for these?
interface CloudPubSubPublishMessage {
subscription: string;
https://unix.stackexchange.com/questions/24419/terminal-autocomplete-cycle-through-suggestions
set show-all-if-ambiguous on
set show-all-if-unmodified on
set menu-complete-display-prefix on
"\t": menu-complete
"\e[Z": menu-complete-backward
# add to inputrc
$include /etc/inputrc
# ^^ every ~/.inputrc should start like this
# then
set completion-ignore-case on
# OR
echo set completion-ignore-case on | sudo tee -a /etc/inputrc
#!/bin/bash
# add the following line to the end of ~/.bashrc
# adapted from https://unix.stackexchange.com/a/25725/266802
# logs are created in ~
test "$(ps -ocommand= -p $PPID | awk '{print $1}')" == 'script' || (script -f $HOME/$(date +"%Y-%m-%d_%H-%M-%S")_shell.log)
# use e.g. to derive
# INSTALL_DRIVE
# param for grub-install from the --efi-directory param
# $1 is e.g. /boot/efi
# then this will give you the current boot device
# note: grub-install creates device GUID specific boot config - will stop working when you assign new gpt partition guids
echo /dev/$(lsblk -no pkname $(df -P $1 | awk 'END{print $1}'))
#!/bin/bash
echo "$USER ALL=(ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
#!/bin/bash
# see https://blogs.msdn.microsoft.com/commandline/2016/09/22/24-bit-color-in-the-windows-console
pushd /tmp
git clone https://github.com/bitcrazed/24bit-color
cd 24bit-color
rm *.md
chmod +x *
bash <(ls -1 | sed 's:^\(.*\):read -p "Press enter to run \1";./\1:')
@Masterxilo
Masterxilo / permfunction
Last active August 30, 2023 14:46
permfunction
#!/bin/bash
# This script adds a program/script/command called 'permfunction' to you PATH
# permfunction allows you to write system-wide, on-PATH instantly available, persisted scripts, i.e. improved shell functions/aliases/abbreviations/short programs.
#
# TODO also persist these functions as gists for the user
# inspired by
# https://askubuntu.com/questions/1414/how-to-create-a-permanent-alias
# https://askubuntu.com/a/80290/521770
@Masterxilo
Masterxilo / permalias
Last active September 19, 2020 07:17
# Add permalias command to my bash shell
# from
# https://askubuntu.com/questions/1414/how-to-create-a-permanent-alias
# https://askubuntu.com/a/80290/521770
#
# installation:
# { curl -s https://gist.githubusercontent.com/Masterxilo/f1967743fda3a1aded56ebaff4dd097b/raw/permalias | source /dev/stdin ; source ~/.bashrc ; }
#