Skip to content

Instantly share code, notes, and snippets.

@akora
akora / .zshrc
Last active January 17, 2022 10:45
zsh-prompt-macos-catalina
# compaudit | xargs chmod g-w
autoload -Uz compinit && compinit
autoload -U promptinit && promptinit
autoload -U colors && colors # Enable colors in prompt
autoload -Uz vcs_info
precmd() { vcs_info }
setopt prompt_subst
# The below is based on the fantastic work of Josh Dick from
# https://joshdick.net/2017/06/08/my_git_prompt_for_zsh_revisited.html
@rikka0w0
rikka0w0 / ubuntu_live_custom.md
Last active October 28, 2022 02:41
Customize Ubuntu 18.04 Live CD
  • Without the bootloader, you only need these files in casper/ to boot into live ubuntu: filesystem.squashfs initrd vmlinuz
  • The casper boot script will mount anything named with ".squashfs" to the lower layer of the overlayfs during boot. In this case, I'm creating my own "myroot.squashfs" to add packages and files into the live ubuntu, without having to unpack the existing "filesystem.squash". This saves a lot of time.

1. Mount everything:

Mount the original squashfs as the base (lower2), then mount the overlayfs with our committed changes (lower1) into myroot. Changes will be recorded in upper.

mkdir lower1 lower2 upper work
sudo mount -t squashfs /cdrom/casper/filesystem.squashfs lower2
sudo mount -n -t overlay overlayfs:/overlay -o lowerdir=lower1:lower2,upperdir=upper,workdir=work,index=on,redirect_dir=nofollow myroot
@constrict0r
constrict0r / preseed-late-command.sh
Last active February 22, 2022 07:59
Preseed late command
# Post install script.
# Execute kick.sh to setup the system.
d-i preseed/late_command string \
wget https://raw.githubusercontent.com/constrict0r/kick/master/kick.sh -O /target/usr/local/sbin/kick.sh; \
chmod +x /target/usr/local/sbin/kick.sh; \
cp /custom-config.yml /target/usr/local/sbin/custom-config.yml &>/dev/null; \
sed -i '/^\ *deb\ cdrom/s/^\(.*\)$/#\1/' /target/etc/apt/sources.list; \
mkdir /dev/shm; \
mount --bind /dev/pts /target/dev/pts; \
mount --bind /dev/shm /target/dev/shm; \
@delthas
delthas / fdroid_gplay.md
Last active January 7, 2025 20:46
making a F-droid repo for Google Play apps

making a F-droid repo for Google Play apps

with support for downloading both free and paid apps you own

summary

  • set up a token dispenser, used to get a login cookie to use the google play unofficial api
  • run gplaycli to download the apks (uses the token dispenser)
  • run fdroid to generate all the filed and metadata from the apks
  • serve the output directory with an http server
@gpetuhov
gpetuhov / ubuntu_usb_fix.txt
Last active September 26, 2024 03:54
Ubuntu USB autosuspend disable
If Android phone constantly disconnects:
1. Try to disable Ubuntu USB autosuspend
https://www.makeuseof.com/tag/fix-usb-device-port-linux/
cat /sys/module/usbcore/parameters/autosuspend
(if the result is 2, then autosuspend is enabled)
sudo nano /etc/default/grub
Change
@champtar
champtar / gist:76611d614949ba90a3bf6411d3cb7f75
Created August 2, 2019 23:40
Huawei redfish 412 precondition failed
$ curl -u 'Administrator:<redacted>' -k https://192.168.1.2/redfish/v1/Systems/1/Bios/Settings -vvvs | jq .
* Trying 192.168.1.2...
* TCP_NODELAY set
* Connected to 192.168.1.2 (192.168.1.2) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
} [5 bytes data]
@plembo
plembo / you-need-spice-vdagent.md
Last active January 27, 2025 00:55
You need spice-vdagent

You need spice-vdagent

Debian or Kali Linux installed to as KVM (libvirtd) guests do not automatically have qemu-guest-agent or spice-vdagent installed. This will prevent seamless movement of the mouse cursor between the guest and host desktop in Virtual Machine Manager (requiring the use of a Ctrl-Alt to release the cursor from the guest window).

To cure this, install both qemu-guest-agent and spice-vdagent on each guest and reboot (the guests).

$ sudo apt install qemu-guest-agent
$ sudo apt install spice-vdagent
@imba-tjd
imba-tjd / .Cloud.md
Last active May 12, 2025 14:50
☁️ 一些免费的云资源

  • IaaS指提供系统(可以自己选)或者储存空间之类的硬件,软件要自己手动装。PaaS提供语言环境和框架(可以自己选)。SaaS只能使用开发好的软件(卖软件本身,如税务会计、表格文字处理)。BaaS一般类似于非关系数据库,但各家不通用
  • 云服务的特点:零前期成本 & 按需付费 & 弹性(类似于租,可随时多加、退掉;但没有残值)、高可用(放在机房中,不同AZ间水电隔离)

其他人的集合

@dreamcat4
dreamcat4 / update-boot2
Last active October 16, 2020 06:58
For luks zfs root pool on ubuntu. Patches for - dual disks, v1.04, for ubuntu 19.04+
#!/bin/sh
#
# /usr/local/bin/update-boot2
#
# Summary:
#
# For luks zfs root pool on ubuntu. Patches for - dual disks, v1.04, for ubuntu 19.04+
#
# a) This patches initrd to remove certain error messages at boot time, that would otherwise
# interfere and prevent the system booting correctly.
@h4de5
h4de5 / gist:2e3fe4997db56325bfbc4a26625c29fb
Last active September 3, 2024 11:15
Synology - Make Plex PMS log to ram (tmpfs)
# change to Plex PMS directory on the nas (volume1 could be different)
cd "/volume1/Plex/Library/Application Support/Plex Media Server"
# stop Plex application for now
sudo synopkg stop "Plex Media Server"
# move away existing logs
mv Logs Logs-bkp
# list directory content
# remember group and userid from user plex and group users
ll -n
# create mount point for the Logs directory with the uid listed above