Skip to content

Instantly share code, notes, and snippets.

View ranisalt's full-sized avatar

Ranieri Althoff ranisalt

View GitHub Profile
@ranisalt
ranisalt / rw.java
Created June 12, 2015 05:59
Problema dos Comedodes-Dadeiros
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Semaphore;
public class Main {
private Semaphore empty, full, readers, writers;
private List<Double> buffer;
private List<Thread> threads;
public class Reader implements Runnable {
@ranisalt
ranisalt / iomap.cpp
Last active August 29, 2015 14:22
Buggy file
#include "lodepng/lodepng.h"
#include "iomap.h"
bool IOMap::exportPNG(const Map& map, std::string filename)
{
uint32_t size = static_cast<uint32_t>(map._height) * static_cast<uint32_t>(map._width);
std::vector<uint8_t> bytes(size * 4);
for (uint16_t x = 0; x < map._height; ++x) {
for (uint16_t y = 0; y < map._width; ++y) {
@ranisalt
ranisalt / fix-offline-traning-rate.patch
Last active April 1, 2020 14:15
Fix offline traning rate
From 9063dccc1a8a730c6ffce6e78567e191e217be6e Mon Sep 17 00:00:00 2001
From: Ranieri Althoff <[email protected]>
Date: Mon, 1 Jun 2015 02:52:35 -0300
Subject: [PATCH] Fix offline traning ignoring skill/magic rate
---
src/player.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/player.cpp b/src/player.cpp
@ranisalt
ranisalt / player-timestamp.patch
Created June 1, 2015 05:20
Player login/out timestamp
From b05c021f0023fb17ab502e0b7dc0baecedcb0c7f Mon Sep 17 00:00:00 2001
From: Ranieri Althoff <[email protected]>
Date: Mon, 1 Jun 2015 02:16:42 -0300
Subject: [PATCH] Add timestamp to player log in/out message
---
src/player.cpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/player.cpp b/src/player.cpp
#include <chrono>
#include <iostream>
#include <mutex>
#include <thread>
#include <vector>
const unsigned int philosophers = 5;
const unsigned int iterations = 10;
std::mutex output;
// Configure pings accordingly
enum LED_PINS {
LED_RED = 0,
LED_GREEN = 1,
LED_BLUE = 2,
LED_PWM = 3
};
void writeColor(int color) {
GPIO_Pin red(LED_RED), green(LED_GREEN), blue(LED_BLUE), pwm(LED_PWM);
@ranisalt
ranisalt / offline-training-optional.patch
Created May 11, 2015 05:36
Offline training optional
From 39f11e36d0fc2cf43a06108808d6bba35462dc8f Mon Sep 17 00:00:00 2001
From: Ranieri Althoff <[email protected]>
Date: Mon, 11 May 2015 01:36:26 -0300
Subject: [PATCH] Make offline training optional via config.lua
---
config.lua | 1 +
src/actions.cpp | 6 +++++-
src/configmanager.cpp | 1 +
src/configmanager.h | 1 +
@ranisalt
ranisalt / dual-wielding.patch
Last active January 9, 2023 01:10
TFS 1.1 dual wielding
From 0daf4a3aa895283cf847d4333748ae69eec9b990 Mon Sep 17 00:00:00 2001
From: Ranieri Althoff <[email protected]>
Date: Thu, 9 Jul 2015 03:38:45 -0300
Subject: [PATCH] Enable dual weapon wielding, batteries included.
---
config.lua | 8 ++++++
src/configmanager.cpp | 3 +++
src/configmanager.h | 3 +++
src/luascript.cpp | 4 +++
@ranisalt
ranisalt / update-ip.sh
Created April 21, 2015 03:45
Auto update IP
#!/usr/bin/env sh
sed -i "s/^\(ip\s*=\s*\)\".*\"/\1\"$(curl -s icanhazip.com)\"/" config.lua
From 275f39c3faa61e59383915288de85cc90d9aca06 Mon Sep 17 00:00:00 2001
From: Ranieri Althoff <[email protected]>
Date: Sun, 19 Apr 2015 03:47:18 -0300
Subject: [PATCH 1/1] Make player walkthrough optional
---
config.lua | 1 +
src/configmanager.cpp | 1 +
src/configmanager.h | 1 +
src/player.cpp | 4 ++--