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
#!/usr/bin/python | |
#Adapted from http://wiki.dreamhost.com/User:Datagrok/ddns | |
from dreamhostapi import DreamHostServerProxy | |
from os import environ | |
import urllib2 | |
def main(): | |
#Your Dreamhost API key | |
dh_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
<?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", |
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
def multigrams(text, lower, upper): | |
grams = [] | |
for i in range(lower, upper): | |
grams.extend(ngrams(text, i)) | |
return grams | |
def multigrams_count(text, lower, upper): | |
counted_grams = {} | |
for n in multigrams(text, lower, upper): | |
try: |
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
def get_ezinearticles(query, limit=25): | |
#returns 25 | |
#TODO: Make get_goarticles and get_articlebase | |
def grab_article(url): | |
soup = BeautifulSoup.BeautifulSoup(URL(url).download()) | |
return {"title": select(soup,"#article-title h1")[0].contents, | |
"body": select(soup,"#article-content")[0].contents, | |
"resource": select(soup,"#article-resource")[0].contents} | |
query = {"q":query} | |
soup = BeautifulSoup.BeautifulSoup(URL('http://ezinearticles.com/search/'\ |
OlderNewer