Skip to content

Instantly share code, notes, and snippets.

View 2KAbhishek's full-sized avatar
🤩
Fixing Tpyos!

Abhishek Keshri 2KAbhishek

🤩
Fixing Tpyos!
View GitHub Profile

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@2KAbhishek
2KAbhishek / change_ext.sh
Created October 26, 2020 08:53
Batch rename extensions of files
#!/bin/bash
# Rename all *.txt to *.text
for f in *.txt; do
mv -- "$f" "${f%.txt}.text"
done
@2KAbhishek
2KAbhishek / fix_ssh.sh
Created October 26, 2020 08:35
Fix SSH key file permissions
#!/bin/bash
chmod 0644 ~/.ssh/id_rsa.pub
chmod 0600 ~/.ssh/id_rsa
@2KAbhishek
2KAbhishek / mirrorlist.sh
Created October 21, 2020 13:25
Generate fastest mirrors for Arch linux
#!/bin/bash
# Install reflector
sudo pacman -S reflector
# Update mirrorlist
reflector | sudo tee /etc/pacman.d/mirrorlist
@2KAbhishek
2KAbhishek / time_space.py
Created June 19, 2020 23:05
Time and Space used in Python
import time, sys
start = time.clock()
for x in range(1000):
pass
end = time.clock()
@2KAbhishek
2KAbhishek / sync_upstream.md
Last active June 7, 2020 03:24
Sync forked repo with upstream after merge

Clone your fork and cd into it

git clone https://github.com/yourname/repo.git
cd yourname/repo

Add upstream remote

@2KAbhishek
2KAbhishek / ffmeg.sh
Created April 6, 2020 02:41
Trim videos instantly
# With start time and duration
ffmpeg -ss $START -i $INFILE -c copy -map 0 -t $DURATION $OUTFILE
# With start time and end time
ffmpeg -ss $START -i $INFILE -c copy -map 0 -to $END $OUTFILE
@2KAbhishek
2KAbhishek / command_substitution.sh
Last active January 22, 2020 16:21
Replace part of last command
# Quick Substitution
^string1^string2
# Global Substitution
!!:gs/string1/string2