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

@abesto
abesto / dependency-report.gradle
Created July 24, 2015 14:06
Gradle: multi-project dependency graph
task dependencyReport {
doLast {
def file = new File("project-dependencies.dot")
file.delete()
file << "digraph {\n"
file << "splines=ortho\n"
rootProject.childProjects.each { item ->
def from = item.value
from.configurations.compile.dependencies
.matching { it in ProjectDependency }
@JakeWharton
JakeWharton / build.gradle
Last active February 7, 2023 10:49
Prevent wildcard versions in your Gradle project. These undermine deterministic and hermetic builds and are generally considered bad practice.
allprojects {
afterEvaluate { project ->
project.configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.version.contains('+')) {
throw new GradleException("Wildcard dependency forbidden: ${requested.group}:${requested.name}:${requested.version}")
}
}
}
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active July 18, 2024 07:57
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

@ilguzin
ilguzin / gist:6606011
Last active March 9, 2018 07:46
How to convert Java Key Store file to pem/key for nginx
1. Convert our ".jks" file to ".p12" (PKCS12 key store format):
keytool -importkeystore -srckeystore oldkeystore.jks -destkeystore newkeystore.p12 -deststoretype PKCS12
1.1. List new keystore file contents:
keytool -deststoretype PKCS12 -keystore newkeystore.p12 -list
2. Extract pem (certificate) from ".p12" keysotre file:
@jasonrudolph
jasonrudolph / 00-about.md
Created September 21, 2012 18:42
Rough Notes from Strange Loop 2012
@OscarGodson
OscarGodson / connect_mongohq_node.js
Created September 11, 2011 04:25
How to connect to MongoHQ with Node + node-mongodb-native
/**
* To get all the info to login, sign into your MongoHQ account, go to the db you want,
* click the "Database Info" tab, then look for the line that looks like:
* -------------------------------------------------------------
* mongodb://<user>:<password>@staff.mongohq.com:10056/node-test
* ---------| |-| |------------------| |-| |
* USER PASSWORD PORT DB NAME
*
* ALSO, for testing, you should manually add a document and collection into MongoHQ
* from their "Add a Collection" > "Add a Document" links, then below we'll log it.