Skip to content

Instantly share code, notes, and snippets.

@Scoppio
Scoppio / main.java
Created September 9, 2020 19:21
Unbranched Max, thread-unsafe
package com.abstractobserver
import com.google.common.base.Stopwatch;
import sun.misc.Unsafe;
import java.lang.reflect.Field;
import java.util.Random;
import java.util.concurrent.TimeUnit;
/**
@Scoppio
Scoppio / co.c
Created February 27, 2019 17:05 — forked from lpereira/co.c
#include <stdio.h>
#include <stdbool.h>
struct coro {
void *state;
};
struct range_coro {
struct coro base;
int cur, max, step;
@Scoppio
Scoppio / ecs.md
Created February 17, 2019 03:39 — forked from paniq/ecs.md
Entity Component Systems
@Scoppio
Scoppio / min-char-rnn.py
Created January 27, 2017 23:43 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@Scoppio
Scoppio / watermarking.py
Created November 13, 2016 21:02
Watermark pictures inside a folder
# Coding: utf-8
# Python 3.5
# OpenCV 3.1.0
#
# Developed by Lucas Coppio
#
__author__ = "Lucas Scoppio"
__version__ = "0.1"
__date__ = "26 july 2016"
@Scoppio
Scoppio / consolerpg.py
Created October 18, 2016 04:57
A very simple console RPG mockup
from random import randint
class Character:
def __init__(self):
self.name = ""
self.health = 1
self.health_max = 1
def do_damage(self, enemy):
damage = min(max(randint(0, self.health) - randint(0, enemy.health), 0), enemy.health)
@Scoppio
Scoppio / download_multiple_files.py
Last active September 11, 2016 19:44
Download a bunch of files from somekind of "FTP" page
# Basically I wanted to download all the contrib modules for R present in the site...
# So I created this small script to do that for me.
from bs4 import BeautifulSoup
from requests import get
from os import path, makedirs
def download(url, file_name):
with open(file_name, "wb") as file:
response = get(url)
file.write(response.content)
@Scoppio
Scoppio / jinx.py
Created May 4, 2016 02:45
A simple gradient descent devised to capture the match ID of a game in a specific day, month and year.
def save_Log( e):
with open("logFile.log", "a") as logFile:
timestamp = time.strftime("%d/%m/%y %H:%M:%S", time.localtime())
logFile.write( timestamp + " " +str(e) + "\n")
def findFirstMatch(region: str='br',
api_key: str='api_key.json',
verbosity: bool=False,
year: int=2016,
month: int=1,