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()
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)
}
}
}
// 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
@rblaze
rblaze / fail.hs
Last active December 18, 2015 02:16
{-# Language MultiParamTypeClasses, PolyKinds #-}
module Monads where
import Control.Monad.Reader
import Data.Binary.Get
import Data.Proxy
import qualified Data.ByteString.Lazy as BS
type ReadContext = String
type MyGetM m = ReaderT ReadContext m
@rblaze
rblaze / file.hs
Last active December 11, 2015 01:07
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import qualified Data.Binary.Get as G
type BGetM = ReaderT SchemaDef G.Get
newtype BGet t a = BGet (BGetM a)
deriving (Functor, Applicative, Monad)
class Proto t where
bGetInt32 :: BGet t Int32
@rblaze
rblaze / A.hs
Created November 23, 2015 18:58
Make it compile without creating extra modules. hs-boot is fine
module A where
data InnerType = InnerType { foo :: Int }
inVar :: OuterType
inVar = OuterType (InnerType 2)
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,C57436288A327D03B9C7B2607E088092
Nil8Qg2o7TFLIyG2zqwjhbAzOYcGuRJfeWsDuG1xQTRJtdxDhglDjlmWSdKmaUPZ
cPUgsU2oO/N1IoVbseqL0newhUvsU9RyOeXQD41gjGjxBYsKV69v7FFQ6Upw0plR
oS2vj637pr2Ax63DwkhPMSubCaC4p1o48FYYGjim4FTcPjvZbnD9d1f2MCA8O6mZ
8Wc+Tk7kF6D3qZUMfw4gixc2ft1ImRIQ5f5ReXHhP3IPpbZfpZbe0Q8lkTiOPIQu
9FdeLMXQZBMENCnIegi1+cI3x6uBcAP4TpXgkXQg8PFQ18epT9epTcMzr7rjLQpd
pWDCO+tqSlzTtknPq4kBQGnbXJ50uRw/kjBMK9DGjU5zO5dvXnk9DMU4N9jMPKzh