Skip to content

Instantly share code, notes, and snippets.

@progval
progval / history.py
Created July 25, 2013 19:32
Limited-length sorted list.
import bisect
import operator
import unittest
class history:
"""Limited-length sorted list."""
def __init__(self, maxlen):
self._maxlen = maxlen
self._list = []
def __repr__(self):
@progval
progval / I2C.py
Created July 16, 2014 17:49 — forked from Technicus/I2C.py
import smbus
import time
# for RPI version 1, use "bus = smbus.SMBus(0)"
bus = smbus.SMBus(1)
# This is the address we setup in the Arduino Program
address = 0x04
def writeNumber(value):
bus.write_byte(address, value)
@progval
progval / keybase.md
Created September 12, 2014 13:21
keybase.md

Keybase proof

I hereby claim:

  • I am ProgVal on github.
  • I am progval (https://keybase.io/progval) on keybase.
  • I have a public key whose fingerprint is 3790 43E3 DF96 D323 7E67 82AC 0E08 2B40 E437 6B1E

To claim this, I am signing this object:

@progval
progval / infc.sh
Last active March 29, 2018 21:42
Script to run the Official Infclass servers
#!/bin/sh
NUM=$1
PORT=$2
MYSQL_HOST=${MYSQL_HOST:-192.168.2.1}
DIR=/home/official-infclass/teeworlds-infclass
FNCFG=$DIR/config/tw06-infclass$NUM.cfg
FNGDB=$DIR/config/tw06-infclass$NUM.gdb
FNLOG=$DIR/logs/tw06-infclass$NUM-$(date +"%y-%m-%d-%T").txt
PARAM="-f $FNCFG"
@progval
progval / main.rs
Created June 19, 2018 23:17 — forked from Yatekii/main.rs
use nom::types::CompleteStr;
use std::str;
use nom::space;
use nom::types::CompleteByteSlice;
//use geometry::SchemaPoint2D;
pub struct SchemaPoint2D(f32, f32);
impl SchemaPoint2D {
fn new(x:f32, y:f32) -> SchemaPoint2D {
diff --git a/src/drivers/Socket.py b/src/drivers/Socket.py
index c9e9d19f..08787fb4 100644
--- a/src/drivers/Socket.py
+++ b/src/drivers/Socket.py
@@ -223,7 +223,13 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
def connect(self, **kwargs):
self.reconnect(reset=False, **kwargs)
- def reconnect(self, wait=False, reset=True):
+ def reconnect(self, **kwargs):
@progval
progval / rule90.rs
Last active February 1, 2023 20:21
#![recursion_limit="1024"]
macro_rules! rule90 {
// Initialization
( ($($fuel:tt)*) | $($cells:tt,)* ) => {
rule90!( __cont ($($fuel)*) | ($($cells,)*) | (($($cells,)*)) );
};
// Initialize the line
( __cont (f $($fuel:tt)*) | ($($cells:tt,)*) | ($(($($history:tt,)*))* ) ) => {
@progval
progval / mindustry_log.patch
Last active February 23, 2020 21:16
Mindustry log builds
diff --git a/core/src/mindustry/graphics/MinimapRenderer.java b/core/src/mindustry/graphics/MinimapRenderer.java
index c34bb246e..84a8b8d5e 100644
--- a/core/src/mindustry/graphics/MinimapRenderer.java
+++ b/core/src/mindustry/graphics/MinimapRenderer.java
@@ -92,9 +92,13 @@ public class MinimapRenderer implements Disposable{
float rx = !withLabels ? (unit.x - rect.x) / rect.width * w : unit.x / (world.width() * tilesize) * w;
float ry = !withLabels ? (unit.y - rect.y) / rect.width * h : unit.y / (world.height() * tilesize) * h;
- Draw.mixcol(unit.getTeam().color, 1f);
+ Draw.color(unit.getTeam().color);
@progval
progval / selectLlvm.patch
Created April 19, 2020 12:23
selectLlvm.patch
diff --git a/pkgs/development/compilers/rust/1_29.nix b/pkgs/development/compilers/rust/1_29.nix
index ba76e6555ce..d0a494b03af 100644
--- a/pkgs/development/compilers/rust/1_29.nix
+++ b/pkgs/development/compilers/rust/1_29.nix
@@ -11,7 +11,7 @@ import ./default.nix {
rustcVersion = "1.29.0";
rustcSha256 = "1sb15znckj8pc8q3g7cq03pijnida6cg64yqmgiayxkzskzk9sx4";
- llvm = llvm_7;
+ selectLlvm = pkgs: pkgs.llvm_7;
[nix-shell:~/nixpkgs/source]$ tools/bin/minicargo rustc-1.29.0-src/src/vendor/libssh2-sys/ --vendor-dir rustc-1.29.0-src/src/vendor/ --output-dir output/cargo-build -L output/
(0/7) BUILDING cc v1.0.18
> /home/val/nixpkgs/source/bin/mrustc rustc-1.29.0-src/src/vendor/cc/src/lib.rs -o output/cargo-build/libcc-1_0_18.rlib --crate-name cc --crate-type rlib -C emit-depfile=output/cargo-build/libcc-1_0_18.rlib.d --crate-tag 1_0_18 -g --cfg debug_assertions -O -L output -L output/cargo-build
(1/7) BUILDING cmake v0.1.31
> /home/val/nixpkgs/source/bin/mrustc rustc-1.29.0-src/src/vendor/cmake/src/lib.rs -o output/cargo-build/libcmake-0_1_31.rlib --crate-name cmake --crate-type rlib -C emit-depfile=output/cargo-build/libcmake-0_1_31.rlib.d --crate-tag 0_1_31 -g --cfg debug_assertions -O -L output -L output/cargo-build --extern cc=output/cargo-build/libcc-1_0_18.rlib
(2/7) BUILDING pkg_config from pkg-config v0.3.11
> /home/val/nixpkgs/source/bin/mrustc rustc-1.29.0-src/src/vendor/pkg-config/src/lib.rs -o output/cargo-