Skip to content

Instantly share code, notes, and snippets.

View karimamer's full-sized avatar

karim amer karimamer

View GitHub Profile
@ma7dev
ma7dev / cool_script.sh
Last active September 5, 2022 13:23
takes requirements.txt file without module versions and annotates it with the latest set of module versions that won't result in build/runtime errors.
#!/bin/bash
# TODO: you will need to have conda installed
# create a python environment
conda create -n env_tmp python=3.8.13 -y
# activate environment
conda activate env_tmp

Haskell in Production: Adventures in Blockchain Building

@RobBlackwell
RobBlackwell / configuration.nix
Last active July 19, 2021 06:27
NixOS on Dell XPS 13
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@djspiewak
djspiewak / Free.hs
Created January 13, 2017 18:23
RoomConf Talk: Free as in Monads
data Free f a =
Return a |
forall e . Bind (Free f e) (e -> Free f a) |
LiftF (f a)
instance Monad (Free f) where
return = Return
(>>=) = Bind
liftF :: f a -> Free f a
@djspiewak
djspiewak / ambiguity-example.txt
Created January 10, 2017 17:33
Parsers Talk Notes
S ::= S S S
| S S
| 'a'
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
O(n^3)
@Daenyth
Daenyth / functional.py
Last active June 20, 2018 17:45
functional.py
"""
Functional programming utilities for python
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# pylint: disable=redefined-builtin
from collections import defaultdict
from copy import copy
@ckandoth
ckandoth / uwsgi_nginx_on_centos6.7.txt
Last active August 10, 2019 22:27
Set up nginx and uwsgi emperor on a CentOS 6.7 box
# GOAL: On a CentOS 6.7 minimal install, set up nginx as a reverse proxy to uWSGI Emperor with python 2.7.11 as a plugin to run Flask apps
# ::NOTE:: All instructions below are run as a sudoer, not as root. Talk to your sysadmins if you're not a sudoer.
# Install bare essentials:
sudo yum install -y epel-release
sudo yum groupinstall 'Development Tools'
sudo yum install -y vim openssl unzip nginx openssl-devel zlib-devel sqlite-devel bzip2-devel libffi-devel lapack-devel blas-devel libpng-devel freetype-devel
# Set SELINUX=disabled in the file below, and reboot, or this tutorial will get unnecessarily complicated:
@johnynek
johnynek / stref.scala
Last active November 10, 2015 19:47
mutable variables via a state thread in scala. This is just meant as an illustration of how ST in haskell works, and more generally, how you can implement mutation with immutable APIs.
object STRef {
/**
* Here is a container where we have a single "state thread" = ST.
* When we run this thread of type ST[T] we get a result of type T.
*/
sealed abstract class ST[+T] {
def map[R](fn: T => R): ST[R] = flatMap(t => Const(fn(t)))
def flatMap[R](fn: T => ST[R]): ST[R] = FlatMapped(this, fn)
}
@staltz
staltz / introrx.md
Last active June 21, 2024 12:27
The introduction to Reactive Programming you've been missing