Skip to content

Instantly share code, notes, and snippets.

View marcoslin's full-sized avatar

Marcos Lin marcoslin

View GitHub Profile
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@einnocent
einnocent / dotdictify.py
Last active July 24, 2017 20:05
Modified Python Dotdictify
# turn dict into an object that allows access to nested keys via dot notation
# from http://stackoverflow.com/questions/3797957/python-easily-access-deeply-nested-dict-get-and-set
# made three modifications:
# --added `get()` method
# --added `if not dict.__contains__...` to `__contains__()`
# --can now accept None as key
class dotdictify(dict):
def __init__(self, value=None):
if value is None:
pass
@LucaLanziani
LucaLanziani / encrypt.html
Last active September 23, 2023 07:50
AES encryption, equivalent implementation in python (PyCrypto) and Javascript (CryptoJS)
<html>
<head>
<script src="/javascripts/CryptoJS/rollups/aes.js"></script>
<script src="/javascripts/CryptoJS/components/mode-cfb-min.js"></script>
<script src="/javascripts/encrypt.js"></script>
</head>
<body>
</body>
</html>
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active April 2, 2024 20:18
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName("head");
function LABjsLoaded() {
// do cool stuff with $LAB here
}
@jimeh
jimeh / mass_insert_mongo.js
Created September 20, 2009 00:44
Simple MySQL vs. MongoDB Insert benchmark.
for (var i=0; i < 100000; i++) {
db.mass_insert.save({
"first_name": "James",
"middle_name": "Richard",
"last_name": "Windsgate",
"email": "jamesrichardwindsgate@email.com"
});
};