Skip to content

Instantly share code, notes, and snippets.

View vanenshi's full-sized avatar

Amir Hossein Shekari vanenshi

View GitHub Profile
import { BottomSheetModal, BottomSheetModalProps } from '@gorhom/bottom-sheet';
import { useCallback, useRef } from 'react';
import { BackHandler, NativeEventSubscription } from 'react-native';
/**
* hook that dismisses the bottom sheet on the hardware back button press if it is visible
* @param bottomSheetRef ref to the bottom sheet which is going to be closed/dismissed on the back press
*/
export const useBottomSheetBackHandler = (
bottomSheetRef: React.RefObject<BottomSheetModal | null>,
@vanenshi
vanenshi / windows11-global-shortcuts.ahk
Created November 5, 2021 17:36
My Global Shortcuts On Windows (10/11)
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
#SingleInstance
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetCapsLockState, AlwaysOff
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Media Keys
+^!Left::Send {Media_Prev}
+^!Right::Send {Media_Next}
@vanenshi
vanenshi / toggle-vpn-connection.sh
Last active November 5, 2021 17:36
toggle VPN connection bash script
#!/bin/sh
VPN_NAME="<Your-VPN-Connection-NAME>"
if nmcli connection show --active | grep "$VPN_NAME"
then
nmcli connection down id "$VPN_NAME"
else
nmcli connection up id "$VPN_NAME"
fi
@vanenshi
vanenshi / git.md
Last active December 30, 2022 06:46
Git alias for pretty graph

just run the following command in your terminal

git config --global alias.graph "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' --all"

now with the following command you can see the git log as a colorized graph

git graph