Skip to content

Instantly share code, notes, and snippets.

@carsonip
carsonip / funny.md
Last active December 18, 2017 16:07
Random funny stuff
@carsonip
carsonip / shell.md
Last active August 7, 2020 06:53
Handy shell scripts
*PPD-Adobe: "4.3"
*%================================================
*% Copyright(C) 2011 Brother Industries, Ltd.
*% "Brother MFC-J615W CUPS"
*%================================================
*%==== General Information Keywords ========================
*FormatVersion: "4.3"
*FileVersion: "1.00"
@carsonip
carsonip / azure-blob-container-size.ps1
Created February 8, 2018 09:56
Get Azure Blob Storage container size without System.OutOfMemoryException
# 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(
@carsonip
carsonip / fcitx.md
Created May 14, 2018 03:23
Install fcitx in Linux Mint 18.3 (Ubuntu 16.04)
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:

@carsonip
carsonip / qsort.py
Last active October 17, 2018 08:18
Quicksort Python
"""
A practice of different implementations of Quicksort
Programming Pearls: column 11
"""
import random
import time
import sys
sys.setrecursionlimit(15000)
@carsonip
carsonip / heap.py
Last active October 20, 2018 15:55
Heap, Heapsort Python
"""
Heap (Min Heap), Heapsort
Programming Pearls: column 14
"""
import sys
import random
import time
sys.setrecursionlimit(1500)
@carsonip
carsonip / mysql.md
Last active June 3, 2020 08:54
Handy MySQL commands

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
@carsonip
carsonip / python.md
Created February 25, 2019 04:28
Handy Python snippets
@carsonip
carsonip / bash.md
Last active November 1, 2019 02:43
Bash magic

Argument

echo $1 $2  # argument by position
echo $@  # all arguments

Default

echo ${x:-default value}  # equiv to python: "x or 'default value'"