Skip to content

Instantly share code, notes, and snippets.

View murilobsd's full-sized avatar
🍀
cvs -q up -Pd -A

msi murilobsd

🍀
cvs -q up -Pd -A
View GitHub Profile
function remove-docker-containers
echo "Stop running shit"
docker stop (docker ps -q)
echo "Remove the whale shit"
docker rm (docker ps -a -q)
end
function remove-docker-images
remove-docker-containers
@murilobsd
murilobsd / work_queue.rs
Last active December 25, 2020 04:42 — forked from NoraCodes/work_queue.rs
An example of a parallel work scheduling system using only the Rust standard library
// Here is an extremely simple version of work scheduling for multiple
// processors.
//
// The Problem:
// We have a lot of numbers that need to be math'ed. Doing this on one
// CPU core is slow. We have 4 CPU cores. We would thus like to use those
// cores to do math, because it will be a little less slow (ideally
// 4 times faster actually).
//
// The Solution:
@murilobsd
murilobsd / delete_all_awslogs.sh.md
Created December 12, 2019 17:25 — forked from pahud/delete_all_awslogs.sh.md
delete all aws log groups

specify the region

export AWS_DEFAULT_REGION=ap-northeast-1
aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | \
awk '{print $2}' | grep -v ^$ | while read x; do  echo "deleting $x" ; aws logs delete-log-group --log-group-name $x; done

only delete loggroup name starting with /aws/lambda

@murilobsd
murilobsd / main.c
Created August 22, 2019 11:46 — forked from josephg/main.c
kqueue network & file example
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/event.h>
#include <netdb.h>
#include <assert.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
@murilobsd
murilobsd / dht-walkthrough.md
Created February 12, 2019 16:47 — forked from gubatron/dht-walkthrough.md
DHT walkthrough notes

DHT Walkthrough Notes

I've put together these notes as I read about DHT's in depth and then learned how the libtorrent implementation based on the Kademlia paper actually works.

What problem does this solve?

400,000,000,000 (400 billion stars), that's a 4 followed by 11 zeros. The number of atoms in the universe is estimated to be around 10^82. A DHT with keys of 160 bits, can have 2^160 possible numbers, which is around 10^48

@murilobsd
murilobsd / tg_bot.py
Created July 3, 2018 19:28
Telegram Bot example
#!/usr/bin/env python
from __future__ import print_function
import datetime
import os
import random
import re
import time
import telepot
"""Simples script para baixar imagens do captcha do portal TJSP.
Copyright (c) 2016, Murilo Ijanc
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
import asyncio
from bson import ObjectId
class MongoAuthPlugin(BaseAuthPlugin):
def __init__(self, context):
super().__init__(context)
self._db = db
@asyncio.coroutine
#!/usr/bin/env python
# coding=utf-8
import urllib2
import argparse
import facebook
import time
import random
import re
from lxml import html
@murilobsd
murilobsd / consulta
Last active August 29, 2015 14:17
consulta juristec
<?xml version="1.0" encoding="utf-8"?>
<!-- ***************************************************-->
<!-- *** Schema juristec XML ***-->
<!-- *** Lab804 http://www.lab804.com.br ***-->
<!-- ***************************************************-->
<IRQL>
<script/>
<header>
<statistics>
<irqlDuration>00:00:00</irqlDuration>