Skip to content

Instantly share code, notes, and snippets.

Avatar
🎲
Working

Anuj Khandelwal anujonthemove

🎲
Working
View GitHub Profile
View move-mouse-pointer.py
import pyautogui
import time
#user note:
# cursor will keep moving on 2 diagonals of a 5x5 square and cilcking - better to position it inside the terminal from which this script is triggered
#pyautogui.FAILSAFE = False # uncomment this if you want to disable the pause script if cursor in corner feature
while True:
pyautogui.move(-5,5)
pyautogui.click()
@anujonthemove
anujonthemove / check-gpu-access-tensorflow.py
Created December 17, 2022 01:26
Check if TensorFlow can access GPU
View check-gpu-access-tensorflow.py
import tensorflow as tf
from tensorflow.python.client import device_lib
print(tf.test.is_gpu_available())
print(tf.config.experimental.list_physical_devices('GPU'))
print(device_lib.list_local_devices())
@anujonthemove
anujonthemove / cpp.json
Created June 2, 2022 03:03
Visual Studio Code - Boilerplate code for CPP
View cpp.json
{
// Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@anujonthemove
anujonthemove / dim.sh
Created April 22, 2022 04:51
Ubuntu - change brightness via command line
View dim.sh
echo "Enter brightness percentage: "
read x
xrandr --output eDP-1 --brightness ${x}
echo "Brightness has been changed to ${x}"
echo "Exiting..."
@anujonthemove
anujonthemove / python-version.py
Created March 27, 2022 06:35
Platform - get python version
View python-version.py
def get_python_version():
from platform import python_version
print("python_version: ", python_version())
@anujonthemove
anujonthemove / Python - Vectorization - Triple For Loop.ipynb
Created March 21, 2022 02:23
Triple For Loop Vectorization using Numpy
View Python - Vectorization - Triple For Loop.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anujonthemove
anujonthemove / Python - Vectorization - Double For Loop.ipynb
Created March 21, 2022 02:22
Double For Loop Vectorization using Numpy
View Python - Vectorization - Double For Loop.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anujonthemove
anujonthemove / Python - Vectorization - Single For Loop.ipynb
Last active March 21, 2022 02:22
Single For Loop Vectorization using Numpy
View Python - Vectorization - Single For Loop.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anujonthemove
anujonthemove / run-commands-without-history.sh
Last active January 26, 2022 14:11
Use this function to avoid adding linux commands to history.
View run-commands-without-history.sh
# https://stackoverflow.com/questions/10307280/how-to-define-a-shell-script-with-variable-number-of-arguments
run(){
my_cmd=$1;
# cmd_str='history -d $((HISTCMD)) && $my_cmd';
shift
#echo $my_cmd "$@"
history -d $((HISTCMD-1)) && $my_cmd "$@"
}
@anujonthemove
anujonthemove / rename-terminal-tab.sh
Created December 30, 2021 04:09
Rename terminal tab on Ubuntu 20.x
View rename-terminal-tab.sh
# directly taken from: https://unix.stackexchange.com/questions/177572/how-to-rename-terminal-tab-title-in-gnome-terminal
function set-title() {
if [[ -z "$ORIG" ]]; then
ORIG=$PS1
fi
TITLE="\[\e]2;$*\a\]"
PS1=${ORIG}${TITLE}
}