This file contains 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 multiprocessing | |
import concurrent.futures | |
import threading | |
name = 'bounded_pool_executor' | |
class _BoundedPoolExecutor: | |
semaphore = None |
This file contains 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
{ | |
--color-scale-black: #010409; | |
--color-scale-white: #f0f6fc; | |
--color-scale-gray-0: #f0f6fc; | |
--color-scale-gray-1: #c9d1d9; | |
--color-scale-gray-2: #b1bac4; | |
--color-scale-gray-3: #8b949e; | |
--color-scale-gray-4: #6e7681; | |
--color-scale-gray-5: #484f58; | |
--color-scale-gray-6: #30363d; |
This file contains 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
function deleteVersionedObject(bucket, key, callback) { | |
var params = { | |
Bucket: bucket, | |
Key: key | |
}; | |
s3.deleteObject(params, function (error, data) { | |
if (error) { | |
console.error("S3Dataset delete error key:%s error:%@", params.key, error); | |
return callback(error); | |
} |
This file contains 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
def trace_mem(nframe=6,top=8): | |
''' | |
naive memory trace | |
''' | |
import tracemalloc | |
is_tracing = tracemalloc.is_tracing() | |
if not is_tracing: | |
# start tracing | |
tracemalloc.start(nframe) | |
return {} |
This file contains 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
async function getObjectAsync(bucket, key) { | |
try { | |
const data = await s3 | |
.getObject({ Bucket: bucket, Key: key }) | |
.promise(); | |
var contents = data.Body.toString('utf-8'); | |
return contents; | |
} catch (err) { | |
console.log(err); | |
} |
This file contains 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
/** | |
* @function stripJSON | |
* @desc - This function removes selected object keys | |
* @param {Object} json - JavaScript object to strip | |
* @param {Object[]} keys - array of selected keys (string) | |
* @return {Object} - deep copy of object without keys | |
*/ | |
function stripJSON(json, keys) { | |
if (json === null || json === undefined) return json; | |
let obj = {}, key; |
This file contains 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
find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete; | |
sudo rm -rf /Library/Caches/com.apple.iconservices.store; | |
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm -rf {} \;; | |
sudo find /private/var/folders/ -name com.apple.iconservices -exec rm -rf {} \;; | |
sudo touch /Applications/*; | |
defaults write com.apple.dock ResetLaunchPad -bool true; | |
killall Dock; | |
killall Finder; |
This file contains 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
# To control logging level for various modules used in the application: | |
import logging | |
import re | |
def set_global_logging_level(level=logging.ERROR, prefices=[""]): | |
""" | |
Override logging levels of different modules based on their name as a prefix. | |
It needs to be invoked after the modules have been loaded so that their loggers have been initialized. | |
Args: | |
- level: desired level. e.g. logging.INFO. Optional. Default is logging.ERROR |
This file contains 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
["Technology", "Investing", "Books", "Gaming", "Computer programming", "Tech news", "Machine learning", "Travel", "Web development", "Arts & culture news", "World news", "Movies", "Home improvement", "Arts & crafts", "Dogs", "Philosophy", "Comedy", "Space", "Business & finance", "Pets", "Information security", "Neon Genesis Evangelion", "Cybersecurity", "Science", "Interior design", "Bitcoin cryptocurrency", "Education", "Architecture", "National parks", "Movies & TV", "Business news", "Food", "PlayStation 5", "Disney", "Fashion", "Psychology", "Language learning", "Gardening", "Fitness", "Music", "Sci-fi & fantasy films", "Science news", "Artificial intelligence", "Visual arts", "Home & family", "Cats", "Cooking", "Harry Potter", "Gaming consoles", "Animal Crossing", "Digital creators", "Sci-fi & fantasy", "Animation", "Star Wars", "Art", "Classic rock", "Tattoos", "Painting", "Travel guides", "Guitar", "History", "PlayStation", "Inspirational quotes", "Running", "PC gaming", "Mobile Suit Gundam", "Gaming ne |
This file contains 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
[ | |
["Technology", "Investing", "Books"], | |
["Gaming", "Computer programming", "Tech news"], | |
["Machine learning", "Travel", "Web development"], | |
["Arts & culture news", "World news", "Movies"], | |
["Home improvement", "Arts & crafts", "Dogs"], | |
["Philosophy", "Comedy", "Space"], | |
["Business & finance", "Pets", "Information security"], | |
["Neon Genesis Evangelion", "Cybersecurity", "Science"], | |
["Interior design", "Bitcoin cryptocurrency", "Education"], |