Skip to content

Instantly share code, notes, and snippets.

View sidouglas's full-sized avatar

Simon Douglas sidouglas

  • Sydney, Australia
View GitHub Profile
@sidouglas
sidouglas / tar.sh
Created October 28, 2013 08:56
Tar compress a file
tar cvf nameoffile.tar ./
@sidouglas
sidouglas / ds_store.sh
Created October 28, 2013 08:57
Recursively remove '.DS_Store' files
find . -name ".DS_Store" -depth -exec rm {} \;
@sidouglas
sidouglas / youtube-dl simple applescript gui
Created October 21, 2018 07:42
Youtube DL wrapped in applescript for audio only downloads to desktop.
set theResponse to display dialog "Enter youtube url" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"
set theUrl to (text returned of theResponse)
set shellPath to "PATH=$PATH:/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin:~/opt/bin:~/opt/sbin:/opt/local/bin:/opt/local/sbin:" & quoted form of (POSIX path of ((path to me as text) & "::")) & "; "
do shell script shellPath & "youtube-dl --ignore-errors -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o \"~/Desktop/%(title)s-%(id)s.%(ext)s\" " & theUrl
display dialog "Done" giving up after 2
@sidouglas
sidouglas / Brewfile
Last active June 28, 2020 02:45 — forked from benrowe/Brewfile
Brew File for Mac System
tap "eugenmayer/dockersync"
tap "go-delve/delve"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
tap "homebrew/dupes"
tap "homebrew/php"
tap "homebrew/versions"
cask "java"
brew "awscli"
@sidouglas
sidouglas / delete-orphans-usermeta.sql
Created January 8, 2020 10:33 — forked from carlosleopoldo/delete-orphans-usermeta.sql
Delete all orphans user meta in WordPress
DELETE FROM wp_usermeta
WHERE NOT EXISTS (
SELECT * FROM wp_users
WHERE wp_usermeta.user_id = wp_users.ID
)
@sidouglas
sidouglas / index.php
Created January 8, 2020 10:44
Add Shortcode WordPress
<?php
add_shortcode( "[tag]", "your_shortcode" );
function your_shortcode( $atts, $content = null ){
extract( shortcode_atts([
'foo' => 'something',
'bar' => 'something else',
], $atts ) );
return 'something';
}
DELETE a,b,c FROM wp_posts a WHERE a.post_type = 'revision' LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id);
@sidouglas
sidouglas / pushbullet.php
Created January 8, 2020 10:50 — forked from EdwinHoksberg/pushbullet.php
Pushbullet push function
<?php
function pushbullet(string $accessToken, string $title, string $body, string $type = 'note'): \stdClass
{
if (!in_array($type, ['note', 'url'])) {
throw new \Exception('Invalid pushbullet push type');
}
$curl = curl_init();
curl_setopt_array($curl, [
@sidouglas
sidouglas / blade.php
Created January 8, 2020 10:51
Blade Laravel get all defined variables
<?php
{{ dd(get_defined_vars()['__data']) }}
@sidouglas
sidouglas / style.css
Created January 8, 2020 10:52
Debug layer styles in css
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }