Skip to content

Instantly share code, notes, and snippets.

View IamFaizanKhalid's full-sized avatar
🪄
What's life without a few dragons?

Faizan Khalid IamFaizanKhalid

🪄
What's life without a few dragons?
  • Mansehra, Pakistan
  • 22:31 (UTC +05:00)
View GitHub Profile
@IamFaizanKhalid
IamFaizanKhalid / git-commands.md
Created February 12, 2020 12:39
Markdown file containing git related commands..

Git Commands

  • Initialize an empty repository
    $git init
  • Add files to staging area
    $git add filename.ext
  • Check changings status
@IamFaizanKhalid
IamFaizanKhalid / script.scala
Last active February 17, 2020 11:21
File to be used during learning Scala..
#!/bin/bash
exec scala "$0" "$@"
!#
args.foreach(arg => print(arg+" "))
println("\n")
args.foreach(println)
println("\n")
@IamFaizanKhalid
IamFaizanKhalid / wallpaper
Last active April 2, 2020 13:01
Random Wallpaper from Unsplash
#!/usr/bin/env bash
usage() {
printf "Usage: $0 [-d] [ -p PATH | -t ] [ -o FILENAME ] [ -r RESOLUTION ]\n\n"
printf "\t-d to just download the image\n"
printf "\t-p to save image on specific path.\n"
printf "\t-p to save image in /tmp.\n"
printf "\t-o to save image with specific name.\n"
printf "\t-r to set custom resoltion for image.\n\n"
@IamFaizanKhalid
IamFaizanKhalid / clean-git-repository.sh
Created October 23, 2020 03:37
Delete all git branches except current branch.
git branch | grep -v '^*' | xargs git branch -D

Error

Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

Solution

sudo usermod -a -G docker $USER
@IamFaizanKhalid
IamFaizanKhalid / keep-git-log-opened.sh
Created March 3, 2021 07:59
If `git log` command output is cleared after pressing `q`, change its pager to use `less -F -X` command.
#!/usr/bin/env bash
git config --global --replace-all core.pager "less -F -X"
@IamFaizanKhalid
IamFaizanKhalid / git-commit-author.md
Last active June 30, 2024 09:47
Change author information of previous commits.

Interactive rebase off of a point earlier in the history than the commit you need to modify (git rebase -i <earliercommit>). In the list of commits being rebased, change the text from pick to edit next to the hash of the one you want to modify. Then when git prompts you to change the commit, use this:

git commit --amend --reset-author --no-edit

For example, if your commit history is A-B-C-D-E-F with F as HEAD, and you want to change the author of C and D, then you would...

  1. Update author's info git config --global user.email example@email.com
  2. Specify git rebase -i B (here is an example of what you will see after executing the git rebase -i B command)
@IamFaizanKhalid
IamFaizanKhalid / install_maven_jar.txt
Created June 7, 2021 15:55
Command to install a packaged jar into local maven repository
mvn install:install-file
-Dfile=./lib/RedshiftJDBC41-no-awssdk-1.2.27.1051.jar
-DgroupId=com.amazon.redshift \
-DartifactId=jdbc41
-Dversion=1.2.27.1051
-Dpackaging=jar

Keybase proof

I hereby claim:

  • I am iamfaizankhalid on github.
  • I am iamfaizankhalid (https://keybase.io/iamfaizankhalid) on keybase.
  • I have a public key ASBsKzdTeZIy5l1gGQVd5izLE77jfizTAMBj0Pgz-U-4sgo

To claim this, I am signing this object:

@IamFaizanKhalid
IamFaizanKhalid / wallpaper.cmd
Created November 7, 2022 14:51
Windows script to save wallpapers from Windows Spotlight to Desktop.
echo off
title Windows Spotlight
cls
echo This will copy all wallpapers from %userprofile%\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets\ to the folder "wallpaper" on the Desktop
pause
cd %userprofile%\Desktop
md wallpaper
cd wallpaper
rem md %date:/=%
rem cd %date:/=%