Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

neuthral neuthral

🎯
Focusing
  • finland
View GitHub Profile
@neuthral
neuthral / qemu_example.sh
Created Nov 11, 2018
qemu example script #cli #qemu
View qemu_example.sh
#!/bin/bash
configfile=/etc/vfio-pci0.cfg
vfiobind() {
dev="$1"
vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
device=$(cat /sys/bus/pci/devices/$dev/device)
if [ -e /sys/bus/pci/devices/$dev/driver ]; then
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
@neuthral
neuthral / nvidia_temp.sh
Created Nov 11, 2018
nvidia temp #gpu #cli
View nvidia_temp.sh
#!/usr/bin/env bash
nvidia-settings -q GpuCoreTemp | grep -o '[1-9]*'
@neuthral
neuthral / node_npm_latest_install.sh
Created Nov 11, 2018
node and npm in 30 seconds #node #npm #install
View node_npm_latest_install.sh
#!/bin/sh
# A word about this shell script:
#
# It must work everywhere, including on systems that lack
# a /bin/bash, map 'sh' to ksh, ksh97, bash, ash, or zsh,
# and potentially have either a posix shell or bourne
# shell living at /bin/sh.
#
# See this helpful document on writing portable shell scripts:
@neuthral
neuthral / maya2017install.sh
Created Nov 11, 2018
maya2017install #graphics #install
View maya2017install.sh
#!/bin/bash
#Make sure we’re running with root permissions.
if [ `whoami` != root ]; then
echo Please run this script using sudo
echo Just type “sudo !!
exit
fi
#Check for 64-bit arch
if [uname -m != x86_64]; then
@neuthral
neuthral / killUnity.sh
Created Nov 11, 2018
killUnity #unity #cli
View killUnity.sh
#!/bin/bash
echo "killing all unit process"
process=$(ps aux | grep "Unity" | grep -v grep | awk '{print $2}')
for p in $process
do
kill -9 $p
done
echo "removing locks"
@neuthral
neuthral / intx_check.sh
Created Nov 11, 2018
intx_check #processor #cpu
View intx_check.sh
#!/bin/sh
# Usage $0 <PCI device>, ex: 9:00.0
INTX=$(( 0x400 ))
ORIG=$(( 0x$(setpci -s $1 4.w) ))
if [ $(( $INTX & $ORIG )) -ne 0 ]; then
echo "INTx disable supported and enabled on $1"
exit 0
fi
View oh-my-zsh-install.sh
main() {
# Use colors, but only if connected to a terminal, and that terminal
# supports them.
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
View bash_web_server.sh
:;while [ $? -eq 0 ];do nc -vlp 8080 -c'(r=read;e=echo;$r a b c;z=$r;while [ ${#z} -gt 2 ];do $r z;done;f=`$e $b|sed 's/[^a-z0-9_.-]//gi'`;h="HTTP/1.0";o="$h 200 OK\r\n";c="Content";if [ -z $f ];then($e $o;ls|(while $r n;do if [ -f "$n" ]; then $e "<a href=\"/$n\">`ls -gh $n`</a><br>";fi;done););elif [ -f $f ];then $e "$o$c-Type: `file -ib $f`\n$c-Length: `stat -c%s $f`";$e;cat $f;else $e -e "$h 404 Not Found\n\n404\n";fi)';done
@neuthral
neuthral / hosts_google
Created Sep 21, 2017
block google servers in hosts file
View hosts_google
# ALWAYS make sure "127.0.0.1 localhost" is the first line in your /hosts file
# or your system or browser may malfunction!
# See https://en.wikipedia.org/wiki/Hosts_file to find the standard locations
# of the HOSTS file for your particular OS. In Linux (and probably BSD), it's
# usually under /etc/hosts
# Yes, I know there are some redundant entries in this block--you can grep it
# and remove them yourself if it really matters. I'm too lazy to do it myself.
You can’t perform that action at this time.