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 / 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 / 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>>
{
@3gx
3gx / find_bad_revisions
Created January 9, 2016 18:39 — forked from cheeming/find_bad_revisions
A bash script to use git bisect to help bad revisions
#!/bin/bash
function print_usage () {
echo usage: $0 LAST_KNOWN_GOOD_REVISION '"TEST_COMMAND"'
echo LAST_KNOWN_GOOD_REVISION = you can specify this as sha1 hash
echo TEST_COMMAND = the script to run, it should return 0 if success
echo NOTE: Ensure that the current revision is the bad \(broken\)
exit 1;
}
@3gx
3gx / note.sh
Created November 20, 2015 07:21
new way to install llvm libc++ in Ubuntu 14.04 Trusty
# http://llvm.org/apt/
sudo bash -c "cat >> /etc/apt/sources.list" << LLVMAPT
# LLVM
deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main
deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty main
# 3.5
deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.5 main
deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.5 main
# 3.6
@3gx
3gx / variant.cc
Created October 28, 2015 18:52 — forked from tibordp/variant.cc
A simple variant type implementation in C++
#include <iostream>
#include <utility>
#include <typeinfo>
#include <type_traits>
#include <string>
template <size_t arg1, size_t ... others>
struct static_max;
template <size_t arg>
@3gx
3gx / function-argument.cmake
Last active November 8, 2018 11:36 — forked from antiagainst/function-argument.cmake
ARGC, ARGV, ARGN, ARGVn in CMake
cmake_minimum_required(VERSION 2.8)
function(use_llvm TARGET)
message("ARGC=\"${ARGC}\"")
message("ARGN=\"${ARGN}\"")
message("ARGV=\"${ARGV}\"")
message("ARGV0=\"${ARGV0}\"")
message("ARGV1=\"${ARGV1}\"")
endfunction()