Skip to content

Instantly share code, notes, and snippets.

@hashar
hashar / T389998 - 20250401 run.md
Last active April 1, 2025 19:32
T389998 - 20250401 run
@hashar
hashar / docker.rs
Created March 5, 2025 17:07
bash2rust by mistral 3
/// The bash version https://github.com/hashar/alix/blob/123c2f01360f2619ab4abbe49adeb6dd32dbccd8/bin/docker
/// Converted using Mistral Small 3
/// Prompt:
/// port the following bash script to rust. Give comments explaining the mapping from bash to rust: <paste of above script>
///
/// Answer:
/// Porting the given Bash script to Rust involves several steps,
/// including handling command-line arguments, checking for specific conditions,
/// and executing external commands. Below is the Rust equivalent of the provided
/// Bash script with comments explaining the mapping from Bash to Rust:
@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: