Skip to content

Instantly share code, notes, and snippets.

View p-alik's full-sized avatar

Alexei Pastuchov p-alik

View GitHub Profile
@notgne2
notgne2 / xps_9320.nix
Last active March 11, 2024 09:18
It Just Works ™️
{
config,
pkgs,
lib,
inputs,
...
}: let
ipu6-camera-bin = with pkgs;
stdenv.mkDerivation rec {
pname = "ipu6-camera-bin";
@adah1972
adah1972 / hashable_cache.py
Last active July 31, 2023 17:00
Decorator for using dicts/lists with any Python cache function (like lru_cache)
# Inspired by https://gist.github.com/harel/9ced5ed51b97a084dec71b9595565a71
from collections import namedtuple
import functools
import json
import six
Serialized = namedtuple('Serialized', 'json')
{-# LANGUAGE RankNTypes #-}
import Data.Functor.Const
import Data.Functor.Identity
type SimpleLens s a = forall f. Functor f => (a -> f a) -> s -> f s
view :: SimpleLens s a -> s -> a
view l = getConst . l Const
@naoto-ogawa
naoto-ogawa / sample_monadLogger.hs
Created January 15, 2017 07:27
Monad Logger Sample
-- {-# LANGUAGE OverloadedStrings #-}
import Data.Text
import Control.Monad.Trans
import Control.Monad.Trans.Maybe
import Control.Monad.Trans.State
import Control.Monad.Trans.Identity
import Control.Monad.Identity
import Control.Monad.Logger
@andyferra
andyferra / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@dspezia
dspezia / tst.cpp
Created December 10, 2011 12:45
Variadic rpush C++ hiredis example
#include <iostream>
#include <vector>
#include <string>
#include <stdexcept>
#include <hiredis.h>
using namespace std;
@simonmichael
simonmichael / gist:1185421
Created September 1, 2011 03:59
ghc-pkg-clean, ghc-pkg-reset
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.