Skip to content

Instantly share code, notes, and snippets.

View gosuto-inzasheru's full-sized avatar

gosuto.eth gosuto-inzasheru

View GitHub Profile
@gosuto-inzasheru
gosuto-inzasheru / generate_interface.py
Last active June 27, 2022 12:45
generates a clean .sol interface file for any solidity contract address verified on etherscan
import os
import re
import requests
import sys
from dotenv import load_dotenv
# https://etherscan.io/contract-license-types
# https://spdx.org/licenses/
@gosuto-inzasheru
gosuto-inzasheru / reducing.py
Last active June 2, 2020 17:14
Reduce pd.DataFrame memory size by intelligently downgrading data types.
"""reducing.py
Author: Kirgsn, 2018
Use like this:
>>> import reducing
>>> df = reducing.Reducer().reduce(df)
"""
import numpy as np
import pandas as pd
import time
@gosuto-inzasheru
gosuto-inzasheru / flatten.py
Created December 30, 2018 10:14
Flatten Python lists and tuples into their individual items
def flatten(li):
"""Flatten lists or tuples into their individual items. If those items are
again lists or tuples, flatten those."""
if isinstance(li, (list, tuple)):
for item in li:
yield from flatten(item)
else:
yield li
@gosuto-inzasheru
gosuto-inzasheru / print-delivery-note.php
Created April 29, 2013 19:37
Custom invoice template which complies to all Dutch tax regulations (Belastingdienst). Both files are placed in wp-content/themes/<yourtheme>/woocommerce/print/.
<!DOCTYPE html>
<html lang="<?php echo WPLANG; ?>" class="<?php echo wcdn_get_template_type(); ?>">
<head>
<meta charset="utf-8">
<link href='http://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="<?php wcdn_stylesheet_url( 'style.css' ); ?>" type="text/css" media="screen,print" />
</head>
<body>
<div id="container">
<div id="content">
body {
font-family: Courier;
font-size: 11pt;
}
#page {
margin-left: auto;
margin-right: auto;
padding-top: 5%;
padding-bottom: 5%;
padding-left: 10%;
<!DOCTYPE html>
<html lang="<?php echo WPLANG; ?>" class="<?php echo wcdn_get_template_type(); ?>">
<head>
<meta charset="utf-8">
<link href='http://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="<?php wcdn_stylesheet_url( 'style.css' ); ?>" type="text/css" media="screen,print" />
</head>
<body>
<div id="container">
<div id="content">