Moved to: https://github.com/EmanueleMinotto/crystal
Read more: https://github.com/EmanueleMinotto/crystal/wiki
| <?php | |
| /* Shorten a URL using Google's goo.gl API. Requires an API key. */ | |
| function googl_shorten_url($url, $api_key) { | |
| $endpoint = 'https://www.googleapis.com/urlshortener/v1'; | |
| $ch = curl_init(sprintf('%s/url?key=%s', $endpoint, $api_key)); | |
| curl_setopt_array($ch, array( | |
| \CURLOPT_POST => true | |
| , \CURLOPT_AUTOREFERER => true | |
| , \CURLOPT_FOLLOWLOCATION => true | |
| , \CURLOPT_SSL_VERIFYPEER => false |
| <?php | |
| function github_markdown($text) { | |
| $ch = curl_init('https://api.github.com/markdown/raw'); | |
| curl_setopt_array($ch, array( | |
| \CURLOPT_POST => true | |
| , \CURLOPT_RETURNTRANSFER => true | |
| , \CURLOPT_POSTFIELDS => $text | |
| , \CURLOPT_SSL_VERIFYPEER => false | |
| , CURLOPT_HTTPHEADER => array('Content-Type: text/plain'))); |
| javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading…</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://gist.github.com/ttscoff/5834741/raw/grablinks.js?x="+(Math.random());})(); |
| [[email protected] www]$ cat .htaccess | |
| RewriteEngine on | |
| RewriteCond %{QUERY_STRING} resource=acct:(.+) | |
| RewriteRule ^\.well-known/webfinger /profile/%1? [L] | |
| [[email protected] www]$ cat profile/[email protected] | |
| { | |
| "subject": "acct:[email protected]", | |
| "links": [ | |
| { |
| // ActiveTable - a bookmarklet to make tables sortable and editable | |
| function init() { | |
| var aHrows = getHrows(); | |
| var numHrows = aHrows.length; | |
| var aHidden = getHiddenColumns(); | |
| ATpopup = document.createElement("div"); | |
| ATpopup.style.cssText = "position: absolute; visibility: hidden; padding: 0; font-family: Arial; background-color: rgba(255, 255, 255, 0.9); border-radius: .5em; text-align: center; box-shadow: .05em .05em .5em #00C;"; | |
| ATpopup.innerHTML = "<a href='sort' title='sort' onclick='sortColumn(); return false'><img border=0 src='http://stevesouders.com/images/sort_up_down.png' style='padding-top: 0.2em;'></a><br><a href='hide' style='color: #C00; font-family: monospace; font-size: 1.5em; text-decoration: none;' title='hide' onclick='hideColumn(); return false'>x</a>"; // TODO - use protocol-less URL for img |
| <?php | |
| # http://jeffreysambells.com/2012/10/25/human-readable-filesize-php | |
| function human_filesize($bytes, $decimals = 2) { | |
| $size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB'); | |
| $factor = floor((strlen($bytes) - 1) / 3); | |
| return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor]; | |
| } | |
| echo human_filesize(filesize('example.zip')); |
Create and enter a working directory
mkdir -p ~/dnscrypt-working-directory && cd ~/dnscrypt-working-directoryBecome root
sudo -s