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 | |
# nodereinstall | |
# credit: http://stackoverflow.com/a/11178106/2083544 | |
# | |
# UPDATE: I've converted this gist to a repo: | |
# https://github.com/brock/node-reinstall | |
# | |
# get sudo |
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
$ cd /usr/local | |
$ git checkout b64d9b9c431642a7dd8d85c8de5a530f2c79d924 Library/Formula/node.rb | |
$ brew unlink node | |
$ brew install node | |
$ npm install -g npm@latest |
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
#include <unistd.h> | |
#include <node.h> | |
#include <string.h> | |
#include <v8.h> | |
using namespace v8; | |
unsigned long long count = 0; | |
// native blocking/compute intensive function |
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
""" | |
I use this for files I save in Epistle for Android when I save links from my6sense. Yes, a very specific use case, but it might be useful to others. | |
""" | |
import os, time, webbrowser, glob | |
l = [(os.stat(i).st_mtime, i) for i in glob.glob('*txt')] | |
l.sort() | |
files = [i[1] for i in l] | |
files.reverse() |
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 | |
use lithium\core\Libraries; | |
use lithium\net\http\Router; | |
use lithium\core\Environment; | |
/* define lithium library path */ | |
define('LITHIUM_LIBRARY_PATH', dirname(__DIR__) . '/lithium/libraries'); | |
if (!include LITHIUM_LIBRARY_PATH . '/lithium/core/Libraries.php') { | |
$message = "Lithium core could not be found. Check the value of LITHIUM_LIBRARY_PATH in "; | |
$message .= __FILE__ . ". It should point to the directory containing your "; |
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
import os | |
#Replace with name of directory to scan, i.e, your WP directory | |
dir = "/var/www/" | |
#Replace with string to find, in my case, this domain, which my site was redirecting to | |
to_find = "vlag-nerto.ru" | |
for root, dirs, files in os.walk(dir): | |
for file in files: | |
fullpath = os.path.join(root, file) |
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 | |
//The url to your Piwik folder | |
$p_url = ""; | |
//The id of your site in Piwik | |
$site_id = ""; | |
//Your Piwik token_auth | |
$token_auth = ""; | |
function write_log($message) { | |
$log_file = 'logfile.txt'; |
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 | |
//JSON headers | |
header('Cache-Control: no-cache, must-revalidate'); | |
header('Expires: '.gmdate('D, d M Y H:i:s', time()).' GMT'); | |
header('Content-type: application/json; charset=utf-8'); | |
?> |
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($){ | |
$.fn.youtube = function(options){ | |
return this.each(function(i, obj){ | |
var $this = $(obj), | |
$playBtns = $this.find('.video .play-btn'), | |
player, | |
onPlayerReady = function(){ | |
player.playVideo(); | |
}, | |
loadPlayer = function(id){ |
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/python | |
from lib import scheduler | |
import datetime, time | |
def eristoddle_post_server(every_min, run_time_min): | |
from core.myWP import zem_cb_eristoddle | |
every_sec = 60 * every_min | |
run_time = 60 * run_time_min | |
esched = scheduler.Scheduler() | |
etask = scheduler.Task("eristoddle_post", |