Skip to content

Instantly share code, notes, and snippets.

// see:
// http://stamm-wilbrandt.de/GraphvizFiddle/
// http://graphviz-dev.appspot.com/
digraph g{
OFF [label="OFF", style="filled", shape=doublecircle];
ON [label="ON", fillcolor="palegreen", style="filled" shape=doublecircle];
error [label="error", fillcolor="red", style="filled" shape=doublecircle];
OFF -> fw_start [label="start"];
@ivanalejandro0
ivanalejandro0 / leap-docker.sh
Last active August 29, 2015 14:10
Firts attempt to run the LEAP platform on a single docker container.
#!/bin/bash
# Following instructions from: https://leap.se/en/docs/platform/tutorials/single-node
# Docker command line:
# docker run -it --name leap -h node1 -v ~/tmp/:/shared debian:wheezy /bin/bash
set -e # Exit immediately if a command exits with a non-zero status.
set -x # show commands
# Prepare your environment
@ivanalejandro0
ivanalejandro0 / apt-bitmask.sh
Last active April 22, 2018 17:35
Automated script to install the bitmask debian package on any of the supported platforms.
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
distro(){
# for ubuntu/mint:
name=`lsb_release -a 2>&1 | grep Codename | cut -f2`
# for debian:
[[ -z $name ]] && name=`grep -oP "VERSION=.*\(\K\w+" /etc/os-release`
@ivanalejandro0
ivanalejandro0 / repo-versions.sh
Created January 26, 2015 18:02
LEAP helper to install the needed repositories for https://bitmask.net using specific versions.
#!/bin/bash
######################################################################
# repo-versions.sh
# Copyright (C) 2014 LEAP
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@ivanalejandro0
ivanalejandro0 / env.cpp
Last active August 29, 2015 14:20
Environment variable tests using python c-api.
#include <Python.h>
#include <iostream>
#include <cstdlib>
// compile with:
// g++ -o env env.cpp -O2 -Wall -Wno-long-long -pedantic -pthread $(pkg-config --cflags --libs python2)
void show_paths() {
std::string env_path;
@ivanalejandro0
ivanalejandro0 / update-kernel.sh
Created June 25, 2015 22:17
Linux kernel updater, tested on ubuntu/mint.
#!/bin/bash
# Inspired on:
# http://www.yourownlinux.com/2014/10/how-to-install-linux-kernel-3-17-stable-in-linux.html
# http://www.yourownlinux.com/2015/06/how-to-install-linux-kernel-4-1-0-in-linux.html
set -euo pipefail
IFS=$'\n\t'
# NOTE: you need to set this variable to the desired kernel you want
VERSION="v4.1-unstable"
@ivanalejandro0
ivanalejandro0 / dealer-to-router.py
Created January 19, 2016 15:26
ROUTER-DEALER zmq tests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# DEALER to ROUTER (N->1)
# this can be used for many client to use a central worker
import pprint
import random
import time
import uuid
@ivanalejandro0
ivanalejandro0 / example.py
Last active July 5, 2021 03:04
PyQt5 & ZMQ integration
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import signal
import sys
import uuid
import zmq
from PyQt5.QtWidgets import QApplication, QWidget
@ivanalejandro0
ivanalejandro0 / index.js
Last active April 22, 2016 20:35
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
var deepEqual = require('deep-equal');
function log(data) {
data = data || '';
document.getElementById('result').innerHTML += data + '<br>';
}
@ivanalejandro0
ivanalejandro0 / swapon.service
Created July 5, 2016 22:56
Swap service for CoreOS
# /etc/systemd/system/swapon.service
# from: https://www.matthowlett.com/notes/2015/08/01/coreos-swap.html
# sudo systemctl enable swapon.service
# restart
# or
# sudo systemctl start swapon
[Unit]
Description=Turn on swap
[Service]