Skip to content

Instantly share code, notes, and snippets.

@timkuijsten
timkuijsten / random_hash_b62
Created August 10, 2011 19:31
random_key base 62
<?php
/*
* Copyright 2011, Tim Kuijsten
* Released under the MIT license.
* http://creativecommons.org/licenses/MIT/
*/
/**
* Generate a random string of base 62 characters [a-zA-Z0-9].
*
@timkuijsten
timkuijsten / bin2hex.c
Last active December 28, 2019 00:14
binary to hexadecimal
#include <stddef.h>
/*
* Encode binary data into ASCII hexadecimal numbers.
*
* Return the number of hexadecimals written in "out". If "outlen" is at least
* twice as long as "inlen" the result is not truncated.
*/
size_t
bin2hex(char *out, size_t outlen, const unsigned char *in, size_t inlen)
@timkuijsten
timkuijsten / mysql_backup
Last active July 7, 2020 06:46
mysql per database backup without mysql.event warning
#!/bin/sh -
# The important part is not to put the password as an argument to the mysql
# commands, i.e. don't use the -p option. Instead use a .my.cnf file in the home
# dir of the user you are running this script as, i.e. /root/.my.cnf if running
# as root. Make the file readable for the owner only: chmod 400 /root/.my.cnf
# See: http://stackoverflow.com/questions/17829659/securing-backup-credentials-for-mysqldump/17844997#17844997
umask 007
@timkuijsten
timkuijsten / smartos.vbox.md
Last active October 2, 2020 10:55
SmartOS on VirtualBox

VirtualBox config

vbox host vboxnet0 = 192.168.56.1 (static, no dhcp)

vbox smartos guest config:

storage:

  • add ISO

audio:

  • disable