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/bash | |
########## | |
# Deploy Script | |
# for deploying to servers that don't have git or ssh access | |
# RUN THIS FROM A VAGRANT SSH IF YOU AREN'T ON LINUX ALREADY. | |
########## | |
# prevents the certificate verification error. | |
sudo echo "set ssl:verify-certificate no" > ~/.lftp/rc |
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/bash | |
## | |
# RTMP to JPEG timelapse script | |
# github.com/kythin | |
# | |
# Simple script to take an RTMP streaming url and save a jpeg every 10 seconds. | |
# | |
# Requires 'ffmpeg' and 'rtmpdump' | |
# apt-get install ffmpeg rtmpdump |
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 getMaxUploadMB() { | |
$max_upload = (int)(ini_get('upload_max_filesize')); | |
$max_post = (int)(ini_get('post_max_size')); | |
$memory_limit = (int)(ini_get('memory_limit')); | |
$upload_mb = min($max_upload, $max_post, $memory_limit); | |
return $upload_mb; | |
} |
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 | |
/** | |
* http | |
* Echo's or returns the http starter section of the url. | |
* Use this to prevent SSL errors where some stuff is http and some is https. | |
* @param bool $return | |
* @return string | |
*/ | |
function http($return = false) { | |
$http = "http://"; |
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
function isMobileDevice() { | |
$user_agent = strtolower ( $_SERVER['HTTP_USER_AGENT'] ); | |
if ( preg_match ( "/phone|iphone|itouch|ipod|symbian|android|htc_|htc-|palmos|blackberry|opera mini|iemobile|windows ce|nokia|fennec|hiptop|kindle|mot |mot-|webos\/|samsung|sonyericsson|^sie-|nintendo/", $user_agent ) ) { | |
// these are the most common | |
return true; | |
} else if ( preg_match ( "/mobile|pda;|avantgo|eudoraweb|minimo|netfront|brew|teleca|lg;|lge |wap;| wap /", $user_agent ) ) { | |
// these are less common, and might not be worth checking | |
return true; | |
} | |
} |
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 | |
/** | |
* Class Bitline | |
* | |
* by github.com/kythin | |
* | |
* http://www.blitline.com/docs/examples | |
* | |
* Very basic starter SDK for PHP for this awesome service! From this code you should be able to do pretty much anything. |
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
function getLikesCountForURL($url) { | |
$fullurl = 'https://api.facebook.com/method/fql.query?query=SELECT%20like_count%20FROM%20link_stat%20WHERE%20url=%22'.$url.'%22&format=json'; | |
$response = json_decode(file_get_contents($fullurl),true); | |
return $response[0]['like_count']; | |
} |
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 | |
/** | |
* Toggl v8 PHP SDK | |
* @author github.com/kythin ([email protected]) | |
* @version 1.0 | |
* | |
* Do-whatever-you-want-except-sell-it license, feel free to fork and improve! I think that means GPLv3 right? | |
* | |
* I've gone through some of the examples in https://github.com/toggl/toggl_api_docs/tree/master/chapters (new v8 api docs) | |
* and implemented a handful of the ones I was using in old scripts, so check them out and if you add more support please |
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
function forceSSL() { | |
if($_SERVER["HTTPS"] != "on") { | |
header("HTTP/1.1 301 Moved Permanently"); | |
header("Location: https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]); | |
exit(); | |
} | |
} |
NewerOlder