Skip to content

Instantly share code, notes, and snippets.

View chesney's full-sized avatar

Chesney chesney

  • kubedev.eu
  • The Netherlands
View GitHub Profile
@chesney
chesney / gist:5093a7eb13195a0a05ff89a857e66efd
Last active October 5, 2021 09:00
Remove all docker containers. tail -n+2 starts at the second row, skipping the heading row.
echo "for id in `docker ps -a | awk '{print $1}' | tail -n+2`; docker rm $id"

Keybase proof

I hereby claim:

  • I am chesney on github.
  • I am chesneycar (https://keybase.io/chesneycar) on keybase.
  • I have a public key ASC4xCdoUTzaX-gRpenIG5ZGMo11fhA7e9FZhec2uN-Avgo

To claim this, I am signing this object:

@chesney
chesney / keybase.md
Created January 31, 2019 09:04
keybase identity verification

Keybase proof

I hereby claim:

  • I am chesney on github.
  • I am chesneycar (https://keybase.io/chesneycar) on keybase.
  • I have a public key ASDw33nFxYdx5sC4Qme81C5tO8YnQ4DUEV34V1mx5359Zwo

To claim this, I am signing this object:

@chesney
chesney / JS-LINQ.js
Created April 23, 2018 08:34 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }
@chesney
chesney / language-switch-bookmarklet.js
Created March 29, 2018 11:58 — forked from dennyweiss/language-switch-bookmarklet.js
bookmarklet for switching languages from german to english
javascript:(function() {
/* add this code starting at 'javscript:' as address to a bookmark entry */
var currentUrl = window.location.href;
var targetUrl = null;
var BreakException = {};
var replaceMatrix = [
{ search: '/de/', replace: '/en/'},
{ search: '/de-de/', replace: '/en-us/'}
];
// Convert from/to binary/decimal/hexadecimal. ES6
const convert = {
bin2dec : s => parseInt(s, 2).toString(10),
bin2hex : s => parseInt(s, 2).toString(16),
dec2bin : s => parseInt(s, 10).toString(2),
dec2hex : s => parseInt(s, 10).toString(16),
hex2bin : s => parseInt(s, 16).toString(2),
hex2dec : s => parseInt(s, 16).toString(10)
};
package com.ucont;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;

Restore MySQL from Amazon S3

This is a hands-on way to pull down a set of MySQL dumps from Amazon S3 and restore your database with it

Sister Document - Backup MySQL to Amazon S3 - read that first

1 - Set your MySQL password and S3 bucket, make a temp dir, get a list of snapshots

# Set our variables

export mysqlpass="ROOTPASSWORD"

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc