Skip to content

Instantly share code, notes, and snippets.

View eric-vader's full-sized avatar
🎯
Focusing

Eric Han eric-vader

🎯
Focusing
View GitHub Profile
#include <Keyboard.h>
int outSound = 2;
int outFairyRight = 3;
int outFairyLeft = 4;
int inWire = 12;
int powerHigh = 22;
int outLED = 13;
int inButton = 51;
@eric-vader
eric-vader / 8086:7560
Last active November 26, 2023 14:26
l860-gl-16-fcc-unlock
#!/usr/bin/sh
# chmod 700 /usr/share/ModemManager/fcc-unlock.available.d/8086\:7560
# https://forums.lenovo.com/t5/Ubuntu/P14s-Gen-3-Ubuntu-22-Fibocom-L860-GL-not-working/m-p/5177047?page=9#6171504
# https://support.lenovo.com/sg/en/downloads/ds563599-fibocom-wireless-wan-l860-gl-16-fcc-unlock-and-sar-config-tool-for-linux-thinkpad
# https://wiki.archlinux.org/title/Lenovo_ThinkPad_T14_(AMD)_Gen_4
/usr/bin/echo ThinkPad X1 Carbon Gen 10 > product_family
/usr/bin/chmod 600 product_family
/usr/bin/mount -o bind product_family /sys/class/dmi/id/product_family
@eric-vader
eric-vader / setup-fedora.sh
Last active January 5, 2023 17:58
My personal setup script!
#!/bin/bash
# https://www.linuxuprising.com/2020/10/how-to-make-bootable-windows-10-usb-on.html
dnf update -y
# Fix Gnome settings
# ==================
# gsettings set org.gnome.desktop.interface scaling-factor 1
# sudo vi /usr/share/glib-2.0/schemas/org.gnome.desktop.interface.gschema.xml
# sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
# Install VirtualBox
# ==================
@eric-vader
eric-vader / unwatch-gh-org.js
Last active January 23, 2022 16:00 — forked from offirgolan/unwatch-gh-org.js
Unwatch All Org Repos
// Navigate to https://github.com/watching and then run:
(function() {
let qx = $x;
let unwatch = function(org, notificationType) {
let nodes = document.querySelectorAll('.Box-row');
let rows = [ ...nodes ];
let orgRows = rows.filter(e => e.innerText.startsWith(`${org}/`));
let orgUnsubButtons = orgRows.map(row => row.querySelector(`button.SelectMenu-item[value="${notificationType}"]`));
orgUnsubButtons.forEach(button => console.log(button.click()));
# https://unix.stackexchange.com/questions/303286/mdadm-automount-only-works-with-dev-not-uuid
# Remember to always save /etc/mdadm.conf
# https://www.server-world.info/en/note?os=Fedora_31&p=nfs&f=1
# https://unix.stackexchange.com/questions/116971/nfs-server-changes-in-etc-exports-file-need-service-restart
#from https://askubuntu.com/questions/7002/how-to-set-up-multiple-hard-drives-as-one-volume/7841#7841
# Create a media partition with a volume named volume
pvcreate /dev/sda1
vgcreate media /dev/sda1
lvcreate -l100%FREE -nvolume media
mke2fs -t ext4 /dev/media/volume
mkdir /mnt/media
mount /dev/media/volume /mnt/media
# FSTAB record
# /dev/media/volume /mnt/media ext4 defaults 0 1
@eric-vader
eric-vader / convert.sh
Last active May 17, 2021 09:23
Converts all mov files to mp4 using handbrake
#!/bin/bash
# Make sure globstar is enabled
if [[ $# -ne 2 ]] ; then
echo 'Must have 2 arguments!'
exit 1
fi
shopt -s globstar
for EXT in mov MOV
do
for i in $1/**/*.$EXT; do # Whitespace-safe and recursive
def one_trade_profit(prices):
if len(prices) == 0:
return 0
else:
buy_price = prices[0]
profit = 0
for price in prices[1:]:
buy_price = min(price, buy_price)
profit = max(profit, price - buy_price)
return profit
#!/bin/bash
# Since we're dealing with dd, abort if any errors occur
set -e
TEST_FILE=${1:-dd_obs_testfile}
[ -e "$TEST_FILE" ]; TEST_FILE_EXISTS=$?
TEST_FILE_SIZE=134217728
# Header
@eric-vader
eric-vader / increase_root_fedora.md
Created March 10, 2020 14:32 — forked from 181192/increase_root_fedora.md
How to increase the root partition size on Fedora

How to increase the root partition size on Fedora

Boot up with an Fedora Live USB stick.

  1. Run vgs to check if there's any space:
$ sudo vgs
  VG     #PV #LV #SN Attr   VSize    VFree
  fedora   1   3   0 wz--n- <237.28g    0