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 / android_bootstrap.sh
Created October 16, 2012 15:55
shell script to install Android SDK from CLI
#!/bin/bash
ANDROID_ARCHIVE="android-sdk_r20.0.3-linux.tgz"
ANDROID_URL="http://dl.google.com/android/$ANDROID_ARCHIVE"
BASE_DIR="/opt/androidsdk"
ANDROID_BIN="$BASE_DIR/android-sdk-linux/tools/android"
ANDROID_VERSIONS="android-8,android-10"
### Pre checks ########
@hashar
hashar / define.yaml
Created December 10, 2012 15:41
Jenkins Job Builder, override a parameter at project level
# Testing Jenkins Job Builder
#
# git clone git://gist.github.com/4251317.git
# mkdir testoutput
# jenkins-jobs -l debug test 4251317 -o testoutput
# grep command outtemplate/*
# Basic macro, takes a 'parameters' parameter
- builder:
name: resolve-deps
@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 / 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;
@hashar
hashar / gist:7215603
Created October 29, 2013 14:22
are function args in exceptions traced passed by reference?
<?php
# Example for https://gerrit.wikimedia.org/r/#/c/92334/
function blame($a) {
throw new Exception();
}
try {
blame( array('foobar') );
} catch (Exception $e) {