Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
@Neoklosch
Neoklosch / keybinder.py
Created July 15, 2015 15:31
Basic implementation of keybinding with python xlib
from Xlib.display import Display
from Xlib import X
class KeyBinder(object):
def __init__(self):
self.cancel = False
self.xdisp = Display()
self.xroot = self.xdisp.screen().root
self.key_code = 71 # F5
@wearhere
wearhere / LocalCollection.js
Last active October 4, 2021 18:35
A small, browser-only, read-only client for a Meteor backend. More info and examples at https://mixmax.com/blog/meteor-and-backbone.
/**
* A very lightweight version of Meteor's Minimongo collections,
* a local store for records sent from the Meteor backend.
*/
var LocalCollection = function() {
this._initialize();
};
_.extend(LocalCollection.prototype, Backbone.Events, {
_name: null,
@amontalenti
amontalenti / script-inject-http-proxy.js
Created November 21, 2012 17:16
script injecting proxy for Node.JS
var httpProxy = require('http-proxy');
var url = require('url');
httpProxy.createServer(function(req, res, proxy) {
var isHtml = false,
write = res.write,
writeHead = res.writeHead,
params = url.parse(req.url, true).query,
dest = params.dest || 'localhost',
@tbtlr
tbtlr / index.html
Created May 14, 2012 12:57
How to implement synchronous(ish) Web Worker tasks in Firefox, using JS1.7 Generators.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script type="application/javascript;version=1.7">
var worker = new Worker('worker.js');
var g;