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
#!/usr/bin/env sh | |
# Copyright: see README and LICENSE under the project root directory. | |
# Author: @Leedehai | |
# | |
# File: ncore.sh | |
# --------------------------- | |
# This is a handy script to get CPU core number on Linux and Darwin (macOS). | |
# Logical CPU cores |
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
#!/usr/bin/env python3 | |
# https://gist.github.com/Leedehai/96ae9d03d3d34ec74d59f33087ba5e9f | |
import os, sys | |
import asyncio | |
import hashlib | |
import subprocess | |
from collections import OrderedDict | |
from pathlib import Path | |
from typing import List, Tuple, Union |
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
/** | |
* Copyright (c) 2019 Leedehai. All rights reserved. | |
* Licensed under the MIT License. For details, refer to LICENSE.txt | |
* under the project root. | |
* | |
* File: events.js | |
* ----------------------------------------- | |
* A custom event system so that event dispatching and listening is | |
* available to ordinary objects that are not instances of EventTarget's | |
* child classes. |
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
/** | |
* Copyright (c) 2019 The contributors of https://github.com/gajus/to-string-loader | |
* License under the BSD-3-Clause License. | |
* Copyright (c) 2019 Leedehai. All rights reserved. | |
* Licensed under the MIT License. For details, refer to LICENSE.txt | |
* under the project root. | |
* | |
* File: code-to-string-loader.js | |
* ----------------------------------------- | |
* A fork of to-string-loader (version 1.1.6) for Webpack: |
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
#!/usr/bin/python | |
# Copyright holder unknown, from https://www.acmesystems.it/python_http | |
# Licensed under the CC-BY-SA 4.0 License. | |
# Copyright holder velis, from https://stackoverflow.com/a/17064025/8385554 | |
# Licensed under the CC-BY-SA 4.0 License. | |
# Copyright (c) 2019 Leedehai. All rights reserved. | |
# Licensed under the MIT License. For details, refer to LICENSE.txt | |
# under the project root. | |
# | |
# File: http-server.py |
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
# Run function with delayed retry | |
# | |
# Motivation: BUG_WORKAROUND(ninja): | |
# It seems ninja has some issues with concurrency | |
# because it always tries to open deps log for write even for | |
# read-only operations like "ninja -t query" | |
# | |
# It's like how Pure ALOHA network deals with collision | |
### VERSION 1: using a wrapper function |
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
{ | |
"gitlens.advanced.abbreviatedShaLength": 5, | |
"gitlens.defaultDateStyle": "absolute", | |
"gitlens.defaultDateFormat": "YYYY-MM-D HH:mm:ss Z", | |
"gitlens.blame.highlight.locations": [ | |
"gutter", | |
"overview", | |
"line" | |
], | |
"gitlens.codeLens.enabled": false, |
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
#!/usr/bin/env python | |
# Copyright: see README and LICENSE under the project root directory. | |
# Author: @Leedehai | |
# | |
# File: auto.py | |
# --------------------------- | |
# A master management script, like 'fx' of Google's Fuchsia. | |
# Feeling overwhelmed? Follow README.md's instructions on how | |
# to build and test the project. Make use of option '--help'. | |
# |
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
# This contains two files.. the ls proxy and the vim proxy | |
# Problem I wanted to solve: | |
# when working in terminal, sometimes I mistake ls with vim, or vice versa, when I | |
# am inspecting a directory recursively. When this happens, I have to retype the | |
# command. Yes, '!$' helps me to re-use the previous argument, but I still wish the | |
# experience could be smoother. | |
# Solution: | |
# make ls and vim interchangeable by delegating ls and vim to proxy scripts, and set | |
# alias 'ls' and 'vim' to these scripts. |
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
#!/usr/bin/env python | |
# Tested on Python2.7 and Python3.5 | |
import os, sys | |
import time | |
lines = [ | |
"abc", | |
"abcdefghi", | |
"a", |