Skip to content

Instantly share code, notes, and snippets.

View asdf8601's full-sized avatar
:octocat:
Viming...

max asdf8601

:octocat:
Viming...
View GitHub Profile
@asdf8601
asdf8601 / decorator_caching_fixture.py
Last active July 15, 2021 06:55
[decorators] Example of a decorator for caching a pytest fixture
import pytest
import pickle
FILES_DIR = Path(__file__) / ".." / ".."
def cache_fixture(func):
pkl = (FILES_DIR / "program_144_dforex.pkl")
@asdf8601
asdf8601 / index.html
Last active June 12, 2021 11:17 — forked from mrts/index.html
Example of Gitgraph.js usage
<!DOCTYPE html>
<html>
<head>
<!-- Load the JS file -->
<script src="https://cdn.jsdelivr.net/npm/@gitgraph/js"></script>
</head>
<body>
<!-- DOM element in which we'll mount our graph -->
<div id="graph-container"></div>
@asdf8601
asdf8601 / pytest_plugins.md
Created April 30, 2021 13:59
pytest plugins
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
if grep -IRn pdb $DIR/../src
then
false
fi
if grep -IRn pdb $DIR/../tests
then
@asdf8601
asdf8601 / README.md
Created April 5, 2021 06:27 — forked from masdeseiscaracteres/README.md
Rolling apply on numpy arrays using Pandas internals
.ONESHELL:
SHELL=/usr/bin/bash
CPUS ?= $(shell grep -c ^processor /proc/cpuinfo || echo 1)
MAKEFLAGS += --jobs=$(CPUS)
PY_VERS = {"3.5", "3.6", "3.7"}
all: py3.6-pip18 py3.6-pip19 py3.6-pip20 py3.7-pip18 py3.7-pip19 py3.7-pip20 py3.8-pip18 py3.8-pip19 py3.8-pip20
pyenv_local:
@pyenv local 3.5.10 3.6.13 3.7.10 3.8.8 3.9.2
@asdf8601
asdf8601 / bookmark_sid.js
Created February 16, 2021 09:30
javascript example get selected text open url
javascript:
function getSelectionText() {
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") {
text = document.selection.createRange().text;
}
return text;
@asdf8601
asdf8601 / fuckda.py
Created February 8, 2021 21:55 — forked from astrojuanlu/fuckda.py
Uso de certificados de la FNMT con Python
# coding: utf-8
#
# fuckda.py - Uso de certificados de la FNMT con Python
#
# Autor: Juan Luis Cano Rodríguez <[email protected]>
#
# Instrucciones:
#
# 1. Exportar certificado (CERTIFICADO.p12)
# https://www.sede.fnmt.gob.es/preguntas-frecuentes/exp-imp-y-elim-de-certificados
@asdf8601
asdf8601 / gist:45d2b954beb9ad9a7105d9b37895eea6
Created January 27, 2021 08:06
[Issues id] Get issues id from glab using fzf and awk
# Get issue id from glab
glab issue list --search mgreco | fzf -m --bind ctrl-a:select-all,ctrl-d:deselect-all,ctrl-t:toggle-all | awk -F"[ ]+" '{/#/split(sub("#", "", $1), a, " "); print $a[1]}'
@asdf8601
asdf8601 / gitlab2task.sh
Last active November 19, 2020 17:44
[Gitlab] api post of estimates from file
#!/usr/bin/env bash
# https://docs.gitlab.com/ce/api/issues.html#list-project-issues
TOKEN="<TOKEN>"
ENDPOINT="https://<host>/api/v4/projects/324/issues"
TMPL="curl --header \"PRIVATE-TOKEN: $TOKEN\" \"$ENDPOINT\"\n"
MILESTONE="<milestone>"
curl --header "PRIVATE-TOKEN: $TOKEN" \
"$ENDPOINT?scope=all&mileston=$MILESTONE&per_page=100" \
| jq -r '.[] | (.iid | tostring) + "\t" + .title + "\t" + (.time_stats.time_estimate / 28800 | tostring)'