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
#!/usr/bin/env rust-script | |
//! ```cargo | |
//! [dependencies] | |
//! anyhow = "1.0.96" | |
//! argh = "0.1.13" | |
//! casual = "0.2.0" | |
//! indexmap = "2.7.1" | |
//! serde = { version = "1.0.218", features = ["derive"] } | |
//! serde_json = "1.0.139" | |
//! ureq = { version = "3.0.8", features = ["json"] } |
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
/** | |
* 1. Update the labels JSON object. | |
* 2. Open web browsers | |
* 3. Navigate to desired GitHub repository. | |
* 4. Navigate to Issues tab. | |
* 5. Navigate to Labels link. | |
* 6. Open web browswer Developer Tools | |
* 7. Navigate to the Console window. | |
* 8. Copy and Paste the below code snippets into the Console window. | |
*/ |
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
// Result of running https://gist.github.com/ToadKing/b883a8ccfa26adcc6ba9905e75aeb4f2 | |
// through https://github.com/abend0c1/hidrdd | |
// | |
//-------------------------------------------------------------------------------- | |
// Decoded Application Collection | |
//-------------------------------------------------------------------------------- | |
/* | |
05 01 (GLOBAL) USAGE_PAGE 0x0001 Generic Desktop Page | |
15 00 (GLOBAL) LOGICAL_MINIMUM 0x00 (0) <-- Info: Consider replacing 15 00 with 14 |
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
// go on you labels pages | |
// eg https://github.com/cssnext/cssnext/labels | |
// paste this script in your console | |
// copy the output and now you can import it using https://github.com/popomore/github-labels ! | |
var labels = []; | |
[].slice.call(document.querySelectorAll(".label-link")) | |
.forEach(function(element) { | |
labels.push({ | |
name: element.textContent.trim(), |
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
class Window: | |
def __init__(self, *args, window=2, step=1): | |
self.iterator = iter(*args) | |
self.window = window | |
self.step = step | |
self.buffer = () | |
def __iter__(self): | |
return self |
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
#!/usr/bin/env bash | |
containers=$(docker ps -a -q) | |
# Stop all containers | |
if [ ! -n "$containers" ]; then | |
docker stop $containers | |
docker rm $containers | |
fi |
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 inspect | |
import pickle | |
def allow_picklable_inner_classes(cls): | |
for name in dir(cls): | |
inner = getattr(cls, name) | |
if not name.startswith('_') and inspect.isclass(inner): | |
new_name = '{}.{}'.format(cls.__name__, inner.__name__) |
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
class DictSet(dict): | |
""" | |
A dictionary type that allows set operations for nested dictionaries. | |
""" | |
def __or__(self, other): | |
return self.union(other) | |
def __and__(self, other): | |
return self.intersection(other) |
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
#!/usr/bin/env bash | |
package_and_size() { | |
local size=$(apt-get -y --print-uris install $1 | sed -n -e 's/Need to get \(.*\) of archives./\1/p') | |
printf "%-30s%s\n" "${1}" "${size}" | |
} | |
for pkg in "$@"; | |
do | |
package_and_size $pkg |