Skip to content

Instantly share code, notes, and snippets.

View prati0100's full-sized avatar

Pratyush Yadav prati0100

  • Amazon AWS
  • Dresden
View GitHub Profile
@prati0100
prati0100 / disable_touchpad_startup.sh
Created September 25, 2018 14:18
Disables the touchpad of your laptop if a mouse is connected to it. I have set this script to run on start-up, because most of the times I have a mouse attached and don't want the touchpad enabled.
#!/bin/bash
read Mouse <<< $( xinput | grep Mouse )
if [ "$Mouse" = "" ]; then
# No mouse found, so don't disable the TouchPad
exit
else
# Mouse found. Disable the TouchPad
read TPdevice <<< $( xinput | sed -nre '/TouchPad/s/.*id=([0-9]*).*/\1/p' )
@prati0100
prati0100 / resume-post-commit
Created September 30, 2018 11:15
A script to automatically update the last updated of my resume. Run it as a post-commit hook.
#!/bin/bash
# This script automatically updates the Last updated section of my resume
# First, stash whatever changes that are left in the tree and should not be
# committed
git stash &> /dev/null
# Now get today's date and replace that in resume.tex
DATE=`date "+%d %B, %Y"`
sed "s/{Last updated.*}/{Last updated $DATE}/" resume.tex >resume.tex.tmp && mv resume.tex.tmp resume.tex
@prati0100
prati0100 / colors.less
Created June 8, 2019 15:05
Atom darker-one-dark colors.less modification
// Config -----------------------------------
@syntax-hue: 220;
@syntax-saturation: 13%;
@syntax-brightness: 18%;
// Monochrome -----------------------------------
@mono-1: hsl(214, 5%, 75%); // default text
@mono-2: hsl(@syntax-hue, 9%, 55%);
@prati0100
prati0100 / autoexec.cfg
Created June 22, 2019 22:29
CSGO Autoexec
// buy binds generated by csgobuynds.com
bind "kp_end" "buy m4a1; buy ak47;"
bind "kp_downarrow" "buy vest;"
bind "kp_pgdn" "buy vesthelm;"
bind "kp_leftarrow" "buy flashbang;"
bind "kp_5" "buy smokegrenade;"
bind "kp_rightarrow" "buy hegrenade;"
bind "kp_home" "buy incgrenade; buy molotov;"
bind "kp_uparrow" "buy awp;"
bind "kp_pgup" "buy defuser;"
@prati0100
prati0100 / locknosleep.sh
Created June 24, 2019 11:01
Do not turn off the display when locking the screen on GNOME
#!/bin/bash
xdg-screensaver lock
sleep 0.7
xdotool key Ctrl
#!/usr/bin/sh
. git-sh-setup
# Add a Signed-off-by by me when applying patches. Only do this for projects
# you are the maintainer of, and need to add your signoff before pushing out.
SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
#!/bin/bash
RED=$(tput setaf 1)
NORMAL=$(tput sgr0)
# FIXME: I am using porcelain commands to do plumbing work. Maybe fix it in the
# future.
AUTHOR=$(git --no-pager show -s --format='%aN <%aE>')
COMMIT_MSG=$(git --no-pager show -s --format='%B')
COMMIT_ID=$(git --no-pager show -s --format='%h')
#!/bin/bash
function find_globals () {
cut_content="$1"
# Find all the global declarations
globals=$(echo "$cut_content" | grep '^[[:space:]]global ' | sed 's/\s*global //')
if test -z "$globals"; then
return
@prati0100
prati0100 / save_emails.sh
Last active November 9, 2019 04:53
A script to use with neomutt to save a list of tagged emails.
#!/bin/bash
# This script is used to save a list of emails from neomutt's pipe. Be sure to
# set pipe_split in neomutt.
#
# Pass the directory name as the first argument. The email content is expected
# to be in stdin.
#
# The second argument is optional. It can be used to force the patch version to
# be something else. For example, pass v3 as the second argument. Even if the
Git stuff I want to do some time in the future:
[Git gui]
- Edit tools.
- Context menu on file list.
- Fix revert hunk and revert lines not working on added files (files that have
the flag A, not M).
- Add selective staging for added files.
- Add a newline in the commit editor on 80 cols.
- Configurable key bindings?