Skip to content

Instantly share code, notes, and snippets.

@AleksandrT
AleksandrT / AsyncLoad
Created January 22, 2014 07:56
Fetches data (images,description) from an external web service asynchronous.
public partial class Main : Form
{
private CheckInternetConnection iconn;
private const string ERROR_LOADING_IMAGE = "Kunde inte ladda bild!\n Välj 'Ladda om' i Meny ovan ellr vänta 30 sec.!";
private const string ERROR_IMAGE_DATA = "Bilden hittades ej eller är korrupt!\n Välj 'Ladda om' i Meny ovan ellr vänta 30 sec.!";
private const string ERROR_NO_NETWORK_ACCESS = "iBrowser hittar inte internet!";
private const string MESSAGE_LOADING = "loading ...";
@AleksandrT
AleksandrT / wikiuploadbot.sh
Last active December 25, 2015 20:59
Wikiuploadbot
#!/bin/bash
# GLOBAL #
#-----------------------#
WIKIAPI="http://commons.wikimedia.org/w/api.php"
DEBUG=0
UNAME=""
UPASS=""
@AleksandrT
AleksandrT / gist:7024873
Last active December 25, 2015 18:59
Wiki upload bot
<?php
error_reporting(-1);
$action = urlencode('login');
$url = 'http://commons.wikimedia.org/w/api.php?';
$params = 'action='. $action .'&format=php&lgname=&lgpassword=';
$ua = 'SpreadthesignBot/0.2 (http://www.spreadthesign.com/; info@spreadthesign.com)';
$cs = '/tmp/wikibot_cookies.tmp';
$ch = curl_init();
SOURCE="/../flv/1"
DESTINATION="/../wiki/1"
if [[ ! -d $SOURCE ]]; then
echo "$SOURCE doest exist"
exit
fi
if [[ ! -d $DESTINATION ]]; then
echo "'$DESTIANTION' doest exists!"
@AleksandrT
AleksandrT / gist:6636644
Last active December 23, 2015 12:39
re-encoder.sh
SOURCE="/.../video/flv/1"
DESTINATION="/.../video/wiki/1"
if [[ ! -d $SOURCE ]]; then
echo "$SOURCE doest exist"
exit
fi
@AleksandrT
AleksandrT / add.sql
Last active December 22, 2015 21:39
Add sign language code support
-- Dumping structure for table test.cfsl
CREATE TABLE IF NOT EXISTS `cfsl` (
`slc` char(3) DEFAULT NULL,
`cc` char(2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table test.cfsl: ~0 rows (approximately)
/*!40000 ALTER TABLE `cfsl` DISABLE KEYS */;
INSERT IGNORE INTO `cfsl` (`slc`, `cc`) VALUES
('asp', 'dz'),
@AleksandrT
AleksandrT / list.html
Last active December 22, 2015 21:29
list.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Video Data</title>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js"></script>
<script>
app.get('/video/:html', function (req, res) {
res.send("<!DOCTYPE html><html lang=\"en\">" +
"<head><title>Video</title>" +
"<link href='http://vjs.zencdn.net/4.1/video-js.css' rel='stylesheet'>" +
"<script src='http://vjs.zencdn.net/4.1/video.js'></script>" +
"</head>" +
"<body><center>" +
"<video id='video' class='video-js vjs-default-skin'" +
" controls preload='auto' width='640' height='264'" +
@AleksandrT
AleksandrT / wikiuploadingbot.php
Last active December 22, 2015 00:28
Wiki video uploading bot. Development by AleksandrT.
<?php
require_once './mediawikibot.class.php';
require_once '(db connection)';
define('WIKI_DOMAIN', 'https://commons.wikimedia.org');
define('WIKI_WIKI', '/w');
define('WIKI_USERNAME', 'SpreadthesignBot');
define('WIKI_PASSWORD', '');
define('WIKI_COOKIES', '/tmp/wikibot_cookies.tmp');
define('WIKI_USERAGENT', 'SpreadthesignBot/0.1 (http://www.spreadthesign.com/; info@spreadthesign.com)');