Skip to content

Instantly share code, notes, and snippets.

View huataihuang's full-sized avatar

Huatai Huang huataihuang

View GitHub Profile
@seguidor777
seguidor777 / kind_static_ips.sh
Last active January 23, 2023 07:48
This script assign static IP to all nodes of a kind cluster
#!/bin/bash
set -e
# Workaround for https://github.com/kubernetes-sigs/kind/issues/2045
all_nodes=$(kind get nodes --name "${CLUSTER_NAME}" | tr "\n" " ")
declare -A nodes_table
ip_template="{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}"
echo "Saving original IPs from nodes"
@FreddieOliveira
FreddieOliveira / docker.md
Last active May 4, 2024 12:04
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@luk707
luk707 / rpi_dwm.md
Last active December 15, 2023 01:39
Setting up DWM on a Raspberry Pi running Raspbian lite

Setting up DWM on a Raspberry Pi running Raspbian lite

Make sure git is intalled

sudo apt install git

Clone the repository from suckless:

@TRPB
TRPB / arch-macbook2018.md
Last active November 20, 2023 13:21
Guide: Running Arch on a 2018 MacBook Pro

Hardware Prerequisites

You'll need at least the following hardware:

  • At least 3 USB-A to USB-C converters or hub with enough ports for at least 3 USB devices if all your devices are USB-A then:
  • A USB drive
  • A USB keyboard
  • USB to Ethernet adapter, compatible USB dongle or USB tethering on a phone
@yushiro
yushiro / kindleDown.js
Last active March 10, 2024 02:01
批量从亚马逊中国区下载kindle上购买的电子书
var curIndex = -1;
function callbackDown(){
if(curIndex >=0) $('input.hideItem_myx')[curIndex].click();
curIndex++;
$('input.hideItem_myx')[curIndex].click();
$('ul button.myx-button-text')[curIndex].click();
//触发下载popup
setTimeout(function(){$('.myx-popover-inner .transcludedContent_myx .contentDetails_myx #contentAction_download_myx').trigger('click');},1000);
setTimeout(function(){$('.dialog_myx .myx-button-primary').trigger('click');},2000);
#!/bin/bash
# Install Shadowsocks on CentOS 7
echo "Installing Shadowsocks..."
random-string()
{
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
}
@wmealing
wmealing / C-states.md
Last active March 29, 2024 22:51
What are CPU "C-states" and how to disable them if needed?

To limit a CPU to a certain C-state, you can pass the processor.max_cstate=X option in the kernel line of /boot/grub/grub.conf.

Here we limit the system to only C-State 1:

    kernel /vmlinuz-2.6.18-371.1.2.el5 ... processor.max_cstate=1

On some systems, the kernel can override the BIOS setting, and the parameter intel_idle.max_cstate=0 may be required to ensure sleep states are not entered:

@cosimo
cosimo / parse-options.sh
Created September 21, 2012 09:31
Example of how to parse options with bash/getopt
#!/bin/bash
#
# Example of how to parse short/long options with 'getopt'
#
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
echo "$OPTS"