The form '!' is available for those poor souls who claim they can’t remember whether network byte order is big-endian or little-endian.
https://docs.python.org/2/library/struct.html#byte-order-size-and-alignment
The form '!' is available for those poor souls who claim they can’t remember whether network byte order is big-endian or little-endian.
https://docs.python.org/2/library/struct.html#byte-order-size-and-alignment
Change all files and folders permissions of a directory to 644/755
chmod -R u+rwX,go+rX,go-w /foo
How to count all the lines of code in a directory recursively?
find . -name '*.php' | xargs wc -l
*PPD-Adobe: "4.3" | |
*%================================================ | |
*% Copyright(C) 2011 Brother Industries, Ltd. | |
*% "Brother MFC-J615W CUPS" | |
*%================================================ | |
*%==== General Information Keywords ======================== | |
*FormatVersion: "4.3" | |
*FileVersion: "1.00" |
# this script will show how to get the total size of the blobs in a container | |
# before running this, you need to create a storage account, create a container, | |
# and upload some blobs into the container | |
# note: this retrieves all of the blobs in the container in one command | |
# if you are going to run this against a container with a lot of blobs | |
# (more than a couple hundred), use continuation tokens to retrieve | |
# the list of blobs. We will be adding a sample showing that scenario in the future. | |
# these are for the storage account to be used | |
param( |
sudo apt install fcitx fcitx-config-gtk fcitx-frontend-all fcitx-ui-classic fcitx-ui-qimpanel fcitx-libs-qt fcitx-libs-qt5 fcitx-config-gtk2 fcitx-libs-dev fcitx-frontend-qt4 fcitx-frontend-qt5 fcitx-ui-light
echo 'export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export QT4_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx' >> ~/.xprofile
Install quick classic:
""" | |
A practice of different implementations of Quicksort | |
Programming Pearls: column 11 | |
""" | |
import random | |
import time | |
import sys | |
sys.setrecursionlimit(15000) |
""" | |
Heap (Min Heap), Heapsort | |
Programming Pearls: column 14 | |
""" | |
import sys | |
import random | |
import time | |
sys.setrecursionlimit(1500) |
Kill all threads from a MySQL User
mysql -BNe "SELECT id FROM processlist WHERE user = 'redmine';" information_schema | while read id; do mysqladmin kill $id; done
Debug Tmp Disk Tables
SELECT * FROM performance_schema.events_statements_summary_by_digest order by SUM_CREATED_TMP_DISK_TABLES desc limit 10\G
Count number of items in generator
sum(1 for i in it)
Argument
echo $1 $2 # argument by position
echo $@ # all arguments
Default
echo ${x:-default value} # equiv to python: "x or 'default value'"