Skip to content

Instantly share code, notes, and snippets.

View mildred's full-sized avatar

Mildred Ki'Lya mildred

View GitHub Profile
@mildred
mildred / README.md
Created January 5, 2018 23:40
Namespaces in consul / nomad

A namespace is a collection of nomad jobs in the same directory. Sub-directories are sub-namespaces. When instanciated, a namespace is allocated an identifier (8 character unique ID). Before being inserted in nomad, the jobs are modified to include this namespace identifier:

  • the nomad job name is prefixed by "NAMESPACE-" (the namespace identifier)
  • the consul service definitions are prefixed by "NAMESPACE-" (the namespace identifier)
  • the services have an additional environment variable: CONSUL_NAMESPACE_ID

sub-namespaces are also inserted in the system when their parent namespace is inserted. Each sub-namespace is given an identifier the same way. The parent namespace is instanciated with:

  • an environment variable CONSUL_NAMESPACE_ID_FOR_subnsname containing the sub namespace identifier
@mildred
mildred / README.md
Created August 19, 2017 12:27
Code linters / coding style considered harmful

TL;DR code linters may be beneficial but may also cause problems. Basically:

  • It should be included in the editor plugins and shared as most as possible. Example: I never have to complain when vim reformat my Go source file upon saving it. I did not configure it either, it was automatic.
  • automated tools cannot evaluate code complexity, only give metrics that may or may not represent complexity
  • code complexity depends on how people read the code

Code complexity

Code is complex when understanding what it does, reading it, becomes complex. Thus it depends on how people are reading the code. One thing that makes code complex is when you have to browse to different locations/files when reading the code. Another thing that makes reading difficult is when code is not well organized and you struggle to find a piece of code.

@mildred
mildred / nurea.md
Last active April 27, 2017 13:16
Le livre de Nuréa – Les chroniques du Ǧírkù 0

Dans ce livre, nous suivons le peuple Mušidim dont nous allons ici tenter de tracer la chronologie.

Depuis les premiers temps, les Mušidim sont confronts aux Kingalàm qui sont leur ennemi juré. Nous verrons plus loin leur filiation que Šuhia va découvrir. Pour leur échapper, les Mušidim, au cours de leur voyages spaciaux, créent des trous noir en détruisant des étoiles, sans se rendre compte de la gravité de cette action. Ces trois noir leur permettaient de créer des failles dans l'espace-temps leur permettant de rejoindre un autre lieu et un autre temps et d'échapper a leurs adversaires.

(p105) Il est arrivé une fois qu'ils échouent dans la nébuleuse d'Orion et provoqua une réaction en chaîne imprévisible d'effondrement. Afin d'investiguer le problème, la reine Pištéš et son roi Éa'am décidèrent de créer la mission Zid afin de découvrir les répercussions de ce phénomène, et de découvrir également la vérité sur les Kingalàm. Ils embarquèrent dans un vaisseau capable de voyager dans le temps. Ils laissairent

@mildred
mildred / README.md
Last active March 22, 2017 15:08
Raspberry as a 4G router

Hardware

Huawei E3372 HiLink connected on a raspberry running ArchLinux that acts as a bridge.

       ,=======(tunnel for 192.168.8.x)======.
       |       (VLAN or GRE)                 |
       v                                     v
[Home Router] ------- [Raspberry] ----- [LTE Router ]

[192.168.1.x] [192.168.8.x]

@mildred
mildred / routing.patch
Created February 22, 2017 11:27
routing.patch
diff --git a/src/gx/ipfs/QmRG9fdibExi5DFy8kzyxF76jvZVUb2mQBUSMNP1YaYn9M/go-libp2p-kad-dht/routing.go b/src/gx/ipfs/QmRG9fdibExi5DFy8kzyxF76jvZVUb2mQBUSMNP1YaYn9M/go-libp2p-kad-dht/routing.go
index 4f2be3a..9f3e59e 100644
--- a/src/gx/ipfs/QmRG9fdibExi5DFy8kzyxF76jvZVUb2mQBUSMNP1YaYn9M/go-libp2p-kad-dht/routing.go
+++ b/src/gx/ipfs/QmRG9fdibExi5DFy8kzyxF76jvZVUb2mQBUSMNP1YaYn9M/go-libp2p-kad-dht/routing.go
@@ -143,8 +143,51 @@ func (dht *IpfsDHT) GetValue(ctx context.Context, key string) ([]byte, error) {
}
func (dht *IpfsDHT) GetValues(ctx context.Context, key string, nvals int) ([]routing.RecvdVal, error) {
+ var resChan chan *routing.RecvdVal = make(chan *routing.RecvdVal, 0)
+ var errChan chan error = make(chan error, 0)
@mildred
mildred / terraform.tfstate
Last active February 2, 2017 09:06
Terraform issue #11518
{
"version": 3,
"terraform_version": "0.8.5",
"serial": 2,
"lineage": "a6fcb1cc-d67d-425c-8428-8f8a62de4862",
"modules": [
{
"path": [
"root"
],
@mildred
mildred / index.md
Created December 28, 2016 09:30
Programming good practices

Inspired by the golang language, especially its interfaces that allows decoupling without introducing dependencies.

First, some guidelines that shows the direction to take but with no hard rules:

  • Separate private imports from public imports. Private imports are only needed for the implementation. Public imports are exposed to other modules and are visible to them because their types appear in public function signatures or public types.

  • In public module interface, avoid using types from other modules that are not completely abstracted as an interface type. Do not use pointer to struct defined elsewhere in your public function arguments. Except probably from platform types (*net.URL or *context.Context probably applies).

  • Use basic types with no object characteristics, no defined methods, in public module interfaces. Better to rely on value to be a good exchange format than on complex objects that return objects and objects. This simplifies code and ensures that there is no side effects. Data layou

<html>
<head>
<meta charset="utf-8"/>
<script src="citojs/dist/cito.js"></script>
<script>
window.addEventListener('load', function(){
var items = [
{tag: 'li', children: 'text'}
];
@mildred
mildred / aliases.sh
Created June 13, 2016 13:37
ccut, ccopy, cpaste command line
chelp() {
echo "chelp - this help" >&2
echo "ccopy FILE... - copy these files to the cclipboard" >&2
echo "ccut FILE... - move these files to a temp dir and put them in the cclipboard" >&2
echo "cpaste [-c] - copy the files in the cclipboard in the current directory" >&2
echo "cmove - moves the files in the cclipboard in the current directory" >&2
echo "clist - list the files in the cclipboard" >&2
echo "cclear - clear the cclipboard and remove temporary files" >&2
}
ccopy() { sed 's:^: :' ~/.cache/cclist >&2; for i in "$@"; do echo "$PWD/$i" >> ~/.cache/cclist; echo "+ $PWD/$i">&2; done }
@mildred
mildred / Théorie du Genre et Transsexualité.md
Last active May 10, 2016 06:28
Théorie du Genre et Transsexualité

Théorie du Genre et Transsexualité

Mildred, 1er Février 2014, 9 mai 2016

Qu'est-ce que la transsexualité ? Quel rapport avec la théorie du genre ? Comment les deux vont-ils ou ne vont-ils pas ensemble ? Je vous propose une petite exploration, fruit de mon expérience personnelle.

Définitions