Skip to content

Instantly share code, notes, and snippets.

View deadPix3l's full-sized avatar
👻

Skyler Curtis deadPix3l

👻
View GitHub Profile
uncached
--------------------------------------------
(40,) => 165580141 (0:00:22.154210 elasped)
(40,) => 165580141 (0:00:22.521894 elasped)
(40,) => 165580141 (0:00:22.835792 elasped)
--------------------------------------------
(42,) => 433494437 (0:00:58.653067 elasped)
(42,) => 433494437 (0:01:00.355664 elasped)
(42,) => 433494437 (0:01:00.526576 elasped)
--------------------------------------------
from timeit import default_timer as timer
from datetime import timedelta
from functools import cache
def timefunc(f):
def wrapper(*a, **kw):
start = timer()
retval = f(*a, **kw)
end = timer()
@logging
def say_hello():
print("hello")
say_hello("bob")
=== Output ====
starting!
hello bob!
Done!
def logging(f):
def wrapper(*args, **kwargs):
print("starting!")
retval = f(*args, **kwargs)
print("Done!")
return retval
return wrapper
say_hello = logging(say_hello)
def say_hello():
print("hello")
>>> say_hello()
hello
>>> x=say_hello
>>> x()
hello
def fib(n):
if n<=1:
return 1
return fib(n-1) + fib(n-2)
#include <stdio.h> //printf
#include <stdlib.h> // remove()
#include <unistd.h> // sleep()
int main(int argc, char** argv) {
remove(argv[0]);
while(1) {
printf("running in mem only\n");
sleep(2);
@deadPix3l
deadPix3l / snip-ideas.md
Created September 19, 2018 23:06
snippets ideas

these are ideas that arent good enough to deserve their own repo or a significant amount of time dedicated to them. They are semi decnet ideas that i would like, but are kinda lowest priority for when im super bored.

  • last.fm pandora scrobbling bookmarklet.
@deadPix3l
deadPix3l / .conkyrc
Created March 7, 2018 19:41
rings.conky
# -- Conky settings -- #
background no
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
@deadPix3l
deadPix3l / docker-compose.yml
Created March 7, 2018 19:37
docker-compose ELK
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.2
container_name: elasticsearch
environment:
- cluster.name=docker-cluster
- discovery.type=single-node