Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Source https://stackoverflow.com/questions/36651091/how-to-install-packages-in-linux-centos-without-root-user-with-automatic-depen
pkgname=$1
if [ -z $pkgname ]; then
echo "Usage: ./non-root-yum-install.sh pkgname-here"
exit 1
fi
rand=$(openssl rand -base64 6)
RECOVERY='chromeos_10452.96.0_asuka_recovery_stable-channel_mp'
echo 'cd ~/Downloads/' >> ~/.bashrc
mkdir /home/chronos/image /home/chronos/local /home/chronos/user/Downloads/boot
cd /home/chronos/user/Downloads/boot
wget https://dl.google.com/dl/edgedl/chromeos/recovery/$RECOVERY.bin.zip
unzip $RECOVERY.bin.zip
sudo losetup -fP $RECOVERY.bin
sudo mkfs.ext4 /dev/sda5
sudo mount /dev/sda5 /home/chronos/local
sudo mount /dev/loop1p3 /home/chronos/image -o loop,ro
@binkybear
binkybear / gist:18dab6ef15bfb8052f15c12c6b7777f3
Last active October 15, 2022 19:07
Build lxc for android
# Get Pre-reqs
apt-get install libattr1-dev git unzip make gcc automake pkg-config
# Get Android NDK
cd /root
mkdir -p build && cd build
wget http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip -O /tmp/android-ndk-r10e-linux-x86_64.zip
unzip /tmp/android-ndk-r10e-linux-x86_64.zip -d /root/build
# Set paths
@thomasfr
thomasfr / iptables.sh
Last active April 13, 2024 01:59
iptable rules to allow outgoing DNS lookups, outgoing icmp (ping) requests, outgoing connections to configured package servers, outgoing connections to all ips on port 22, all incoming connections to port 22, 80 and 443 and everything on localhost
#!/bin/bash
IPT="/sbin/iptables"
# Server IP
SERVER_IP="$(ip addr show eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}')"
# Your DNS servers you use: cat /etc/resolv.conf
DNS_SERVER="8.8.4.4 8.8.8.8"
# Allow connections to this package servers
@Apsu
Apsu / failover.sh
Last active February 12, 2024 07:08
An example failover script for dual WAN, using a ping healthcheck and managing default routes appropriately
#!/bin/bash
# Set defaults if not provided by environment
CHECK_DELAY=${CHECK_DELAY:-5}
CHECK_IP=${CHECK_IP:-8.8.8.8}
PRIMARY_IF=${PRIMARY_IF:-eth0}
PRIMARY_GW=${PRIMARY_GW:-1.2.3.4}
BACKUP_IF=${BACKUP_IF:-eth1}
BACKUP_GW=${BACKUP_GW:-2.3.4.5}
@mattratleph
mattratleph / vimdiff.md
Last active April 24, 2024 11:28 — forked from roothybrid7/vimdiff_cheet.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)