Last active
January 26, 2021 21:41
-
-
Save iegik/5c77444b2bd47a5e550d2f0261d2e263 to your computer and use it in GitHub Desktop.
Bash scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Fix permissions | |
sudo chown $USER:$GROUP -R ~/.npm/$1 ~/.bower_components/$1 ~/.node_modules/$1 bower_components/$1 node_modules/$1 build vendor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git st | grep '?? build' | awk '{print $2}' | xargs rm -rf | |
git st | grep ' M build' | awk '{print $2}' | xargs git co |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
p=$1 | |
card_now=$(prime-select query) | |
if [ "$p" == "nvidia" -a "$card_now" != "nvidia" ] | |
then | |
echo Changing graphic card to NVIDIA | |
sudo service lightdm stop | |
sudo sed -i 's/^/#/' /etc/init/gpu-manager.conf | |
sudo prime-select nvidia | |
sudo cp /etc/X11/xorg.conf.nvidia /etc/X11/xorg.conf | |
sudo chattr +i /etc/X11/xorg.conf | |
sudo service lightdm start | |
elif [ "$p" == "intel" -a "$card_now" != "intel" ] | |
then | |
echo Changing graphic card to Intel | |
sudo service lightdm stop | |
sudo sed -i 's/^[#]*//' /etc/init/gpu-manager.conf | |
sudo chattr -i /etc/X11/xorg.conf | |
sudo prime-select intel | |
sudo service lightdm start | |
else | |
echo Wrong argument or this card is using now | |
echo Now using: $card_now | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
docker run -t \ | |
-e DEV=$DEV -e TEST=$TEST -e PROD=$PROD \ | |
-e SSH_AUTH_SOCK=$SSH_AUTH_SOCK \ | |
-v "$SSH_AUTH_SOCK":"$SSH_AUTH_SOCK" \ | |
-v "/root/.ssh":/.ssh \ | |
-v "$PWD":/usr/src/app \ | |
-v "/root/.npm":/.npm \ | |
-v "/root/.config":/.config \ | |
-v "/root/.cache":/.cache \ | |
-v "/root/.local":/.local \ | |
-w /usr/src/app \ | |
--rm node:4 node $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
./node npm $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ps -meo size,pid,user,command | \ | |
#ps -eo size,pid,user,command --sort -pmem,-rss,-vsz | \ | |
sort -nr | \ | |
awk '{ hr=$1/1024 ; printf("%6.0f MB ",hr) } { for ( x=2 ; x<=5 ; x++ ) { printf("%s ",$x) } print "" }' | \ | |
#awk '{ hr=$1/1024 ; printf("%13.6f MB ",hr) } {print $2"\t"$3}' | \ | |
head -n 20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
p="| grep HW | awk '{print $5}'"; | |
g="ifconfig eth0"; | |
o="f0:***"; | |
n="ac:***"; | |
m="30:***"; | |
if [ `$g | grep HW | awk '{print $5}'` == $n ];then | |
$g down | |
$g hw ether $m | |
$g up | |
else | |
$g down | |
$g hw ether $n | |
$g up | |
fi; | |
echo `$g | grep HW | awk '{print $5}'` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
p="org.gnome.system.proxy mode"; | |
g=gsettings; | |
n="'none'"; | |
if [ `$g get $p` == $n ];then | |
export {{http,https,ftp}_proxy,{HTTP,HTTPS,FTP}_PROXY}=http://`gsettings get org.gnome.system.proxy.http host | sed 's/\x27//g'`:`gsettings get org.gnome.system.proxy.http port` | |
export {no_proxy,NO_PROXY}=`gsettings get org.gnome.system.proxy ignore-hosts | sed -s 's/[\x27\x5b ]//g;s/]//'`; | |
export NO_PROXY_LIST=`echo $no_proxy | sed -s 's/,/;/g'`; | |
sudo mv ~/.apt.conf /etc/apt/apt.conf | |
$g set $p manual; | |
else | |
unset {{http,https,ftp}_proxy,{HTTP,HTTPS,FTP}_PROXY}; | |
unset {no_proxy,NO_PROXY}; | |
unset NO_PROXY_LIST; | |
sudo mv /etc/apt/apt.conf ~/.apt.conf | |
$g set $p $n; | |
fi; | |
echo `$g get $p` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment