Skip to content

Instantly share code, notes, and snippets.

@last-g
last-g / clean_asm.py
Created July 15, 2020 16:43
simple python asm parser
#!python3
import sys
import re
def get_section_name(line):
return line.split()[1]
def is_text_section(section_name):
return (
module Main where
import Prelude
import System.Environment
fibb_slow :: Integer -> Integer
fibb_slow 1 = 1
fibb_slow 2 = 1
fibb_slow x = fibb_slow (x-1) + fibb_slow (x-2)
$ sudo dtrace -ln 'HaskellEvent*:::'
ID PROVIDER MODULE FUNCTION NAME
2608 HaskellEvent66022 libHSrts_thr-ghc8.4.2.dylib initCapability cap-create
2609 HaskellEvent66022 libHSrts_thr-ghc8.4.2.dylib freeCapabilities cap-delete
2610 HaskellEvent66022 libHSrts_thr-ghc8.4.2.dylib setNumCapabilities cap-disable
2611 HaskellEvent66022 libHSrts_thr-ghc8.4.2.dylib setNumCapabilities cap-enable
2612 HaskellEvent66022 libHSrts_thr-ghc8.4.2.dylib initCapability capset-assign-cap
2613 HaskellEvent66022 libHSrts_thr-ghc8.4.2.dylib initCapabilities capset-create
2614 HaskellEvent66022 libHSrts_thr-ghc8.4.2.dylib freeCapabilities capset-delete
2615 HaskellEvent66022 libHSrts_thr-ghc8.4.2.dylib freeCapabilities capset-remove-cap
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 47K of event 'cpu-clock'
# Event count (approx.): 11836750000
#
# Overhead Command Shared Object Symbol
# ........ ............... .................. ..................................
@last-g
last-g / Stock GHC 8.4.1
Created May 23, 2018 16:30
Stock GHC perf output
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 45K of event 'cpu-clock'
# Event count (approx.): 11433750000
#
# Overhead Command Shared Object Symbol
# ........ .............. .................. ..................................
@last-g
last-g / GHC 8.4.1 + D4713
Created May 23, 2018 16:30
Named info tables as functions perf output
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 44K of event 'cpu-clock'
# Event count (approx.): 11122000000
#
# Overhead Command Shared Object Symbol
# ........ ............... .................. .....................................................
@last-g
last-g / GHC 8.4.1 + D4713 + D4722
Created May 23, 2018 16:30
Removed function symbols + removed internal symbols perf output
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 46K of event 'cpu-clock'
# Event count (approx.): 11516500000
#
# Overhead Command Shared Object Symbol
# ........ ............... .................. .....................................................
@last-g
last-g / freqs.cpp
Last active February 22, 2017 22:59
Test task for unigine
// --std=c++11
// was tested with gcc 6.2.0 & clang 3.8.1 on x86_64 GNU/Linux
// wasn't tested with MSVS
// Will fail on non-utf8 data
#include <iostream>
#include <fstream>
#include <iterator>
#include <algorithm>
@last-g
last-g / scrap_afisha.py
Last active June 21, 2016 15:38
Scrapping statistical data from Yandex.Afisha
from __future__ import division, unicode_literals, print_function, absolute_import
import os
from pprint import pprint
import requests
# 'https://afisha.yandex.ru/api/events
# /actual?limit=12&offset=12&tag=concert&hasMixed=0&city=moscow'
# https://afisha.yandex.ru/api/events
@last-g
last-g / decorator.py
Last active June 13, 2016 17:34
Universal decorator (works both with methods and functions)
#!/usr/bin/env python3
from functools import update_wrapper, partial
class debug_call:
def __init__(self, fn_or_method):
update_wrapper(self, fn_or_method)
def __call__(self, *args, **kwars):
print(self.__wrapped__.__qualname__)
return self.__wrapped__(*args, **kwars)