Skip to content

Instantly share code, notes, and snippets.

@ivanalejandro0
ivanalejandro0 / .eslintrc.yaml
Last active January 31, 2018 23:24
My ESLint configuration for Reactjs
---
parser: babel-eslint
parserOptions:
ecmaVersion: 6
sourceType: "module"
ecmaFeatures:
jsx: true
plugins:
- react
env:
@ivanalejandro0
ivanalejandro0 / pre-commit
Last active January 18, 2017 20:10
ESLint check your code as a pre-commit hook
#!/bin/bash
# based on: https://gist.github.com/linhmtran168/2286aeafe747e78f53bf
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep "\.jsx\{0,1\}$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
# Escape code
esc=`echo -en "\033"`
@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]
@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 / 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 / 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 / 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 / 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 / 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 / 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`