This file contains hidden or 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 is_facebook_event( $url ) | |
{ | |
return ( preg_match("/http:\/\/www\.facebook\.com\/event.php\?eid=[0-9]*\.*/", $url) == 1 ); | |
} | |
function get_facebook_event ( $url ) | |
{ | |
$m = explode('=', $url); |
This file contains hidden or 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 | |
/* | |
Plugin Name: Facebook Event | |
Plugin URI: http://www.studentlund.se | |
Description: Detect Facebook event URL in post and update post content to match the event | |
Author: Niklas Lindblad | |
Version: 0.1 | |
Author URI: http://niklas.lindblad.info | |
*/ |
This file contains hidden or 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
var model = { | |
'/animals': { | |
'verb': "get", | |
'template': '<div id="animal-{{ID}}"> \ | |
<a href="#/animals/{{ID}}"><h2>{{title}}</h2></a> \ | |
<h3>{{time_added}}</h3> \ | |
<img src="{{thumbnail.0}}" /></div>' | |
}, | |
This file contains hidden or 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
// MySQL | |
$sql = "SELECT all, the fields, you, want, ((ACOS(SIN(c.Latitude * PI() / 180) * SIN(" . $lat . " * PI() / 180) + COS(c.Latitude * PI() / 180) * COS(" . $lat . " * PI() / 180) * COS((c.Longitude - " . $lng . ") * PI() / 180)) * 180 / PI()) * 60 * 2) as distance FROM places ORDER BY distance DESC;"; | |
// MongoDB | |
$this->places->find(array( 'loc' => array( '$near' => array($lat, $lng) ) )); |
This file contains hidden or 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
// MySQL | |
$sql = "SELECT all, the fields, you, want, ((ACOS(SIN(c.Latitude * PI() / 180) * SIN(" . $lat . " * PI() / 180) + COS(c.Latitude * PI() / 180) * COS(" . $lat . " * PI() / 180) * COS((c.Longitude - " . $lng . ") * PI() / 180)) * 180 / PI()) * 60 * 2) as distance FROM places ORDER BY distance DESC;"; | |
// MongoDB | |
$this->places->find(array( 'loc' => array( '$near' => array($lat, $lng) ) )); |
This file contains hidden or 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
# Gain XP on HabitRPG | |
HABITRPG_UID="xxxxx" | |
HABITRPG_TOKEN="yyyyyy" | |
curl -X POST -H 'Content-Type:application/json' \ | |
"https://habitrpg.com/v1/users/${HABITRPG_UID}/tasks/git/up" \ | |
-d "{\"apiToken\":\"${HABITRPG_TOKEN}\", \"title\":\"Git commit\", \"service\":\"git\", \"icon\":\"https://github.com/favicon.ico\"}" 1>/dev/null 2 | |
>&1 |
This file contains hidden or 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 | |
# Set Graphite host | |
GRAPHITE="172.16.20.1" | |
GRAPHITE_PORT="2003" | |
stats() { | |
HOSTNAME="mediacenter" | |
DATE=$(date +%s) | |
echo "server.${HOSTNAME}.${1} ${2} ${DATE}" | nc $GRAPHITE $GRAPHITE_PORT -w 1 |
This file contains hidden or 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 | |
set -e | |
NGINX_VERSION="1.6.0" | |
NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz" | |
PCRE_VERSION="8.34" | |
PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz" | |
OPENSSL_VERSION="1.0.1g" | |
OPENSSL_TARBALL="openssl-${OPENSSL_VERSION}.tar.gz" |
This file contains hidden or 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
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
Version: GnuPG/MacGPG2 v2.0.18 (Darwin) | |
mQINBFHK/6cBEAC+XPwiHQ3eZ1B9OfnyITX5ADFlks06JP0icrcmMDDNEpTYSC+q | |
FHJ/D/uEdKM03RalVGZ8KES/TG3kjaEPUODR8adRWP8EYm/EGTozn6qO5YwiB/7q | |
8v9R9R+ZZwivRvM56054A/RgAgy09Qf50uLgRGryRyDuPEwyVDJEcGglCwOR+oep | |
FGnxi7kmO2RTVmHHEAQWoCZDbkgyQctmh++99UKdKMG7yhlX8EMOmN+iYAW4ZXS/ | |
fFSOKTdgb26gNUhaBuKboHmCEx3JwZXnkHZ853jXFWQndb70+wcVnP9i04vM2Nsn | |
8ACBVg0y7zheGV6eBz9X+MD/+fSui7syINYDW9oiswQm5A9tgP/Bl+XDqI5HZIOZ | |
twuO7YJBQfWX5Js6Qc1qxaSl96VzlNoL1xXx+ULBqgyaEOTd0M4AcJW3V0vnaTd2 |
This file contains hidden or 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 'net.core.wmem_max=12582912' >> /etc/sysctl.conf | |
echo 'net.core.rmem_max=12582912' >> /etc/sysctl.conf | |
echo 'net.ipv4.tcp_rmem= 10240 87380 12582912' >> /etc/sysctl.conf | |
echo 'net.ipv4.tcp_wmem= 10240 87380 12582912' >> /etc/sysctl.conf | |
echo 'net.ipv4.tcp_window_scaling = 1' >> /etc/sysctl.conf | |
echo 'net.ipv4.tcp_timestamps = 1' >> /etc/sysctl.conf | |
echo 'net.ipv4.tcp_sack = 1' >> /etc/sysctl.conf | |
echo 'net.ipv4.tcp_no_metrics_save = 1' >> /etc/sysctl.conf | |
echo 'net.core.netdev_max_backlog = 5000' >> /etc/sysctl.conf | |
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor |
OlderNewer