Skip to content

Instantly share code, notes, and snippets.

@hashar
hashar / pip_constraints.md
Created September 19, 2023 04:15
pip requirements and constraints

Given a list of unpinned dependencies:

name=requirements.txt 
mwparserfromhell
pyyaml
pywikibot

Resolve the dependencies (ideally in a container with a controlled version of python):

@hashar
hashar / unrailed_profiling.md
Last active September 14, 2023 11:36
Profiling Unrailed with mono

Install Mono with profiler and utilities from Debian

sudo apt install mono-profiler mono-utils

Head to the Steam application directory

cd path/to/Unrailed

Game is started by shell script linux/UnrailedGame the command can then be tweaked to add the host Mono and pass extra parameters to mono

@hashar
hashar / spec_helper.rb
Created June 26, 2017 22:04 — forked from maxlinc/spec_helper.rb
rspec puppet debugging
RSpec.configure do |conf|
conf.module_path = File.join(fixture_path, 'modules')
conf.manifest_dir = File.join(fixture_path, 'manifests')
conf.hiera_config = File.join(fixture_path, 'hiera.yaml')
end
# Not sure this works for all types of https://github.com/rodjek/rspec-puppet tests. I think it works with host tests
if ENV['PUPPET_DEBUG']
Puppet::Util::Log.level = :debug
Puppet::Util::Log.newdestination(:console)
<?php
# Acknowledging Stas Malyshev
# https://phabricator.wikimedia.org/T156364#2977719
# Given two classes with the same property name but different visibility
class WithPublic {
public $property;
function __construct( $p ) { $this->property = $p; }
function getProperty() { print $this->property; }
}
#!/usr/bin/env python3
import random
import time
arm = 'v^<>'
eye = '^Oo*'
body = '\r%s(%s%s)%s'
@hashar
hashar / 503waitdancing.py
Created October 6, 2015 20:47
Wait for 503 for a few seconds while dancing
#!/usr/bin/env python3
import random
import time
arm = 'v^<>'
eye = '^Oo*'
body = '\r%s(%s%s)%s'
@hashar
hashar / monkeyprogress.py
Created July 24, 2014 21:24
monkeys based spinner
import sys
import time
monkeys = [
u'\U0001F648',
u'\U0001F649',
u'\U0001F64A',
]
try:
@hashar
hashar / out.txt
Created July 1, 2014 11:27
Bug: 67148
TAP version 13
ok 1 - BatchRowUpdateTest::testWriterBasicFunctionality
ok 2 - BatchRowUpdateTest::testReaderBasicIterate
ok 3 - BatchRowUpdateTest::testReaderGetPrimaryKey with data set #0 ('Must return single column pk when requested', array(42), array(42, 'dvorak', 'samurai'))
ok 4 - BatchRowUpdateTest::testReaderGetPrimaryKey with data set #1 ('Must return multiple column pks when requested', array(42, 'samurai'), array(42, 'dvorak', 'samurai'))
ok 5 - BatchRowUpdateTest::testReaderSetFetchColumns with data set #0 ('Must merge primary keys into select conditions', array('foo', 'bar'), array('foo'), array('bar'))
ok 6 - BatchRowUpdateTest::testReaderSetFetchColumns with data set #1 ('Must not merge primary keys into the all columns selector', array('*'), array('foo'), array('*'))
ok 7 - BatchRowUpdateTest::testReaderSetFetchColumns with data set #2 ('Must not duplicate primary keys into column selector', array('foo', 'bar', 'baz'), array('foo', 'bar'), array('bar', 'baz'))
ok 8 - BatchRowUpdateTest::testRe
@hashar
hashar / CommonSettings.php
Created October 30, 2013 20:37
CommonSettings.php for a hacker local MediaWiki install
<?php
$wgDebugDumpSql = false;
$wgAllowUserCss = true;
$wgDebugTimestamps = true;
#$wgDebugToolbar = true; # true: no file cache!
$wgDevelopmentWarnings = true;
$wgEnableJavaScriptTest = true;