adb devices
adb shell
pm list packages -f
pm uninstall -k --user 0 com.oneplus.opbugreport
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -ks registry/v2/_catalog | jq '.["repositories"] | join(" ")' | tr -d '"' | |
curl -ks registry/v2/go/tags/list | jq . | |
curl -ks registry/v2/_catalog | jq . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let regex; | |
/* matching a specific string */ | |
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello" | |
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO" | |
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes... | |
/* wildcards */ | |
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo" | |
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check current bash version | |
bash --version | |
# Install unofficial version of bash | |
brew install bash | |
# List bash binaries | |
which -a bash | |
# Whitelist new bash shell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SEDMAGIC='s;/[^/]*;|____;g;s;____|; |;g' | |
for f in $(find . -name "*.go" -print); do | |
line=$(head -n 1 "$f"); | |
[[ ! -z "$line" ]] && [[ "$line" =~ ^package[\ ][a-z_]+$ ]] && is_package=true | |
if [ "$is_package" = true ]; then | |
tree=$(echo "$f" | sed -e "$SEDMAGIC"); | |
package_name=$(echo $line | cut -d' ' -f 2); | |
echo "$tree $package_name" | |
fi | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################ | |
# I did something terribly wrong, please tell me git has a magic time machine! | |
git reflog | |
# You will see a list of every thing you've done in git, across all branches! | |
# Each one has an index HEAD@{index} | |
# Find the one before you broke everything | |
git reset HEAD@{index} | |
# Magic time machine | |
################ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Add this function to cronjob | |
# This will it every 2 minutes: "2 * * * * /path/to/script" | |
# Define a function to show the notification on MacOS | |
function notify() { | |
if [ $# -eq 3 ]; then | |
osascript -e "display notification \"$2\" with title \"$1\" sound name \"$3\"" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
import BaseHTTPServer | |
def test(HandlerClass=SimpleHTTPRequestHandler, | |
ServerClass=BaseHTTPServer.HTTPServer): | |
protocol = "HTTP/1.0" | |
host = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "net/http" | |
import "net/url" | |
import "io" | |
import "os" | |
import "mime" | |
import "path" | |
import "fmt" | |
import "flag" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smtplib | |
from email.mime.text import MIMEText | |
msg = MIMEText('Loved your locker room talk!') | |
msg['Subject'] = 'Not so confidential stuff here' | |
msg['From'] = '[email protected]' | |
msg['To'] = '[email protected]' | |
s = smtplib.SMTP('smtp.sendgrid.net', 465) |