Skip to content

Instantly share code, notes, and snippets.

@brianyoungblood
brianyoungblood / gdrive-example.php
Created May 6, 2023 02:45 — forked from geschke/gdrive-example.php
Google Drive PHP API library example to download a spreadsheet file
<?php
require_once __DIR__ . '/vendor/autoload.php';
class DriveFile
{
private $service = null;
private $client = null;
private $auth;
#!/bin/bash
for pkg in `brew list --formula -1 | egrep -v '\.|\.\.'`
do echo $pkg `brew info $pkg | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/\1/' | awk '{print $1;}/[0-9]$/{s+=$1};/[mM][bB]$/{s+=$1*(1024*1024);next};/[kK][bB]$/{s+=$1*1024;next} END { suffix=" KMGT"; for(i=1; s>1024 && i < length(suffix); i++) s/=1024; printf "\t(all versions: %0.1f%s)",s,substr(suffix, i, 1), $3; }'`
done
@brianyoungblood
brianyoungblood / gist:ba080471843f9d4f61bae5b3f8852dcb
Created April 15, 2019 16:43
get gzip file size in GB, if it was to be uncompressed
gzip -dc thefile.gz | wc -c | awk '{$1=$1/1024/1024/1024; print $1,"GB";}'
SELECT table_schema "DB Name",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
WHERE table_schema='[db-name]'
GROUP BY table_schema
#!/usr/bin/env bash
# Email owner user@hcwh.org
GDRIVE_OWNER_EMAIL=$1
# File ID 1qvBd0deuWHAsPyDwEVBnUg_a09_Z3Xlo39Qhlg2apyw
GDRIVE_FILEID=$2
# Username at practicegreenhealth.org. ie bjones
GDRIVE_PGHUSERNAME=$3
<?php
//$server_name = $_SERVER["SERVER_NAME"]
$server_name = "3b38a450c-92602-463c8-5581855-84c64c57741f--pr-389.probo.build";
// Get parts of the domain to use subdomain later.
$domain_parts = explode('.',$server_name);
@brianyoungblood
brianyoungblood / NSLookup.gs
Last active January 22, 2016 00:39 — forked from mogsdad/NSLookup.gs
NSLookup - Google Sheets custom function to Perform a Network Service Lookup, using StatDNS API. From "Nslookup or dig in Google App Script" (http://stackoverflow.com/a/30610580/1677912).
/**
* Perform a Network Service Lookup, using StatDNS API.
*
* @param {"google.com"} dn A well-formed domain name to resolve.
* @return {String} Resolved IP address
* @customfunction
*/
function NSLookup(dn) {
// From gist.github.com/mogsdad/ece531531e0ef5dc355d
@brianyoungblood
brianyoungblood / gist:de76cb5c059d7d201101
Created November 6, 2015 18:49
progress with gzcat and mysql imports
pv dump.sql.gz | gzcat | mysql -uroot -p dbname
@brianyoungblood
brianyoungblood / rescuetime_highlight.sh
Created August 9, 2015 22:11
Log commit messages as a 'highlight' in RescueTime Premium
#!/bin/sh
#
# Log commit messages as a 'highlight' in RescueTime Premium
#
# To enable this hook:
#
# 1. Place this file in your project's .git/hooks directory and make sure its name is "post-commit".
# 2. Make sure it has executable permissions (chmod +x post-commit)
# 3. All commits will be automatically logged as highlight events.
#
@brianyoungblood
brianyoungblood / gist:9d0a5200063a3c353eae
Created May 28, 2015 19:54
download mailman Pipermail mbox format
https://[Pipermail_server]/mailman/private/[listname].mbox/[listname].mbox