Skip to content

Instantly share code, notes, and snippets.

View lastorset's full-sized avatar

Leif Arne Storset lastorset

  • Opera Software
  • Oslo, Norway
View GitHub Profile
@lastorset
lastorset / koinly.py
Created May 26, 2022 17:56
Convert Firi CSV to Koinly CSV
# Install typer and arrow to use this
from dataclasses import dataclass
from datetime import datetime
from decimal import Decimal
import csv
import arrow
from typing import Sequence, Dict
@lastorset
lastorset / fetch_service_mock.py
Last active October 21, 2023 22:55 — forked from kesor/gist:1179782
Google AppEngine URLFetch in Unit Tests
from google.appengine.api import apiproxy_stub, apiproxy_stub_map, urlfetch
from google.appengine.ext import testbed
import unittest
class FetchServiceMock(apiproxy_stub.APIProxyStub):
"""
Example::
with FetchServiceMock(content='A MOCKERY', status_code=200) as fetch_mock:
ret = main.method('amok')
@lastorset
lastorset / gist:02516c19747f1e3e4c3d4e593876d6f3
Created February 1, 2018 13:51 — forked from aukalas/gist:d84c6c6816eac1b246fc82b9ec5e33c2
Google AppEngine URLFetch in Unit Tests
from google.appengine.api import apiproxy_stub
from google.appengine.api import apiproxy_stub_map
class FetchServiceMock(apiproxy_stub.APIProxyStub):
def __init__(self, service_name='urlfetch'):
super(FetchServiceMock, self).__init__(service_name)
def set_return_values(self, **kwargs):
self.return_values = kwargs
@lastorset
lastorset / cpuirq
Created March 21, 2017 16:41 — forked from sveniu/cpuirq
#!/bin/sh
# Enumerate all interrupts used by either the default or a specified
# network interface, and map them to separate CPUs. Each CPU that gets
# assigned interrupts will also have its C-states deeper than C1
# disabled to reduce the probability of rx queue overflow.
#
# TODO: NUMA interrupt scheduling.
#
@lastorset
lastorset / cpuirq
Created March 21, 2017 16:41 — forked from sveniu/cpuirq
#!/bin/sh
# Enumerate all interrupts used by either the default or a specified
# network interface, and map them to separate CPUs. Each CPU that gets
# assigned interrupts will also have its C-states deeper than C1
# disabled to reduce the probability of rx queue overflow.
#
# TODO: NUMA interrupt scheduling.
#
@lastorset
lastorset / build.gradle
Created October 26, 2015 15:46
An example of Android Studio ignoring Gradle wrapper settings
task wrapper(type: Wrapper) {
// Note: Android Studio ignores this line (probably a bug)
jarFile "$projectDir/../gradle/wrapper/gradle-wrapper.jar"
doLast {
"rm ./gradlew.bat".execute()
}
}
@lastorset
lastorset / android_version_codes.txt
Created September 25, 2015 15:22 — forked from anonymous/android_version_codes.txt
A printable overview of Android version codes
android.os.
API level Build.VERSION_CODES Version Code name
1 BASE 1.0 (no code name)
2 BASE_1_1 1.1 (no code name)
3, NDK 1 CUPCAKE 1.5 Cupcake
4, NDK 2 DONUT 1.6 Donut
5 ECLAIR 2.0 Eclair
6 ECLAIR_0_1 2.0.1 Eclair
7, NDK 3 ECLAIR_MR1 2.1 Eclair
8, NDK 4 FROYO 2.2.x Froyo
@lastorset
lastorset / play-112-min.html
Last active September 13, 2015 19:29
Semi-minimized TC for #112 in rust-playpen https://github.com/rust-lang/rust-playpen/issues/112
<!DOCTYPE html>
<html><head>
<title>#112 in Rust Playground</title>
<meta charset="utf-8">
<link rel="stylesheet" href="web.css">
<body>
<main>
<div id="editor" ></div>