Skip to content

Instantly share code, notes, and snippets.

View alexvorobiev's full-sized avatar
👨‍🚀

Alex Vorobiev alexvorobiev

👨‍🚀
View GitHub Profile
@alexvorobiev
alexvorobiev / tailscale-dafang.org
Created November 16, 2022 05:55
Tailscale on an ip camera running Dafang hacks firmware
@alexvorobiev
alexvorobiev / nix-python-update.sh
Created November 5, 2021 17:43
Update default.nix for a python package by querying Pypi
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p jq curl
set -o nounset
set -o errexit
d=$1
f="$1/default.nix"
{ stdenv, fetchurl, bzip2, gfortran, libX11, libXmu, libXt, libjpeg, libpng
, libtiff, ncurses, pango, pcre2, perl, readline, tcl, texLive, tk, xz, zlib
, less, texinfo, graphviz, icu, pkgconfig, bison, imake, which, jdk, blas, lapack
, curl, Cocoa, Foundation, libobjc, libcxx, tzdata, fetchpatch, lib
, withRecommendedPackages ? true
, enableStrictBarrier ? false
# R as of writing does not support outputting both .so and .a files; it outputs:
# --enable-R-static-lib conflicts with --enable-R-shlib and will be ignored
, static ? false
, mkl
{-# LANGUAGE StandaloneDeriving, DataKinds, PolyKinds, GADTs, RankNTypes, TypeOperators, FlexibleContexts, TypeFamilies, KindSignatures #-}
-- http://www.timphilipwilliams.com/posts/2013-01-16-fixing-gadts.html
module HRecursionSchemes where
import Control.Applicative
import Data.Functor.Identity
import Data.Functor.Const
import Text.PrettyPrint.Leijen hiding ((<>))
@alexvorobiev
alexvorobiev / IxFix.hs
Created March 9, 2019 04:32 — forked from AndrasKovacs/IxFix.hs
Example for recursion schemes for mutually recursive data
{-# LANGUAGE
UndecidableInstances, RankNTypes, TypeOperators, TypeFamilies,
StandaloneDeriving, DataKinds, PolyKinds, DeriveFunctor, DeriveFoldable,
DeriveTraversable, LambdaCase, PatternSynonyms, TemplateHaskell #-}
import Control.Monad
import Control.Applicative
import Data.Singletons.TH
@alexvorobiev
alexvorobiev / gist:65fd7bb4fc4fea709fb8db83f2c45735
Created March 4, 2019 18:12 — forked from sacundim/gist:5386823
Toy instructional example of Haskell GADTs: simple dynamic types.
{-# LANGUAGE GADTs #-}
-- | Toy instructional example of GADTs: simple dynamic types.
--
-- Before tackling this, skim the GHC docs section on GADTs:
--
-- <http://www.haskell.org/ghc/docs/latest/html/users_guide/data-type-extensions.html#gadt>
--
-- As you read this example keep in mind this quote from the
-- docs: "The key point about GADTs is that /pattern matching
@alexvorobiev
alexvorobiev / squash-commits.md
Created May 28, 2018 04:28 — forked from longtimeago/squash-commits.md
How to squash commits in a GitHub pull request

How to squash commits in a GitHub pull request

o you've contributed some code to an open source project, say, Rails. And they'd like you to squash all of the commits in your pull request. But you're not a git wizard; how do you make this happen?

Normally, you'd do something like this. I'm assuming upstream is a git remote that is pointing at the official project repository, and that your changes are in your 'omgpull' branch:

@alexvorobiev
alexvorobiev / configuration.nix
Last active February 10, 2019 06:10
NixOS on rpi3
{ config, pkgs, lib, ... }:
{
# NixOS wants to enable GRUB by default
boot.loader.grub.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
boot.loader.generic-extlinux-compatible.enable = true;
# !!! If your board is a Raspberry Pi 1, select this:
# boot.kernelPackages = pkgs.linuxPackages_rpi;
# !!! Otherwise (even if you have a Raspberry Pi 2 or 3), pick this: