Skip to content

Instantly share code, notes, and snippets.

@jcrsilva
jcrsilva / task.py
Created November 26, 2019 23:27
Codility solution for gas station problem
#!/usr/bin/env python3
class Pump(object):
def __init__(self, fuel_capacity):
self.fuel_capacity = fuel_capacity
self.car = None
class GasStation(object):
@jcrsilva
jcrsilva / kafka_produce_consume.py
Created November 13, 2018 08:17
Small python script to produce+consume to a kafka broker. Tests that the broker is working.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import logging
import sys
import os
import random
import string
from kafka import KafkaConsumer, KafkaProducer
@jcrsilva
jcrsilva / .bashrc
Last active October 11, 2017 13:35
.bashrc for server use
### File managed with puppet ###
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it

Keybase proof

I hereby claim:

  • I am jcrsilva on github.
  • I am jcrsilva (https://keybase.io/jcrsilva) on keybase.
  • I have a public key ASCHSkD-cetVCHHWJnTb3YELwNAuBpsTz8ewWH1Aq4JcxQo

To claim this, I am signing this object:

@jcrsilva
jcrsilva / scheduler.py
Created October 19, 2016 13:41
Simple python scheduler script with logging
#!/usr/bin/env python
import datetime
import logging
from logging.handlers import RotatingFileHandler
import os
import subprocess
import sys
import threading