Skip to content

Instantly share code, notes, and snippets.

View pacmancoder's full-sized avatar
🇺🇦

Vladyslav Nikonov pacmancoder

🇺🇦
View GitHub Profile
@pacmancoder
pacmancoder / eller.rs
Last active November 18, 2017 22:15
Shitty labyrinth generation using eller algorithm written in Rust
#![allow(dead_code)]
extern crate rand;
use rand::random;
/// Labyrinth Edge
#[derive(Clone,Copy)]
enum LabEdge {
Exist,
None,
@pacmancoder
pacmancoder / TMK_BTC_Keyboard.patch
Last active November 18, 2017 22:14
Patch for TMK firmware to work with old BTC keyboard (XT protocol)
diff --git a/converter/xt_usb/Makefile b/converter/xt_usb/Makefile
index 395115e..a798490 100644
--- a/converter/xt_usb/Makefile
+++ b/converter/xt_usb/Makefile
@@ -70,7 +70,7 @@ F_USB = $(F_CPU)
# Atmel DFU loader 4096
# LUFA bootloader 4096
# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=512
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
#!/bin/sh
xdotool keydown shift+ctrl+u
xdotool keyup u
xdotool key 1
xdotool key f
xdotool key 3
xdotool key 1
xdotool key a
xdotool keyup shift+ctrl
@pacmancoder
pacmancoder / PpmRasterizer.cpp
Created November 18, 2017 22:11
[Example] [Dcdr] How to write PPM format
// WARNING: this is a deprecated code from dcdr project;
// This can be broken, but still can be used as example how to write ppm file.
// Enjoy.
#include <vector>
#include <ifstream>
namespace Dcdr
{
// ------------- dcdr/Types.h ---------------
@pacmancoder
pacmancoder / Polynomial.cpp
Created January 21, 2018 21:37
Polynomial
#include <Polynomial.h>
#include <sstream>
#include <cmath>
using namespace Calculus;
Polynomial::Polynomial() :
Polynomial(PolynomialMap()) {}
Polynomial::Polynomial(const Polynomial::PolynomialMap& polyMap) :
@pacmancoder
pacmancoder / npp-flatbuffers.xml
Created February 4, 2018 12:55
Notepad++ Flatbuffers Syntax
<NotepadPlus>
<UserLang name="FlatBuffers Scheme" ext="fbs" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00// 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
/* Vladislav Nikonov [2018]
*
* Template visitor implementation, which will wait for concrete visitor dispatch,
* and will throw on other events. This can be done by method overload based on template type.
* This method will be overriden by function call, provided by client code
*/
#include <iostream>
#include <memory>
#include <vector>
@pacmancoder
pacmancoder / RwLockProxy.cpp
Last active February 20, 2018 15:34
Read-Write lock proxy for any type
/* Vladislav Nikonov [2018]
*
* This class represents read-write lock proxy for any type. Writer always have higest
* entrance priority (e.g. if object was already locked by readers - no new readers allowed before
* writer exit from lock.
*/
#include <mutex>
#include <shared_mutex>
#include <chrono>
@pacmancoder
pacmancoder / poc.rs
Last active October 23, 2018 22:08
[Rust] Overlaying Slices iterator PoC
extern crate rayon;
use rayon::prelude::*;
struct State<'a>
{
first: &'a [usize],
other: &'a mut [usize],
value: Option<(&'a [usize], &'a mut [usize], &'a [usize])>,
}
@pacmancoder
pacmancoder / unsafe_test.rs
Created October 25, 2018 16:46
Exploring unsafe in rust
extern crate rayon;
use rayon::prelude::*;
use std::marker::PhantomData;
use std::mem;
struct Storage<'a, T : 'a>
{
ptr: *mut T,
phantom: PhantomData<&'a T>,