Skip to content

Instantly share code, notes, and snippets.

@Karreg
Karreg / docker-cleanup.sh
Last active October 28, 2020 07:08
Script to cleanup Docker leftovers, related to https://github.com/moby/moby/issues/22207
#!/bin/bash
echo "WARN: This will remove everything from docker: volumes, containers and images. Will you dare? [y/N] "
read choice
if [ \( "$choice" == "y" \) -o \( "$choice" == "Y" \) ]
then
sudo echo "> sudo rights [OK]"
sizea=`sudo du -sh /var/lib/docker/aufs`
@veganista
veganista / file.liquid
Created April 20, 2016 10:56
Debugging Objects in Shopify Templates
<script>console.log({{ product | json }});</script>
@gaearon
gaearon / slim-redux.js
Last active December 3, 2024 06:34
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@chausies
chausies / youtube_history.py
Last active August 29, 2015 14:27
This python script gets all of your youtube viewing history into a convenient text file.
#---------------------------------------------------------------#
# This script manually goes through youtube and collects all #
# of your viewing history into a convenient text file. This #
# might take about 30min to an hour, depending on your #
# computer's RAM, processing speed, and internet connection. #
# Note that this program requires the splinter module to work. #
# Run 'pip install splinter' to get it. #
#---------------------------------------------------------------#
print "Making sure you're not using python 3..."
from splinter import Browser
@schickling
schickling / Rakefile
Last active December 3, 2024 22:57
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)