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
placeholders = ', '.join(['%s'] * len(myDict)) | |
columns = ', '.join(myDict.keys()) | |
sql = "INSERT INTO %s ( %s ) VALUES ( %s )" % (table, columns, placeholders) | |
# valid in Python 2 | |
cursor.execute(sql, myDict.values()) | |
# valid in Python 3 | |
cursor.execute(sql, list(myDict.values())) |
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
sudo apt-get update | |
sudo apt-get dist-upgrade | |
sudo dpkg --add-architecture i386 | |
sudo apt-get update | |
dpkg --print-foreign-architectures | |
sudo dpkg --remove-architecture i386 |
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
#programmatic way | |
$ git diff-tree --no-commit-id --name-status -r bd61ad98 | |
index.html | |
javascript/application.js | |
javascript/ie6.js | |
#user facing way | |
$ git show --pretty="" --name-only bd61ad98 | |
index.html | |
javascript/application.js |
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
>>> b'\xde\xad\xbe\xef'.hex() | |
'deadbeef' | |
and reverse: | |
>>> bytes.fromhex('deadbeef') | |
b'\xde\xad\xbe\xef' |
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 | |
sys.stdout.buffer.write(bytes([0xAA])) |
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
print("Hello there!", end = '') |
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
(gdb) set logging on | |
(gdb) print *this | |
(gdb) set logging off | |
(gdb) shell grep attribute gdb.txt |
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
sudo apt update -y && sudo apt upgrade -y | |
sudo apt install qemu-user qemu-user-static gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu binutils-aarch64-linux-gnu-dbg build-essential | |
#compile statically | |
aarch64-linux-gnu-gcc -static -o hello64 hello.c | |
#compile dynamically | |
aarch64-linux-gnu-gcc -o hello64dyn hello64.c | |
qemu-aarch64 -L /usr/aarch64-linux-gnu ./hello64dyn |
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
ssh -G database | awk '/^hostname / { print $2 }' |
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
sudo xattr -r -d com.apple.quarantine <directory> |