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
# 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
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 / 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()));
@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 
@eric-vader
eric-vader / Nvidia Fedora FC28.sh
Created July 25, 2018 06:59
Nvidia Fedora FC28
sudo dnf config-manager --add-repo=https://negativo17.org/repos/fedora-nvidia.repo
sudo dnf install kernel-devel dkms dkms-nvidia nvidia-driver nvidia-settings vulkan.i686 nvidia-driver-libs.i686
sudo dkms autoinstall
@eric-vader
eric-vader / Android Studio
Created July 22, 2018 16:08
Android Studio
echo "
[Desktop Entry]
Name=Android Studio
Exec=/opt/google/android-studio/bin/studio.sh
Icon=/opt/google/android-studio/bin/studio.png
Type=Application" > ~/.local/share/applications/android-studio.desktop