Skip to content

Instantly share code, notes, and snippets.

View bilalelreda's full-sized avatar

Bilal Elreda bilalelreda

View GitHub Profile
# remove specific file from git cache
git rm --cached filename
# remove all files from git cache
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
@bilalelreda
bilalelreda / vscode-update-permission-denied.txt
Created April 6, 2020 06:07 — forked from iamcryptoki/vscode-update-permission-denied.txt
Fix Visual Studio Code update error "Could not create temporary directory: Permission denied" on macOS.
sudo rm -Rf ~/Library/Caches/com.microsoft.VSCode.ShipIt
sudo rm -Rf ~/Library/Caches/com.microsoft.VSCodeInsiders.ShipIt
@bilalelreda
bilalelreda / ostype.sh
Created March 1, 2020 03:51
How to detect the OS type in a bash script.
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# ...
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
elif [[ "$OSTYPE" == "cygwin" ]]; then
# POSIX compatibility layer and Linux environment emulation for Windows
elif [[ "$OSTYPE" == "msys" ]]; then
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
elif [[ "$OSTYPE" == "win32" ]]; then
# I'm not sure this can happen.
@bilalelreda
bilalelreda / ostype.sh
Created March 1, 2020 03:51
How to detect the OS type in a bash script.
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# ...
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
elif [[ "$OSTYPE" == "cygwin" ]]; then
# POSIX compatibility layer and Linux environment emulation for Windows
elif [[ "$OSTYPE" == "msys" ]]; then
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
elif [[ "$OSTYPE" == "win32" ]]; then
# I'm not sure this can happen.
@bilalelreda
bilalelreda / ostype.sh
Created March 1, 2020 03:51
How to detect the OS type in a bash script.
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# ...
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
elif [[ "$OSTYPE" == "cygwin" ]]; then
# POSIX compatibility layer and Linux environment emulation for Windows
elif [[ "$OSTYPE" == "msys" ]]; then
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
elif [[ "$OSTYPE" == "win32" ]]; then
# I'm not sure this can happen.

Keybase proof

I hereby claim:

  • I am bilalelreda on github.
  • I am bilalelreda (https://keybase.io/bilalelreda) on keybase.
  • I have a public key ASBbkv6Ej0437MqpFml9mxc4RtY4ATq1FJxPY6FRcKQv8wo

To claim this, I am signing this object:

@bilalelreda
bilalelreda / jhead-fix-exif-dates.md
Last active March 1, 2020 03:49
Fix EXIF dates and times with Jhead

Fix EXIF dates and times with Jhead

Installing Jhead on Mac OS X using Homebrew.

brew install jhead
@bilalelreda
bilalelreda / S3 buckets copy.md
Created January 11, 2018 19:18 — forked from ushu/S3 buckets copy.md
Copy between S3 buckets w/ different accounts

This is a mix between two sources:

basically the first resource is great but didn't work for me: I had to remove the trailing "/*" in the resource string to make it work. I also noticed that setting the policy on the source bucket was sufficient. In the end these are the exact steps I followed to copy data between two buckets on two accounts

Basically the idea there is:

  • we allowe the destination account to read the source bucket (in the console for the source account)
  • we log as the destination and start the copy
@bilalelreda
bilalelreda / 0_reuse_code.js
Created March 28, 2017 19:59
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console