Skip to content

Instantly share code, notes, and snippets.

View nyimbi's full-sized avatar

Nyimbi Odero nyimbi

  • Datacraft
  • Nairobi
View GitHub Profile
Most remember Pieter Hintjens for his messaging protocols. I don't know anything about that,
but I credit him with rekindling my love of programming in general, Lisp and functional programming
in one fell swoop about 17 years ago.
He did this by writing 'Libero', a mid-90's C program that took an ASCII diagram of a state machine
and produced code that ran that machine in a remarkable number of languages including 'sh', 'python',
'C' and many more. Some of them are listed on the original page (https://imatix-legacy.github.io/libero/).
I discovered in the early 00's and it fascinated me because was a unique combination of code generation
and what is now called purely functional programming.
@nyimbi
nyimbi / workflows-in-django.md
Created March 10, 2021 10:31 — forked from Nagyman/workflows-in-django.md
Workflows in Django

Workflows (States) in Django

I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.

Common Software Uses

  • Publishing (Draft->Approved->Published->Expired->Deleted)
crontab: command used to schedule and run tasks in the background at defined regular intervals.
Format:
* * * * * *
( MIN HOUR DOM MON DOW CMD )
where:
MIN- minute -0-59
1. `vim /etc/syslog.conf`
2. Add to end of file: `cron.* /var/log/cron.log`
3.
```
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist
```
[where-is-the-cron-log-file-in-macosx-lion](http://apple.stackexchange.com/questions/38861/where-is-the-cron-log-file-in-macosx-lion)
@nyimbi
nyimbi / verbiage.py
Created January 24, 2021 20:53 — forked from elidchan/verbiage.py
Utilities for indefinite article and plurality
import ast
import contextlib
import json
import os
import string
from collections import OrderedDict
from enum import Enum
from numbers import Number
from string import Template
@nyimbi
nyimbi / README.md
Created January 22, 2021 08:41 — forked from pujansrt/README.md
A Generator for generating a Finite State Machine in Python

Finite State Machine Generator

Tested using: Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin

Mac OS X 10.6.2

Creation

import re
import sys
import json
from wikipedia2vec import Wikipedia2Vec
ev = Wikipedia2Vec.load("./enwiki_20180420_100d.pkl")
regex = r'\[\[(.+?)\]\]'
regex_first = r"'''(.+?)'''"
regex_title = r'<title>(.+?)</title>'
@nyimbi
nyimbi / open-source-sso.md
Created January 19, 2021 07:48 — forked from yanivmn/open-source-sso.md
Comparison of open-source SSO implementations
Aerobase Keycloak WSO2 Identity Server Gluu CAS OpenAM Shibboleth IdP
OpenID Connect/OAuth support yes yes yes yes yes yes third-party
Multi-factor authentication yes yes yes yes yes yes yes
Admin UI yes yes yes yes yes yes no
OpenJDK support yes yes yes yes no
Identity brokering yes yes yes
Middleware NGINX, Wildfly Wildfly, JBOSS WSO2 Carbon Jetty, Apache HTTPD any Java app server any Java app server Jetty, Tomc
@nyimbi
nyimbi / RsyncOverSsh_Fast_Documentation.md
Created January 18, 2021 07:03 — forked from thomasdarimont/RsyncOverSsh_Fast_Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@nyimbi
nyimbi / readme.md
Created January 18, 2021 05:27 — forked from thomasdarimont/readme.md
Linux create RAM Disk

Create and mount RAM disk

mkdir -p /tmp/build
sudo mount -t tmpfs -o size=512M tmpfs /tmp/build

Unmount RAM disk

sudo umount /tmp/build