Skip to content

Instantly share code, notes, and snippets.

View donaldsteele's full-sized avatar

Don Steele donaldsteele

  • GTR Event Technology
  • Charlotte , NC
View GitHub Profile
<?php
/**
* Reference/source: http://stackoverflow.com/a/1464155/933782
*
* I want a short alphanumeric hash that’s unique and who’s sequence is difficult to deduce.
* I could run it out to md5 and trim the first n chars but that’s not going to be very unique.
* Storing a truncated checksum in a unique field means that the frequency of collisions will increase
* geometrically as the number of unique keys for a base 62 encoded integer approaches 62^n.
* I’d rather do it right than code myself a timebomb. So I came up with this.
*
@donaldsteele
donaldsteele / thumbnail.sh
Created February 4, 2017 19:32
Script to generate movie thumbnails and upload to imgur
#!/bin/bash
#uses mtn (movie thumbnailer) https://sourceforge.net/projects/moviethumbnail/
#requires tahoma font to be installed https://github.com/caarlos0/msfonts/blob/master/fonts/tahomabd.ttf
clientid='3e7a4deb7ac67da'
img=$(mktemp -d)
mtn -f "/usr/share/fonts/truetype/msttcorefonts/tahomabd.ttf" -c 1 -r 8 -D 6 -b 0.80 -B 240 -O $img -o'.jpg' "$1"
for f in $img/*
@donaldsteele
donaldsteele / MainActivity.cs
Last active August 19, 2017 14:05
Xamarin example to receive url or text from other applications. For example when you are on the youtube app and click share.
using Android.App;
using Android.Widget;
using Android.OS;
using Android.Content;
using System.Text;
using System;
namespace AndroidDataReceiver
{
[Activity(Label = "AndroidDataReceiver", MainLauncher = true, LaunchMode = Android.Content.PM.LaunchMode.SingleTop )]
@donaldsteele
donaldsteele / example.php
Last active August 28, 2017 04:54
php 7 , hydrate a class by passing in an array
<?php
//example class:
class myObject
{
public $property1;
public $property2;
public $property3;
@donaldsteele
donaldsteele / test.css
Created September 22, 2017 18:49
test.css
/*! CSS Used from: https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css */
body{margin:0;}
footer{display:block;}
audio{display:inline-block;vertical-align:baseline;}
audio:not([controls]){display:none;height:0;}
a{background-color:transparent;}
a:active,a:hover{outline:0;}
h1{margin:.67em 0;font-size:2em;}
img{border:0;}
button,input,select{margin:0;font:inherit;color:inherit;}
@donaldsteele
donaldsteele / ubuntu_1604_lemp_install.sh
Created October 2, 2017 03:53
Linux eNginx Mysql Php (LEMP) auto install script for ubuntu 16.04
#!/bin/sh
apt-get update && apt-get upgrade
systemctl stop apache2
apt-get remove --purge apache2
apt-get install -y nginx
systemctl start nginx
systemctl enable nginx
systemctl status nginx
apt-get install -y php-fpm php-mysql
apt-get install -y mysql-server
@donaldsteele
donaldsteele / install.sh
Created October 2, 2017 13:57
VPS install bash script for Ubuntu 16.04
# =================== YOUR DATA ========================
SERVER_NAME="some-server-name"
SERVER_IP="111.111.11.11"
USER="someuser"
SUDO_PASSWORD="secret-password-one"
MYSQL_ROOT_PASSWORD="secret-password-two"
@donaldsteele
donaldsteele / install.sh
Created October 2, 2017 13:57
VPS install bash script for Ubuntu 16.04
# =================== YOUR DATA ========================
SERVER_NAME="some-server-name"
SERVER_IP="111.111.11.11"
USER="someuser"
SUDO_PASSWORD="secret-password-one"
MYSQL_ROOT_PASSWORD="secret-password-two"
@donaldsteele
donaldsteele / list_installed.sh
Created January 21, 2018 02:35
find Installed Software Linux
(zcat $(ls -tr /var/log/apt/history.log*.gz); cat /var/log/apt/history.log) 2>/dev/null |
egrep '^(Start-Date:|Commandline:)' |
grep -v aptdaemon |
egrep '^Commandline:'