Skip to content

Instantly share code, notes, and snippets.

@Modelmat
Modelmat / income_distribution.py
Last active Apr 9, 2021
Universal Basic Income Comparison Script for USA/AUS
View income_distribution.py
# TODO: do the conversion from the data directly
# Data Format is a list of [weekly income, percentage of population from 0-100]
wealth_distributions = {
# Graph 1 from https://www.abs.gov.au/statistics/economy/finance/government-benefits-taxes-and-household-income-australia/latest-release#income-redistribution-and-inequality
"AUS": [[50.0, 1.9], [100.0, 1.8], [150.0, 2.2], [200.0, 2.1], [250.0, 2.1], [300.0, 1.8], [350.0, 2.1], [400.0, 2.3], [450.0, 2.3], [500.0, 2.9], [550.0, 2.2], [600.0, 2.6], [650.0, 2.4], [700.0, 3.3], [750.0, 2.3], [800.0, 2.4], [850.0, 2.6], [900.0, 2.7], [950.0, 2.6], [1000.0, 2.5], [1050.0, 2.8], [1100.0, 2.3], [1150.0, 2.3], [1200.0, 2.2], [1250.0, 2.1], [1300.0, 2.0], [1350.0, 1.7], [1400.0, 2.5], [1450.0, 2.0], [1500.0, 1.6], [1550.0, 1.6], [1600.0, 1.5], [1650.0, 1.4], [1700.0, 1.2], [1750.0, 1.3], [1800.0, 1.2], [1850.0, 1.1], [1900.0, 0.9], [1950.0, 0.9], [2000.0, 1.2], [2050.0, 0.8], [2100.0, 0.9], [2150.0, 0.9], [2200.0, 0.8], [2250.0, 0.8], [2300.0, 0.8], [2350.0,
@Modelmat
Modelmat / build_debug_packages.py
Last active Jan 6, 2021
Build debug packages for Arch Linux from a list of files
View build_debug_packages.py
"""Build debug packages for Arch Linux from a list of files
Install:
In `/etc/makepkg.conf` disabling stripping binaries and enable the
creation of `-debug` packages.
$ pip install pyalpm
Usage:
Create a file named "debug_symbol_files.txt"
@Modelmat
Modelmat / sensor-power.py
Created Jul 18, 2020
Get real-time power consumption for AMD CPU
View sensor-power.py
# requires pysensor module from pypi
import sensors
def main():
voltages = {}
amperages = {}
sensors.init()
cpu = next(sensors.iter_detected_chips("k10temp-pci-00c3"))
@Modelmat
Modelmat / script.cs
Created Oct 17, 2019
Ravenfield Landable Planes Script. Tested through to EA12, may work in newer versions.
View script.cs
/*
1. Create a bool `down` in the Plane script class.
2. Insert the below code in the methods in the Plane class.
*/
void Update() {
// Insert at the end
if (Input.GetKeyDown(KeyCode.Z) && this.seats[0].IsOccupied() && !this.seats[0].occupant.aiControlled)
{
if (this.down) {
@Modelmat
Modelmat / output.svg
Last active Oct 3, 2019
Not working graphviz diagrams
View output.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Modelmat
Modelmat / 100.xml
Last active May 25, 2019
Isodistances
View 100.xml
<?xml version="1.0" encoding="UTF-8"?>
<r xmlns="http://iso4app.com/XMLDOM">
<s>
<c>0</c>
<m />
<t>Sat, 2019-5-25 at 4:40:11 PM CEST</t>
</s>
<iso>
<latlon>-33.6892106 151.1004216,-33.6892299 151.1004179,-33.6900437 151.1000351,-33.6900522 151.0999681,-33.689219 151.0992796,-33.6891639 151.0992835,-33.688246 151.100296,-33.6882725 151.1003628,-33.688555 151.1003851,-33.688556 151.1003851,-33.6887113 151.1003934,-33.6892106 151.1004216</latlon>
<value>100</value>
@Modelmat
Modelmat / _classes_output.json
Last active Mar 26, 2020
A simple API for My Study Life application
View _classes_output.json
{
"academic_years":[
{
"created_at":"2018-08-11T11:35:29",
"deleted_at":null,
"end_date":"2018-12-19",
"guid":"2adeab27-b77d-40e8-b5c6-48ff699833ef",
"holidays":[
],
@Modelmat
Modelmat / cymath.py
Last active Jul 15, 2020
Basic API example for https://cymath.com
View cymath.py
"""
DISCLAIMER
I am not responsible for any actions or usage of this API, the api clearly states
"Restricted Access. We may pursue legal actions over unauthorized uses of this API."
This script is for educational purposes ONLY
"""
@Modelmat
Modelmat / basic_bot.py
Last active Mar 14, 2020 — forked from leovoel/basic_bot.py
discord.py's basic_bot.py converted to use "cogs". (with automatic finding of extensions)
View basic_bot.py
from discord.ext import commands
from os import listdir
from os.path import isfile, join
description = '''An example bot to showcase the discord.ext.commands extension
module.
There are a number of utility commands being showcased here.'''
@Modelmat
Modelmat / bot_example.py
Last active Apr 26, 2021 — forked from EvieePy/bot_example.py
A Cogs Example for the rewrite version of - discord.py (with automatic directoru searching)
View bot_example.py
import discord
from discord.ext import commands
from os import listdir
from os.path import isfile, join
import sys, traceback
"""This is a multi file example showcasing many features of the command extension and the use of cogs.
These are examples only and are not intended to be used as a fully functioning bot. Rather they should give you a basic