Skip to content

Instantly share code, notes, and snippets.

@aandr
aandr / aop.py
Created May 5, 2011 13:41
Python AOP using Class Decorators
import inspect
def aspectize(arg):
def decorate_method(func):
func.__before = []
func.__after = []
def decorated(*args, **kwargs):
for f in func.__before:
res = f(*args, **kwargs)

Keybase proof

I hereby claim:

  • I am aandr on github.
  • I am aandr (https://keybase.io/aandr) on keybase.
  • I have a public key ASCn2k3aflirn38-1iTdtheJacJgsvhv1taTeLqYQuFPNwo

To claim this, I am signing this object:

@aandr
aandr / reset.c
Created January 29, 2018 17:27
NVIC reset
__disable_irq();
/* Disable the stack monitor */
R_SPMON->MSPMPUPT = 0xA500; /* Enable access to Main Stack Pointer Monitor Access Control Register */
R_SPMON->PSPMPUPT = 0xA500; /* Enable access to Process Stack Pointer Monitor Access Control Register */
R_SPMON->MSPMPUCTL_b.ENABLE = 0; /* disable the Main stack monitor */
R_SPMON->PSPMPUCTL_b.ENABLE = 0; /* disable the Process stack monitor */

Keybase proof

I hereby claim:

  • I am aandr on github.
  • I am alekandreev (https://keybase.io/alekandreev) on keybase.
  • I have a public key ASAS6N5MK-320ANY4nIPUs71FEcBBgNQk2VZLRpD0l2HVwo

To claim this, I am signing this object:

PREFIX leak: <http://data.ontotext.com/resource/leaks#>
PREFIX dbr: <http://dbpedia.org/resource/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?l ?name ?address ?status ?link ?shareholder where {
?l a leak:Entity.
?l leak:hasCountry dbr:Bulgaria .
?l leak:address ?address.
?l leak:name ?name.
?l leak:status ?status.
?l rdfs:seeAlso ?link.
{
"basicInfo": {
"Name": "John Smith",
"Email": "john@smith.com",
"Client status": "VIP",
},
"orders": {
"#007018": {
"Products": {
"Minetonka Moosehide Mocassins": {
import pandas
import numpy as np
from collections import defaultdict
data = pandas.read_csv("/Users/alek/Downloads/agenti3.csv", skiprows=1)
blanks = [None, '', ' ', 'Неустановена приналежност', 'Неустановена принедлежност', 'Няма данни', 'Неустановане принадлежност', 'Неустановена пренадлежност', 'Нустановена принадлежност', 'Неустанована принадлежност', 'Неустановена принадлежност']
data['is_agent'] = data['Установена принадлежност'].map(lambda x: x not in blanks)
print("Number of checked persons", len(data))
data = data[data['is_agent'] == True]
print("Numebr of agents", len(data))
@aandr
aandr / blink.css
Created August 9, 2013 08:55
Paste this in your CSS and you'll get the <blink> tag back!
blah blah blah
@aandr
aandr / svg
Created October 28, 2015 11:36
<svg width="470" height="620" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0,10)"><g><path class="link" d="M10,38.3710407239819C235,38.3710407239819 235,246.22926093514332 460,246.22926093514332" style="stroke-width: 71.9457px; fill: none; stroke: rgb(92, 16, 140); stroke-opacity: 0.4;"></path><path class="link" d="M10,198.66515837104075C235,198.66515837104075 235,36.372549019607845 460,36.372549019607845" style="stroke-width: 59.9548px; fill: none; stroke: rgb(0, 125, 245); stroke-opacity: 0.4;"></path><path class="link" d="M10,126.31221719457014C235,126.31221719457014 235,421.71191553544503 460,421.71191553544503" style="stroke-width: 59.9548px; fill: none; stroke: rgb(255, 0, 0); stroke-opacity: 0.4;"></path><path class="link" d="M10,362.5565610859729C235,362.5565610859729 235,155.09049773755657 460,155.09049773755657" style="stroke-width: 56.7572px; fill: none; stroke: rgb(21, 42, 107); stroke-opacity: 0.4;"></path><path class="link" d="M10,287.8054298642534C235,287.8054298642534 235,329.374