Skip to content

Instantly share code, notes, and snippets.

View rickythefox's full-sized avatar
🇸🇪
CET

rickythefox rickythefox

🇸🇪
CET
View GitHub Profile
.var : Introduce variable
ANY → $var:suggestVariableName()$$END$ = $expr$
@rickythefox
rickythefox / hsa_parser.py
Created December 2, 2021 15:47
HSA xml to pandas dataframe
from lxml import etree
import pandas as pd
def get_hsa_attribute_value(attribute_name, child_element):
local_child_tag_name = etree.QName(child_element).localname
if local_child_tag_name == 'S':
yield attribute_name, child_element.text
elif local_child_tag_name == 'Address':
yield from [(f'{attribute_name}_{ix}', al.text) for ix, al in enumerate(child_element.iterchildren())]
@rickythefox
rickythefox / aws-sso-username-cleanup.js
Last active December 2, 2021 15:48
Clean up long and ugly SSO username in AWS console
// ==UserScript==
// @name Cleanup AWS SSO username
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Fix long and ugly SSO username
// @author Richard Ginzburg
// @match https://*.console.aws.amazon.com/*
// @grant none
// @run-at document-end
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
@rickythefox
rickythefox / precise_time.c
Created July 11, 2019 08:55 — forked from eregon/precise_time.c
A variant of time(1) able to show real time in milliseconds and max RSS in MB.
#include <sys/time.h>
#include <sys/types.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <spawn.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
0x9C6a25000B341c0ebE8e51c19108136D93079Ba6
0x2EA39e2a321d1Dc31C9051E2Aa35958B5F9f20C9
@rickythefox
rickythefox / gist:53a1358812b330f75b79b82f55bb200f
Created September 13, 2017 10:57 — forked from forki/gist:1151080
A basic model for Poker in F#
type Rank = int
type Suit = | Spades | Hearts | Diamonds | Clubs
type Card = Rank * Suit
let value = fst
let suit = snd
let A,K,Q,J,T = 14,13,12,11,10
let allRanksInSuit suit = [2..A] |> List.map (fun rank -> rank,suit)
let completeDeck =