Skip to content

Instantly share code, notes, and snippets.

View rblaze's full-sized avatar

Andrey Sverdlichenko rblaze

View GitHub Profile
(echo '"Date","Amount","Account Name"' ; tail -n +2 ~/Downloads/trends.csv | sed -e 's/January /01-/' -e 's/February /02-/' -e 's/March /03-/' -e 's/April /04-/' -e 's/May /05-/' -e 's/June /06-/' -e 's/July /07-/' -e 's/August /08-/' -e 's/September /09-/' -e 's/October /10-/' -e 's/November /11-/' -e 's/December /12-/' -e 's/"\(.*\)","\$\(.*\)",".*",".*"/"\1","\2","ACCOUNT_NAME_HERE"/' -e 's/^"\([0-9]\+\)-\([0-9]\+\)/"\2-\1-01/') > /tmp/balances.csv
@rblaze
rblaze / build_schedule.py
Created March 10, 2023 22:47
Schedule builder
from ortools.sat.python import cp_model
from ortools.sat.cp_model_pb2 import CpSolverStatus
num_lectors = 4
num_groups = 3
num_lessons_per_day = 3
num_days = 5
model = cp_model.CpModel()
@rblaze
rblaze / mersenne32.hs
Created August 1, 2011 15:40
32-bit Mersenne Twister in Haskell
import Data.Bits
import Data.Word
import System.Random
mtN = 624
mtM = 397
data MersenneTwister = MersenneTwister [Word32] Int
deriving Show
VL53L1X_ERROR VL53L1X_SensorInit(uint16_t dev)
{
VL53L1X_ERROR status = 0;
uint8_t Addr = 0x00, tmp;
for (Addr = 0x2D; Addr <= 0x87; Addr++){
status = VL53L1_WrByte(dev, Addr, VL51L1X_DEFAULT_CONFIGURATION[Addr - 0x2D]);
}
status = VL53L1X_StartRanging(dev);
tmp = 0;
{-# Language TypeFamilies, StandaloneDeriving, GeneralizedNewtypeDeriving, UndecidableInstances #-}
module Example where
newtype N p m a = N (((CT p) m) a)
deriving instance (CT p ~ f, Functor (f m)) => Functor (N p m)
deriving instance (CT p ~ f, Applicative (f m)) => Applicative (N p m) -- internal error when this line added
class C p where
type CT p :: (* -> *) -> * -> *
class Foo(a: Int) {
def bar(other: Foo) {
other match {
case f : Foo => println(f.a)
}
}
}
@rblaze
rblaze / gist:6954192
Created October 12, 2013 19:57
Сериализация данных и ночные кошмары
0 : 0 0 0 0 0 0 0 0 0
1 : 1 0 0 0 0 0 0 0 0
12 : 12 0 0 0 0 0 0 0 0
123 : 81 23 0 0 0 0 0 0 0
1234 : 92 34 0 0 0 0 0 0 0
12345 : c1 45 23 0 0 0 0 0 0
123456 : d2 56 34 0 0 0 0 0 0
1234567 : e1 23 67 45 0 0 0 0 0
12345678 : f0 78 56 34 12 0 0 0 0
123456789 : f1 89 67 45 23 0 0 0 0
@rblaze
rblaze / test.hs
Created September 30, 2013 13:41
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Exception
import System.Exit
main :: IO ()
main = do
r <- catch (do
let [r, _] = ['a']
// LockedWindow.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "LockedWindow.h"
#define MAX_LOADSTRING 100
// Global Variables:
HINSTANCE hInst; // current instance
import XMonad
import XMonad.Config.Gnome
import XMonad.Util.EZConfig
import XMonad.Hooks.ManageHelpers (isFullscreen,doFullFloat)
import qualified XMonad.StackSet as W
myWorkspaces = ["1","2","3","4","5","6","7","8","9"]
main = xmonad $ gnomeConfig