Skip to content

Instantly share code, notes, and snippets.

@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@ubergarm
ubergarm / docker-nsinit-howto.md
Last active January 11, 2016 16:17
How to compile nsinit for Docker to access a shell in a running container.

Docker nsinit

nsinit provides a handy way to access a shell inside a running container's namespace. This is useful for learning about how containers work, debugging your system without worrying about sshd daemons, and even hot fixes in production all you sad pandas!

:p

Running the docker daemon with the lxc driver allows you to use lxc-attach to do this. But now that docker deafults to the new native libcontainer driver, nsinit is probably the best way to go. jpetazzo's blog has a great high level summary.

The new issue is that the libcontainer .json format is under heavy development so you need to keep an nsinit binary built from the exact release tag from the the docker github repo. The tricky part for me was understanding that golang is designed with certain assumptions about dependencies vs versioning with regards to when you push to master, push to a topic branch, and fork a project.

#!/bin/bash
# relays and shell commands, but swallows any errors and always returns with
# an exit status of 0
#
# Useful when docker 'RUN' command receives error codes when installing
# applications that can be ignored
#
# TODO: if the first arg starts with '-', then only filter using those
# codes. IE: arg1="-100,101". In this case we will swallow any 100,101
# error codes, but nothing else so any other error codes will still get
@keo
keo / bootstrap.sh
Last active January 25, 2024 15:49
Setup encrypted partition for Docker containers
#!/bin/sh
# Setup encrypted disk image
# For Ubuntu 14.04 LTS
CRYPTFS_ROOT=/cryptfs
apt-get update
apt-get -y upgrade
apt-get -y install cryptsetup
@mgax
mgax / glacify.py
Created April 20, 2014 09:23
Compress folder, encrypt, and upload to s3
import os
import sys
import subprocess
from datetime import date
from contextlib import contextmanager
import logging
from cStringIO import StringIO
import boto
@leommoore
leommoore / security_audit_tools.md
Last active August 29, 2015 13:59
Security Audit Tools

#Security Audit Tools

Lynis provides a one stop shop for checking your sites security.Details can be found at http://cisofy.com/lynis

wget http://cisofy.com/files/lynis-1.5.0.tar.gz
tar xfv lynis-1.5.0.tar.gz
cd lynis-1.5.0
sudo ./lynis -c
#!/usr/bin/env python3
"""Backs up data-only volumes to host backup directory using rdiff-backup.
First create a Docker image containing rdiff-backup (named rdiff-backup)
Dockerfile:
FROM ubuntu:precise
RUN apt-get update && apt-install -qy rdiff-backup
``docker build -rm -t rdiff-backup .``
@felix021
felix021 / PortForwarder.py
Last active August 1, 2016 15:22
Bind a local tcp port, and forward requests to a remote port directly.绑定本地tcp端口,并把请求直接转发到远程端口。
#!/usr/bin/python
# simplified from msocks5.py @ https://github.com/felix021/ssocks5
import sys
import signal
try:
import gevent
@rroblak
rroblak / pac_aliases
Last active April 12, 2023 13:49
Package manager-independent bash aliases
# paci - install one or more packages
# pacu - upgrade all packages to their newest version
# pacr - uninstall one or more packages
# pacs - search for a package using one or more keywords
# pacinfo - show information about a package
# pacinstalled - show if a package is installed
# paca - list all installed packages
# paclo - list all packages which are orphaned
# pacdnc - delete all not currently installed package files
# pacfiles - list all files installed by a given package
@hagix9
hagix9 / gist:7286981
Last active December 27, 2015 07:09
Docker0.6.6 Install for CentOS6.4 reference: https://github.com/sciurus/docker-rhel-rpm
# SELinux setting
sed -i.bak "s/\(^SELINUX=\).*/\1disabled/" /etc/selinux/config
#IPv4Forwarding setting
sed -i.bak "s/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/" /etc/sysctl.conf
########################################################################################
# add Repository
rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm