This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Function to determine the average luminance of an image | |
function image_avg_luminance($filename, $num_samples=10, $section="all") | |
{ | |
# Variables required | |
$img = imagecreatefromjpeg($filename); | |
$width = imagesx($img); | |
$height = imagesy($img); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Function to determine the average luminance of an image | |
function image_avg_luminance($filename, $num_samples=10, $section="all") | |
{ | |
# Variables required | |
$img = imagecreatefromjpeg($filename); | |
$width = imagesx($img); | |
$height = imagesy($img); | |
$x_step = intval($width/$num_samples); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# DATA | |
$data_url = "http://rudi.strydom.photography/Portfolio/json/rand"; | |
$get_data = file_get_contents($data_url); | |
# Geckoboard specifics | |
$gb_url = "https://push.geckoboard.com/v1/send/"; | |
$gb_token = ""; | |
$gb_api_key = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
#ffmpeg -i $1 -vf scale=-1:480 -b:v 500k -maxrate 500k -crf 23 -c:a mp3 -strict -2 -b:a 128k $2 | |
#ffmpeg -i $1 -codec:v libx264 -profile: high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -vf scale=-1:480 -threads 0 -codec:a mp3 -b:a 128k $2 | |
#ffmpeg -i $1 -codec:v libx264 -profile:v main -preset slow -b:v 400k -maxrate 400k -bufsize 800k -vf scale=-1:480 -threads 4 -codec:a mp3 -b:a 128k $2 | |
ffmpeg -i $1 -codec:v libx264 -profile:v main -preset slow -b:v 1500k -maxrate 1500k -bufsize 2000k -vf scale=-1:720 -threads 4 -codec:a mp3 -b:a 96k $2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
/*eslint-env browser*/ | |
/*global ga*/ | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Sublime Text 3 install with Package Control | |
# http://simonewebdesign.it/blog/install-sublime-text-3-on-fedora-20/ | |
curl -o ~/st3.tar.bz2 $1 | |
if tar -xf ~/st3.tar.bz2 --directory=$HOME; then | |
sudo mv ~/sublime_text_3/ /opt/ | |
sudo ln -s /opt/sublime_text_3/sublime_text /bin/sublime | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Creating thumbnail of ${1}, to ${2}" | |
echo "Dimensions: ${3}px X ${4}px" | |
convert $1 -format png -strip -resize $3'x'$4'^' -gravity center -crop $3x$4'+0+0' $2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
for i := 1; i < 100; i++ { | |
if i %2 == 0 && i %3 == 0 && i %4 == 0 { | |
fmt.Println(i) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Delete all users from the database | |
// Can only be run from the command line | |
if (! isset($_SERVER['argv'][0])) { | |
header("HTTP/1.1 403 Unauthorized"); | |
die("Access Denied"); | |
} | |
// Otherwise make sure the user confirmed |
OlderNewer