Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
'''
A script to recursively compare two directories (including file size and file hash changes)
Usage: python3 compare_dirs.py DIR1 DIR2
'''
import os, sys, hashlib, unicodedata
COMPARE_FILES = True # should file sizes be compared if their names are the same?
@umpirsky
umpirsky / userContent.css
Last active November 2, 2023 17:19
Firefox dark theme workaround (https://bugzilla.mozilla.org/show_bug.cgi?id=519763) Inspired by https://wiki.archlinux.org/index.php/Firefox#Unreadable_input_fields_with_dark_GTK.2B_themes. Add it to ~/.mozilla/firefox/xxxxxxxx.default/chrome/userContent.css or using https://addons.mozilla.org/en-US/firefox/addon/stylish/ add-on. add-on.
input:not(.tactile-searchbox-input):not(.urlbar-input):not(.textbox-input):not(.form-control):not([type='checkbox']) {
-moz-appearance: none !important;
background-color: white;
color: black;
}
#downloads-indicator-counter {
color: white;
}
@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

@ahawthorne
ahawthorne / php-opcache.ini
Created June 10, 2015 01:59
php 5.5 opcache
[opcache]
; Determines if Zend OPCache is enabled
;opcache.enable=0
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=0
opcache.enable_cli=1
; The OPcache shared memory storage size.
@chipx86
chipx86 / streaming-tar.py
Last active October 20, 2022 21:17
Sample code to build a tar chunk-by-chunk and stream it out all at once.
#!/usr/bin/env python
#
# Building a tar file chunk-by-chunk.
#
# This is a quick bit of sample code for streaming data to a tar file,
# building it piece-by-piece. The tarfile is built on-the-fly and streamed
# back out. This is useful for web applications that need to dynamically
# build a tar file without swamping the server.
import os
import sys
@nk9
nk9 / largestFiles.py
Last active November 14, 2023 09:47
Python script to find the largest files in a git repository.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
#
@shevron
shevron / test.php
Last active August 29, 2015 14:01 — forked from anonymous/test.php
A better way to write to /dev/null
<?php
// Get 10mb of data from /dev/zero
$infp = fopen('/dev/zero', 'r');
$data = fread($infp, 1024 * 1024 * 10);
fclose($infp);
write_data($data);
echo "Peak memory usage: ", number_format(memory_get_peak_usage()), " bytes\n";
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@denji
denji / http-benchmark.md
Last active May 2, 2024 06:26
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl