Skip to content

Instantly share code, notes, and snippets.

@DamianZaremba
DamianZaremba / gist:49f56b2f28427fd37923989046af5700
Last active April 4, 2024 16:55
ClueBot Monitoring Scripts - Wikimedia API compatibility
+sub edit_page {
+ my $logger = shift;
+ my $wiki = shift;
+ my $title = shift;
+ my $text = shift;
+ my $summary = shift;
+
+ my $ref = $wiki->api({action => 'query', meta => 'tokens', type => 'csrf'});
+ if(!$ref) {
+ $logger->error("Could not retrieve CSRF token");
@DamianZaremba
DamianZaremba / test.py
Last active April 28, 2022 16:34
mypy scoping issue?
import dataclasses
from typing import List, Union
@dataclasses.dataclass()
class RecordType1:
pass
@dataclasses.dataclass()
@DamianZaremba
DamianZaremba / train.xml
Last active February 28, 2022 16:20
Example dataset
<WPEditSet>
<WPEdit>
<EditType>change</EditType>
<EditID>xxxxxx</EditID>
<comment></comment>
<user>x.x.x.x</user>
<user_edit_count>256</user_edit_count>
<user_distinct_pages>123</user_distinct_pages>
<user_warns>19</user_warns>
<prev_user>x.x.x.x</prev_user>
  1. Install MySQL, Golang & Git
  2. Create a schema called cbng_review
  3. Create an OAuth application via https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration/propose
    1. Select OAuth 1.0a
    2. Do not select 'This consumer is for use only by xxxx.'
    3. Enable 'User identity verification only, no ability to read pages or act on a user's behalf.'
  4. git clone https://github.com/cluebotng/reviewng
  5. Within the repo create config.yaml with suitable settings, example below
  6. Import the database tables & seed data
  7. mysql cbng_review &lt; sql/schema.sql
@DamianZaremba
DamianZaremba / .pyup.yml
Last active July 6, 2021 11:06
pyup actions template
update: all
pin: True
search: True
close_prs: True
000 -> 0.0
001 -> 0.0
002 -> 0.0
003 -> 0.0
004 -> 0.0
005 -> 0.0
006 -> 0.0
007 -> 0.0
008 -> 0.0
009 -> 0.0
@DamianZaremba
DamianZaremba / ratio.xml
Created January 10, 2021 22:00
Example Dive From "iX5M"
<?xml version="1.0" encoding="UTF-8"?>
<diveSegment version="1.1">
<segmentHeader>
<equipmentType>100</equipmentType>
<activeUser>0</activeUser>
<diveSamples>29</diveSamples>
<monotonicTimeS>145036</monotonicTimeS>
<UTCStartingTimeS>409911594</UTCStartingTimeS>
<surfacePressureMbar>9830</surfacePressureMbar>
<lastSurfaceTimeS>-1</lastSurfaceTimeS>
@DamianZaremba
DamianZaremba / settings.py
Last active March 9, 2018 14:50
Django social auth fix for Specified key was too long; max key length is 767 bytes
# Shrink specific columns down, so the key combination for the constraints
# aren't larger than the max legnth, when not using innodb_large_prefix.
# Length may require tweaking depending on application requirements
SOCIAL_AUTH_UID_LENGTH = 190
SOCIAL_AUTH_NONCE_SERVER_URL_LENGTH = 190
SOCIAL_AUTH_ASSOCIATION_SERVER_URL_LENGTH = 190
SOCIAL_AUTH_ASSOCIATION_HANDLE_LENGTH = 190
SOCIAL_AUTH_EMAIL_LENGTH = 190
@DamianZaremba
DamianZaremba / main.js
Last active October 16, 2015 17:11
FireFox Plugin
// AssetErrorController.getErrors() needs to be exposed to either the window or document scope on pages
// i.e. javascript:alert(window.foo); should work with the plugin loaded and return an object/hash back
var events = require("sdk/system/events");
var { Ci, Cu } = require("chrome");
// Store errors here
var AssetErrorController = new function() {
var errors = {};
@DamianZaremba
DamianZaremba / setup_mssql.ps1
Created January 8, 2015 13:11
MSSQL Server Setup - designed to be run via ssh, ie vagrant under opentable/win-2012r2-standard-amd64-nocm
$ErrorActionPreference = "Stop"
$client = new-object System.Net.WebClient
# Reset vagrant password so it's not expired
([adsi]"WinNT://vagrant-2012-r2/vagrant").SetPassword("P@55w0rd!")
# Setup UAC wrapper ;(
if(!(Test-Path -Path "C:\uacts_x64.zip")) {
Write-Output "Setting up UAC wrapper"
$client.DownloadFile("http://www.itknowledge24.com/files/uacts_x64.zip", "C:\uacts_x64.zip")