Skip to content

Instantly share code, notes, and snippets.

Jamie York ziadoz

Block or report user

Report or block ziadoz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ziadoz
ziadoz / gmap.php
Created Mar 19, 2014
Generating a Static Google Map with PHP
View gmap.php
<?php
$url = 'http://maps.googleapis.com/maps/api/staticmap?';
$bits = array(
'center' => 'Calgary Tower, Calgary, AB, Canada',
'zoom' => '16',
'size' => '800x600',
'maptype' => 'roadmap',
'markers' => 'color:0x576d4e|label:N|49.6967179,-112.8450119',
'sensor' => 'false',
);
@ziadoz
ziadoz / fix-osx-wifi-battery-drain.md
Last active Oct 29, 2019
Fix OSX battery draining on sleep due to wifi activity
View fix-osx-wifi-battery-drain.md

Fix OSX battery draining on sleep due to wifi activity

Install SleepWatcher using Homebrew:

sudo chown -R $(whoami) /usr/local
brew update
brew install sleepwatcher

Start the SleepWatcher service:

@ziadoz
ziadoz / setup.md
Created Jul 22, 2017
Using XDebug in Atom Editor
View setup.md

Using XDebug in Atom Editor

Install the XDebug plugin for Atom and then add the following to the config.cson file (Atom > Config…):

"php-debug":
  PathMaps: [
    "remotepath;localpath"
    "/server/path/to/project/;/local/path/to/project/"
  ]
  ServerPort: 9001
@ziadoz
ziadoz / screenshot.js
Last active Oct 20, 2019
CasperJS Website Screenshots
View screenshot.js
// Usage: casperjs screenshot.js http://www.bbc.co.uk bbc.png
// https://gist.github.com/2310901
var casper = require('casper').create({
viewportSize: { width: 1024, height: 768 }
});
var utils = require('utils');
if (casper.cli.args.length < 2) {
@ziadoz
ziadoz / convert_video.sh
Last active Oct 10, 2019
MKV to MP4 (Docker, FFMpeg, AVConv)
View convert_video.sh
#!/usr/bin/env bash
# Convert MKV to MP4
# Uses Docker FFMpeg, FFMpeg or AVConv.
#
# Usage:
# ./convert_video.sh
# ./convert_video.sh /path/to/videos
#
# Notes:
@ziadoz
ziadoz / readme.md
Created Aug 30, 2019
Cloning Github Gists
View readme.md

Cloning Github Gists

To clone a gist:

git clone git@gist.github.com:[GIST ID].git

If you need to add a remote to an existing repository:

git remote add origin git@gist.github.com:[GIST ID].git
@ziadoz
ziadoz / download.sh
Last active Sep 18, 2019
Download Websites with WGet
View download.sh
# WGet Manual: http://www.gnu.org/software/wget/manual/wget.html
# Link Checker: http://wummel.github.io/linkchecker/
# Archiving URLs: http://www.gwern.net/Archiving%20URLs
# Download Webpage: http://superuser.com/questions/55040/save-a-single-web-page-with-background-images-with-wget
# Output Directory: http://stackoverflow.com/questions/8986139/wget-output-directory-prefix
# WARC Files: http://www.archiveteam.org/index.php?title=Wget_with_WARC_output
# Add -r or --recursive to get the whole website.
wget -T 10 -e robots=off -E -H -k -K -p -nH -nd -P /path/to/dir [URL]
wget --timeout 10 --execute robots=off --adjust-extension --span-hosts --convert-links --backup-converted --page-requisites --random-wait --no-host-directories --no-directories --directory-prefix --mirror --html-extension /path/to/dir [URL]
@ziadoz
ziadoz / main.go
Last active Sep 1, 2019
Download a webpage as HTML with base64 encoded assets using Golang
View main.go
// Usage: go run main.go https://www.theguardian.com/uk
// Based on Monolith: https://github.com/Y2Z/monolith
package main
import (
"bytes"
"encoding/base64"
"fmt"
"io"
"io/ioutil"
@ziadoz
ziadoz / repl.php
Last active Aug 29, 2019
Simple PHP REPL
View repl.php
#!/usr/bin/env php
<?php
if (php_sapi_name() !== 'cli') {
exit(1);
}
function input() {
return fgets(STDIN);
}
@ziadoz
ziadoz / photos.sh
Last active Aug 24, 2019
OS X Photos - View Raw Photos in Finder
View photos.sh
#!/usr/bin/env bash
# Make the OS X Photos Library viewable as a folder called Raw in ~/Pictures
cd ~/Pictures
mkdir Raw
ln -s ~/Pictures/Photos\ Library.photoslibrary/Masters/ Raw
You can’t perform that action at this time.