Skip to content

Instantly share code, notes, and snippets.

View ralphtheninja's full-sized avatar
🏠
Working from home

ralphtheninja

🏠
Working from home
View GitHub Profile
@ralphtheninja
ralphtheninja / debug-globally-installed-dat.md
Created June 9, 2017 15:14
Debug a certain version of globally installed dat for a particular version of node
@ralphtheninja
ralphtheninja / 1-test-close-while-put-segfault.js
Last active June 8, 2017 12:46
some leveldown test files
// segfaults
var levelup = require('levelup')
var db = levelup('./test1.db')
db.put('foo', 'bar', { sync: true }, function (err) {
console.log('back from put', err)
})
db.close(function (err) {
console.log('closed the db', err)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGtm9v4oxj1E9UXWOzx/CUJZkkM0nqtgrBDX7RjQRyRmxY9SatASSb09Wj/hidOsmXht2OZydeidIUPknuDPyspeOebqRgZW/qRxKPeshhZ8ywarJDEkcDmxSrH9Kqji385ZYY6oLbGAnMs4Ge1AUE0HwxPVAYwLnaC2isEmZl0oMReF19kbThH09d58DmkO/ymmS3MLlO+r0U7LZ45nQ/6hvG2e2gtfKsLLQTxPYNu1lPT0umAFXJly9E3FaxqN5npt/DghPDDbHcO9eeLAhC/hBPYnfw/41hWRRNz5+ahcpJtH08uwXJqEZetgKvD6weVSZX2HxaqpaSX5Vstz5d lms@ux301
@ralphtheninja
ralphtheninja / docker-clean.md
Last active December 23, 2016 01:08
Articles, scripts related to docker and cleaning up images, containers etc

ideas and notes

  • gather a bunch of useful clean up commands from below and put into a daily cron job, which should be provisioned to all servers kkthx
  • pipe to xargs using -r, e.g. $(docker ps -a -q -f status=exited) | xargs -r docker rm -v to avoid getting docker rm errors if empty input
  • be careful about removing exited containers together with data containers, e.g. docker rm -v $(docker ps -a -q -f status=exited)
  • think about creating commands that only remove containers that exited some time ago, e.g. docker ps -a | grep Exited | grep "days ago" | awk '{print $1}' | xargs docker rm

commands and tools

@ralphtheninja
ralphtheninja / cleanup_docker.sh
Created December 22, 2016 23:05 — forked from jaronkk/cleanup_docker.sh
Cleanup and reset docker on Jenkins workers / slaves
#!/bin/bash
# This script should be located on each Jenkins slave, and the jenkins user should have permission to run it with sudo
# Attempts to cleanly stop and remove all containers, volumes and images.
docker ps -q | xargs --no-run-if-empty docker stop
docker ps -q -a | xargs --no-run-if-empty docker rm --force --volumes
docker volume ls -q | xargs --no-run-if-empty docker volume rm
docker images -a -q | xargs --no-run-if-empty docker rmi -f
# Stops the docker service, unmounts all docker-related mounts, removes the entire docker directory, and starts docker again.
$ npm run electron
> prebuild-gist@0.0.0 electron /home/lms/tmp/prebuild/13f0c459a1df82297cf8b2013c563c1f
> electron test.js
Gtk-Message: Failed to load module "canberra-gtk-module"
App threw an error during load
Error: Cannot find module './builds/electron-v50-linux-x64.node'
at Module._resolveFilename (module.js:455:15)
at Function.Module._resolveFilename (/home/lms/tmp/prebuild/13f0c459a1df82297cf8b2013c563c1f/node_modules/electron/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
  • 🌱 :seedling: initial commits
  • 🎨 :art: new feature
  • 📡 :satellite: API, back-end, or integration development
  • 📺 :tv: user interface or front-end development
  • 🔧 :wrench: configuration, environment variables
  • 🚧 :construction: work-in-progress, unstable, unusable
  • 🐛 :bug: bugs, broken windows
  • :sparkles: cleanup, touch-ups
  • 💥 :boom: 🔥 :fire: removing code, files, or data
  • 👕 :shirt: when removing linter warnings