Skip to content

Instantly share code, notes, and snippets.

import random
from concurrent.futures import ProcessPoolExecutor
class TankContainerSimulator:
def __init__(self, normal_tanks_stage_1, normal_tanks_stage_2, legendary_tanks, additional_tanks_legendary, gold_rewards, container_cost):
self.normal_tanks_stage_1 = normal_tanks_stage_1
self.normal_tanks_stage_2 = normal_tanks_stage_2
self.legendary_tanks = legendary_tanks
self.additional_tanks_legendary = additional_tanks_legendary
self.gold_rewards = gold_rewards
@rs0h
rs0h / GTK4-VSCode.md
Created December 9, 2022 01:13
GTK4 VSCode Includepath

GTK4 VSCode Includepath Guide

Hello, this is a short guide to getting rid of the squiggly red lines when you try and import the gtk lib globally. (ex: #include <gtk/gtk.h>)

Dependencies

Fedora34+ (and possibly other distros)

Tested on 8/21/2021 with Gnome 40 release

{
@rs0h
rs0h / conns.py
Created September 10, 2020 11:52
PostgreSQL log parse
import re
import argparse
parser = argparse.ArgumentParser(description='PostgreSQL log parser. Will split logfile to multiple by sessionid and ip address')
parser.add_argument('filename', help='PosgreSQL log file')
args = parser.parse_args()
filename = args.filename
c = re.compile(r'\[(\d+)\].*connection received.*=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})')
@rs0h
rs0h / password.py
Created December 12, 2018 01:58
generate password with an svg qr code for it
#!/usr/bin/env python
import string
import random
import pyqrcode
from argparse import ArgumentParser
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument("-l", "--length", dest="passwd_length",
@rs0h
rs0h / .gitignore
Created May 3, 2016 01:01 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
#include <list>
#include <vector>
#include <string>
#include <iostream>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <windows.h> // for GetTickCount
@rs0h
rs0h / pr.md
Created April 12, 2016 23:31 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@rs0h
rs0h / find_elem_circuits.m
Created April 12, 2016 11:49 — forked from cmaes/find_elem_circuits.m
Find all the elementary circuits of a directed graph
function [numcycles,cycles] = find_elem_circuits(A)
if ~issparse(A)
A = sparse(A);
end
n = size(A,1);
Blist = cell(n,1);