Skip to content

Instantly share code, notes, and snippets.

@legoktm
legoktm / thingy.py
Last active August 29, 2015 14:03
thingy
# -*- coding: utf-8 -*-
# SUL audit thingy
# GPL v2 / MIT License
import calendar
import datetime
from collections import defaultdict, OrderedDict
import os
import time
import MySQLdb
@reedy
reedy / gist:5397bb127ebb2b4e7eac
Last active August 29, 2015 14:04
mwgrep toolserver.org
reedy@tin:~$ mwgrep --max-results 350 toolserver.org
afwiki MediaWiki:Gadget-popups.js
afwiki MediaWiki:GeoHack.js
alswiki MediaWiki:Common.js
alswiki MediaWiki:Gadget-toolserver-integration.js
arcwiki MediaWiki:Gadget-popups.js
aswiki MediaWiki:Gadget-citations.js
barwiki MediaWiki:Common.css
be_x_oldwiki MediaWiki:Gadget-Popups.js
be_x_oldwiki MediaWiki:RefToolbar.js

Most active public GitHub users in Finland

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Fri, 13 Dec 2013 15:07:05 GMT till Sat, 13 Dec 2014 15:07:05 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -> user.followers > 11)
@atdt
atdt / apc_vs_memcached.php
Last active August 29, 2015 14:27
Simple benchmark demonstrating the efficiency of APC compared to memcached. Even if the memcached instance is running on localhost, it is a separate process, and PHP has to talk with it via a socket (usually TCP, sometime UNIX). This requires executing many system calls, like select(), accept(), read(), and write(), each of which crosses the bou…
<?php
$loops = 1000;
$data = array( 'a' => 1, 'b' => 2, 'c' => 3 );
// Memcached
$cache = new Memcached();
$cache->addServer( "127.0.0.1", 11211 );
$start = microtime( true );
+-------------+----------+--------------------------------------------+
| uploadcount | log_user | user_name |
+-------------+----------+--------------------------------------------+
| 1687970 | 910182 | GeographBot |
| 893778 | 40038 | File Upload Bot (Magnus Manske) |
| 667641 | 344180 | BotMultichillT |
| 315174 | 102944 | GerWsUpload |
| 284299 | 2120548 | Slick-o-bot |
| 219123 | 152505 | Flickr upload bot |
| 132485 | 1560296 | FSII |
#!/usr/bin/env python
# Authors: Legoktm, Betacommand
# License: MIT License
import datetime
import functools
import logging
import mwparserfromhell
import pywikibot
@phillro
phillro / gist:1147306
Created August 15, 2011 17:50
Elastica with an authenticated search
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/Elastica/lib'));
function elasticsearch_autoload($class) {
$file = str_replace('_', '/', $class) . '.php';
require_once $file;
}
spl_autoload_register('elasticsearch_autoload');
defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__)));
@aborruso
aborruso / 00README.md
Last active July 29, 2019 07:59
Un albero di tweet su licenze per dati aperti e piattaforme come Wikidata, Wikipedia e OpenStreetMap https://hackmd.io/s/SkKq6eaFX
statusid,user,id
1044561432141058050,synapta,01
1045273277256671232,GiorgiaLodi,02
1046660399108689920,openantani,03
# Converts a JSONL file generated with telegram-history-dump (1) to CSV
# Usage: python telegram-csv.py <path to json file> <path to output csv file>
# Example: python telegram-csv.py Bob.json Bob.csv
# 1: https://github.com/tvdstaaij/telegram-history-dump
from datetime import datetime
import unicodecsv as csv
import json, sys
def get_isodate(msg):
date = msg.get("date", None)
@santhoshtr
santhoshtr / render.py
Created October 9, 2014 09:12
PangoCairo Text rendering
#!/usr/bin/python
#-*- coding:utf8 -*-
import cairo
import pango
import pangocairo
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 600, 100)
context = cairo.Context(surface)
pc = pangocairo.CairoContext(context)