Skip to content

Instantly share code, notes, and snippets.

@gistub
gistub / remove_podman.sh
Created January 6, 2025 01:53
[macOS: Remove podman] uninstall podman that was installed using their pkg installer
podman machine stop
podman machine rm
sudo sfltool dumpbtm | grep pod
sudo /usr/local/podman/helper/hamid/podman-mac-helper uninstall
sudo rm -rf /usr/local/podman
sudo rm -frv /opt/podman
sudo rm /var/run/podman-helper-hamid.socket
sudo rm /etc/paths.d/podman-pkg
rm -fr ~/.local/share/containers
@gistub
gistub / wow_macro_snippets.md
Last active November 16, 2024 09:28
[WoW Snippets] Small useful snippets #lua #wow #macro

/console cameraIndirectiveVisibility 1

-To find out current zone map id type

/dump C_Map.GetBestMapForUnit("player")

-To get spell IDs from Dungeon Journal, Mouseover the spell and use this macro:

/dump GetMouseFocus():GetParent().spellID

@gistub
gistub / docker_daemon_ssh.md
Last active October 27, 2023 10:34
[Remote Docker Daemon] Access Docker daemon remotely #docker #ssh

Override the service, something like sudo systemctl edit docker.service

[Service]
ExecStart=
ExecStart=/usr/sbin/dockerd

Then add "hosts": ["unix:///var/run/docker.sock", "tcp://127.0.0.1:2375"] to /etc/docker/daemon.json

@gistub
gistub / mdfind_query_howto.md
Last active July 24, 2022 00:55
[macOS: mdfind query ] How to find and create queries for Spotlight/Finder #macos #spotlight #mdfind

Figure out queries generated by macOS

  • Do a search in Finder, save it. Then find the saved search in ~/Library/SavedSearch and 'Get Info'

Gel list of all attirbutes

  • Run mdimport -X or mdimport -A

Examples

  • Find all files containing instmodsh mdfind '(** = "instmodsh*"cdw)'
@gistub
gistub / timemachine_on_linux.md
Last active November 28, 2024 13:24
[macOS: Set up time machine on linux] Use samba and avahi #macos #linux #setup

Note: change the settings marked with <=== according to your network and user settings

Required packages

  • avahi sudo apt install avahi-daemon
  • samba sudo apt install samba

On manjaro we need to enable AUR packages to install netatlak.

Enable services

@gistub
gistub / unix_socket_datagram_stream_rust.md
Last active September 13, 2024 08:24
[Rust: Unix Domain Socket] bidirectional socket in #rust

To create a bidirectional unix IPC:

  1. Server creates a sockets and binds it to an address (typically a file). Do NOT use connect as all send/recv operation will be done using connect's address!
  2. Client creates a socket and binds it to its own address. However the socket connects to the address of server.
  3. Server uses recv_from to get data from socket along side with the address of the client that sent the data. This way it can use the address to send a response back to client.

Example in Rust

server.rs

@gistub
gistub / main.rs
Last active July 24, 2022 02:10
[Rust: Book exercises]
#![allow(unused_variables)]
fn main() {
let mut v1 = vec![1, -5, 10, 3, 1, 0];
let mut v2 = vec![31, 5, 10, 3, 1, -83, -83, -83, 9, 10, 8];
let mut v3 = vec![5, 31, 5, 180, 3, 1, -83, 9, 10, 8];
println!("mean of v1: {}", mean(&v1));
println!("median of none: {:?}", median(&mut Vec::new()));
println!("median of v1: {:?}", median(&mut v1));
println!("median of v2: {:?}", median(&mut v2));
@gistub
gistub / pip_parallel_upgrade.sh
Last active July 24, 2022 02:08
[Misc: Upgrade pip packages in parallel] #snippet
pip list -o --format=legacy | cut -f 1 -d " " | parallel pip install --upgrade
@gistub
gistub / build-zsh.sh
Last active October 5, 2022 14:37
[Misc: Build ZSH from Source] #setup
#!/bin/sh
# Build Zsh from sources on Ubuntu.
# From http://zsh.sourceforge.net/Arc/git.html and sources INSTALL file.
# Some packages may be missing
# sudo apt-get install -y git-core gcc make autoconf yodl libncursesw5-dev texinfo
sudo apt-get build-dep zsh
git clone git://git.code.sf.net/p/zsh/code zsh
@gistub
gistub / zfs_snapshot.sh
Last active July 24, 2022 02:02 — forked from indication/zfs_snapshot.sh
[ZFS Snapshot with rotation]
#!/bin/sh
#
# zfs snapshot auto-rotation
#
# usage: zfs_snapshot.sh <mountpoint> <snapshot name> <number of keeping snapshots> [recursive]
#
# recursive option: Recursively create snapshot (zfs snapshot -r)
#
# for crontab
#