Skip to content

Instantly share code, notes, and snippets.

@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

@subfuzion
subfuzion / curl.md
Last active May 1, 2024 18:04
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@davidnunez
davidnunez / gist:1404789
Created November 29, 2011 13:20
list all installed packages in android adb shell
pm list packages -f
@sstevan
sstevan / socksimap.py
Last active February 19, 2024 04:59
Python (v2 - v3) - IMAP through SOCKS proxy using PySocks module
import ssl
from socks import create_connection
from socks import PROXY_TYPE_SOCKS4
from socks import PROXY_TYPE_SOCKS5
from socks import PROXY_TYPE_HTTP
from imaplib import IMAP4
from imaplib import IMAP4_PORT
from imaplib import IMAP4_SSL_PORT
@htuscher
htuscher / .gitlab-ci.yml
Created August 3, 2017 08:12
Deploying with docker-compose via SSH tunnel in Gitlab CI
deploy:live:
image: 1drop/docker:git
stage: deploy
when: manual
environment:
name: production
url: https://www.somecustomer.de
before_script:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
@yoavram
yoavram / client.py
Created December 21, 2012 08:41
Example of uploading binary files programmatically in python, including both client and server code. Client implemented with the requests library and the server is implemented with the flask library.
import requests
#http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
url = "http://localhost:5000/"
fin = open('simple_table.pdf', 'rb')
files = {'file': fin}
try:
r = requests.post(url, files=files)
print r.text
@crmccreary
crmccreary / AESCipher.py
Created May 20, 2013 02:17
Encryption using pycrypto, AES, and PKCS5 padding
from Crypto.Cipher import AES
from Crypto import Random
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
class AESCipher:
def __init__( self, key ):
"""
public void transformPage(View view, float position) {
int pageWidth = view.getWidth();
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
view.setAlpha(0);
} else if (position <= 1) { // [-1,1]
public class ParallaxPageTransformer implements ViewPager.PageTransformer {
public void transformPage(View view, float position) {
int pageWidth = view.getWidth();
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
view.setAlpha(1);
@chrcoe
chrcoe / AESCipher.py
Last active November 29, 2021 09:03
PyCrypto AES using ECB mode implementation in Python 3.3. This uses very basic 0x00 padding, I would recommend PKCS5/7
'''
Created on Mar 20, 2014, uses PyCrypto/Python 3.3
@author: Chris Coe
'''
import binascii
from Crypto.Cipher import AES
class AESCipher:
'''