Skip to content

Instantly share code, notes, and snippets.

View rrdial's full-sized avatar

R Ryan Dial rrdial

  • Tampa, FL
  • 19:11 (UTC -04:00)
View GitHub Profile
@rrdial
rrdial / create.sql
Last active June 17, 2021 18:32
Create WordPress admin user directly in the database
START TRANSACTION;
SET @user_login = 'ryandial';
SET @user_nicename = 'Ryan Dial';
SET @user_email = 'ryan@example.com';
INSERT INTO `wp_users` (`user_login`,
`user_pass`,
`user_nicename`,
`user_email`,
@rrdial
rrdial / snippet.php
Created August 20, 2018 15:51
Laravel Database Query Debugging
<?php
\DB::listen(function($query) {
static $i = 0;
$sql = str_replace('?', '"%s"', $query->sql);
\Log::debug(sprintf('********** Query number %d ********** ', ++$i) . vsprintf($sql, $query->bindings));
});
@rrdial
rrdial / etc-network-interfaces.d-wlan
Created November 14, 2017 01:37
Raspbian WiFi connection
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "<ssid here>"
wpa-psk "<psk here>"
@rrdial
rrdial / ustream.sh
Last active August 29, 2015 14:17
Ustream settings for Ubuntu 14.04
#!/bin/bash
RTMP_URL=CHANGE_ME
KEY=CHANGE_ME
while true;
do
avconv -i rtsp://user:password@ip.webcam.address:554/play2.sdp -ar 44100 -q 3 -f flv "${RTMP_URL}/${KEY}"
sleep 10
done;

Keybase proof

I hereby claim:

  • I am rrdial on github.
  • I am ryandial (https://keybase.io/ryandial) on keybase.
  • I have a public key whose fingerprint is A762 971D 48A2 DD60 AE7E AD14 12CA 4D27 EF82 B5A2

To claim this, I am signing this object:

@rrdial
rrdial / gist:9692570
Created March 21, 2014 18:24
Image conversion techniques
## Square an image by adding padding to appropriate top/bottom or sides
convert {{input_file_name}} \( +clone -rotate 90 +clone -mosaic +level-colors white \) +swap -gravity center -composite {{output_file_name}}
## Optimize and compress a png
pngquant -f --speed 1 {{file_name}}
## Convert an EPS to a web-usable image format
convert -units PixelsPerInch -density 300 {{input_file_name}} -resize 700x700 {{output_file_name}}
mysqldump -u{user} -p --triggers --routines --single-transaction -A > full_dump.$(date "+%F-%T").sql
@rrdial
rrdial / gist:7379539
Created November 8, 2013 23:57
Generally correct permissions for files and folders on Mac. Borrowed from http://www.linuxquestions.org/questions/linux-general-1/chmod-all-files-644-and-files-755-a-542059/.
find . -type d -print0 | xargs -0 chmod 0755 # For directories
find . -type f -print0 | xargs -0 chmod 0644 # For files
@rrdial
rrdial / avconvert.php
Created June 24, 2013 19:22
Very simple script to avconvert an entire folder of videos assuming they have an mp4, m4v, mov extension.
#!/usr/bin/env php
<?php
$raw_videos = __DIR__ . '/raw/';
$converted_videos = __DIR__ . '/converted/';
if (file_exists($raw_videos) and is_dir($raw_videos))
{
if (!file_exists($converted_videos))