Skip to content

Instantly share code, notes, and snippets.

View 3gx's full-sized avatar
💭
I may be slow to respond.

Evghenii 3gx

💭
I may be slow to respond.
View GitHub Profile
@3gx
3gx / capital_gain_taxes.py
Last active February 17, 2021 16:56
portoflio model
import random
from math import log, exp
def get_f(fmax):
f = 1+random.randrange(-fmax*100//10,2*fmax*100)/100.0/100.0
f = 1+random.gauss(fmax,fmax/2)/100
f = 1 + fmax/100
assert f > 0
return f
set tags+=tags;/
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
let g:jedi#completions_enabled = 0
let g:jedi#popup_on_dot = 0
let g:jedi#show_call_signatures = "0"
@3gx
3gx / abonimable-snoyman.rs
Created December 29, 2020 15:36 — forked from snoyberg/abonimable-snoyman.rs
Playing with GATs, transformers, and more
#![feature(generic_associated_types)]
#[allow(dead_code)]
trait Functor {
type Unwrapped;
type Wrapped<B>: Functor;
fn map<F, B>(self, f: F) -> Self::Wrapped<B>
where
F: FnMut(Self::Unwrapped) -> B;
@3gx
3gx / nosleep.sh
Created December 10, 2020 14:53
Completely disable sleep on any Mac
# Useful to prevent Macbooks to go to sleep when closing the lid instead of running tools that requires a Kernel Extension (e.g. InsomniaX) and more
# Before doing anything, save your current configuration using
pmset -g
# To disable sleep
sudo pmset -a sleep 0; sudo pmset -a hibernatemode 0; sudo pmset -a disablesleep 1;
# And to go back to normal
sudo pmset -a sleep 1; sudo pmset -a hibernatemode [original hibernatemode value]; sudo pmset -a disablesleep 0;
@3gx
3gx / haskeller_competency_matrix.md
Created July 27, 2020 18:27 — forked from graninas/haskeller_competency_matrix.md
Haskeller competency matrix

Haskeller Competency Matrix

See also List of materials about Software Design in Haskell

Junior Middle Senior Architect
Haskell level Basic Haskell Intermediate Haskell Advanced Haskell Language-agnostic
Haskell knowledge scope Learn you a Haskell Get programming with Haskell Haskell in Depth Knows several languages from different categories
Get programming with Haskell Haskell in Depth Functional Design and Architecture
[Other books on Software Architecture in Haskell](https://github.com/graninas/software-design-in-haskell#Books-on-S
@3gx
3gx / raytracer.nim
Created September 3, 2019 02:34 — forked from AdrianV/raytracer.nim
a simple raytracer converted from D code from this https://dl.dropboxusercontent.com/u/974356/raytracer.d source
import math
import sequtils
import sdl
const
width = 1280
height = 720
fov = 45.0
max_depth = 6
@3gx
3gx / RefreshEnv.cmd
Created June 7, 2019 22:38
Refresh environmental variables
@echo off
::
:: RefreshEnv.cmd
::
:: Batch file to read environment variables from registry and
:: set session variables to these values.
::
:: With this batch file, there should be no need to reload command
:: environment every time you want environment changes to propagate
@3gx
3gx / conv.cpp
Created May 16, 2017 01:05
convolution example
#include <cuda.h>
#include <cudnn.h>
#include <helper_cuda_drvapi.h>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
void __check(cudnnStatus_t status, const char* const file, int const line)
@3gx
3gx / README.md
Created May 4, 2016 04:54 — forked from dpwright/README.md
Monadic operations in C++

Monadic operations in C++

This began as a further attempt to implement the Maybe monad in C++, but quickly spiralled out of control and now includes an implementation of the List monad as well (using std::list!). This is really for my own amusement rather than to try and do anything useful with them. It also gave me an excuse to try out C++ 11 lambda functions for the first time.

My original implementation defined a macro called MBind which caused a number of problems -- thankfully [PJayB][pjayb] managed to find a way around that so

@3gx
3gx / slide.cpp
Created May 4, 2016 04:53 — forked from ericniebler/slide.cpp
a counted range, and slide working with counted and non-counted iterators
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <range/v3/range.hpp>
using namespace ranges;
template<typename It>
class counted_range : public range_facade<counted_range<It>>
{