Skip to content

Instantly share code, notes, and snippets.

@liyafe1997
liyafe1997 / xinput_set.sh
Created April 3, 2021 18:16
xinput set prop by device name and prop name
# Don't hard code device id and prop id
bash -c "xinput --set-prop $(xinput list --id-only 'Elan Touchpad') 'libinput Tapping Enabled' 1; xinput --set-prop $(xinput list --id-only 'Elan Touchpad') 'libinput Tapping Drag Lock Enabled' 1;"
@liyafe1997
liyafe1997 / autocheckpoint.sh
Created May 30, 2020 14:01
checkpoint everything...
while true
do
if [ ! -d "/run/user/1000/gvfs/smb-share:server=172.16.210.1,share=homes/liyafe1997/Drive" ]; then
echo NAS did not mounted.
exit
fi
date=$(date +%Y-%m-%d-%H-%M-%S)
mkdir -p "/run/user/1000/gvfs/smb-share:server=172.16.210.1,share=homes/liyafe1997/Drive/BackupSITBishe$date"
cp -R * "/run/user/1000/gvfs/smb-share:server=172.16.210.1,share=homes/liyafe1997/Drive/BackupSITBishe$date"
echo $date Backup
@liyafe1997
liyafe1997 / startautorun.ps1
Created May 3, 2020 08:48
for detectiscsi.bat, run the autostart program manually
$key = Get-Item -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
$key.GetValueNames() |
ForEach-Object {
$ValueName = $_
$rv = 1 | Select-Object -Property Name, Type, Value
$tostart = $key.GetValue($ValueName)
echo $tostart
Start-Process cmd "/c $tostart" -WindowStyle Hidden
@liyafe1997
liyafe1997 / detectiscsi.bat
Created May 3, 2020 08:47
For move Desktop to a iSCSI drive and detect at startup(some time iSCSI load slower than explorer.exe)
echo off
title 请不要关闭本窗口
cls
echo 正在连接iSCSI......
echo 如果长时间连接不上,请检查网络
if not exist D:\Desktop (
goto aaa
) else (
exit
)
#!/bin/bash
while(( 1 ))
do
clear
optirun nvidia-smi
sleep 1
done
@liyafe1997
liyafe1997 / RetsartNvidia.sh
Created May 1, 2020 08:12
To restart nvidia gpu and keep it bbswitch on
sudo systemctl restart bumblebeed.service
echo Now bbswitch power state
cat /proc/acpi/bbswitch
echo -------------------------
sudo systemctl stop nvidia-persistenced.service
sleep 1
sudo rmmod ipmi_msghandler ipmi_devintf nvidia nvidia_modeset nvidia nvidia_drm nvidia_uvm
echo -------------------------
sleep 1
sudo rmmod ipmi_msghandler ipmi_devintf nvidia nvidia_modeset nvidia nvidia_drm nvidia_uvm
@liyafe1997
liyafe1997 / systemnote.txt
Last active May 23, 2020 15:47
Ubuntu Linux notes
1. Enable Custom Touchpad setting (But seems only work with gnome-flashback&metacity)
In /usr/share/X11/xorg.conf.d/51-synaptics-userdefined.conf
Section "InputClass"
Identifier "touchpad catchall"
Driver "synaptics"
MatchIsTouchpad "on"
Option "LockedDrags" "true"
Option "PalmDetect" "true"
Option "HorizTwoFingerScroll" "true"
MatchDevicePath "/dev/input/event*"
@liyafe1997
liyafe1997 / sudo.ps1
Created December 22, 2019 03:09
sudo.ps1, sudo for PowerShell, put in C:\Windows then you can sudo in powershell lol. You need sudo.bat(https://gist.github.com/liyafe1997/e036a7c3d4fb3903d567ec6d62c324ef)
If($args){sudo.bat powershell -NoExit -Command "(cd "$pwd");("$args")"}Else{sudo.bat powershell -NoExit -Command "cd "$pwd}
@liyafe1997
liyafe1997 / sudo.bat
Last active December 7, 2020 03:31
sudo for Windows, save as sudo.bat put in C:\Windows then you can sudo lol. Powershell see https://gist.github.com/liyafe1997/93be39df5ffee18a1c14a24122576e15
@echo off
powershell -Command "(($arg='/k cd /d '+$pwd+' && %*') -and (Start-Process cmd -Verb RunAs -ArgumentList $arg))| Out-Null"
@echo on