Skip to content

Instantly share code, notes, and snippets.

Add config.ssh.insert_key = false in VagrantFile
No supported encrypter found. The cipher and / or key length are invalid.
This Error means that App key hasn't been added or it is invalid. To fix it...
php artisan key:generate
Above commad generates a new key. Confirm in .env file that APP_KEY is updated with new key, if not paste the new key here.
@atifazad
atifazad / gist:61abb37fb2328c60b1d4b658e66deb3a
Created May 3, 2016 10:31
Hash of last commit of a Git branch
Get hash of last commit (eg. 1fa01e4b90a09069a5aa6482a71c5f76118eef9e)
git rev-parse HEAD
Get short hash of last commit (eg. 1fa01e4)
git rev-parse --short HEAD
@atifazad
atifazad / gist:b1986422f9696d2784708b93931e4053
Created May 3, 2016 10:34
Rename a Git branch local and remote
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@atifazad
atifazad / quit.py
Created July 27, 2017 11:19
Python script to close mac apps
import subprocess
import sys
if len(sys.argv) == 1 :
print "missing program name to quit"
else:
program=sys.argv[1]
quitCommand='tell application "' + program + '" to quit'
print "quiting " + program
subprocess.call(['osascript', '-e', quitCommand])
@atifazad
atifazad / sysquit_commands.md
Last active April 24, 2024 01:01
osascript commands to shutdown, restart, sleep and logout mac

Shut down without showing a confirmation dialog:

osascript -e 'tell app "System Events" to shut down'

Shut down after showing a confirmation dialog:

osascript -e 'tell app "loginwindow" to «event aevtrsdn»'
@atifazad
atifazad / mac_shutdown.py
Created July 27, 2017 12:19
Python script to shutdown mac
# -*- coding: utf-8 -*-
import subprocess
subprocess.call(['osascript', '-e', 'tell app "loginwindow" to «event aevtrsdn»'])
#usage: > python mac_shutdown.py
# For further similar system commands: https://gist.github.com/atifazad/6afd3cbedb8819dd7ed7be92dec2dc0d
#import <Foundation/Foundation.h>
@interface Solution : NSObject
- (NSString *)countAndCall: (int) n;
- (NSString *)count:(int) n;
@end
@implementation Solution
- (NSString *)countAndCall: (int) n {
@atifazad
atifazad / Hello World!
Last active February 15, 2020 18:26
Hello World! in various languages and frameworks (embedded in https://atifazad.com/tutorials/general/hello-world/)
This gist contains Hello World examples for several programming languages and framworks. This codes from this gist are being used (as embed code) at Hello World page at my weebsite (https://atifazad.com/tutorials/general/hello-world/)
@atifazad
atifazad / Python Basics
Last active February 16, 2020 17:18
Python programming basics
Python basics step by step examples