Skip to content

Instantly share code, notes, and snippets.

View basilfx's full-sized avatar

Bas Stottelaar basilfx

View GitHub Profile
@basilfx
basilfx / README.md
Created March 29, 2015 08:58
Python 2/3 Autocomplete

Python 2/3 Autocomplete + history

Add autocomplete and history to your Python REPL. Saves history per interpreter/version file.

Installation

  • Create a ~/.python/ folder.
  • Move the autocomplete script in that folder.
  • Add export PYTHONSTARTUP=~/.python/autocomplete to your ~/.profile file.
  • Happy coding!

Known issues

@basilfx
basilfx / .profile
Last active May 31, 2023 08:36
Git add-then-commit confirmation
# Git commit protection
check_git() {
python ~/.shell/git-check-add.py $* && $GIT_BIN $*
}
GIT_BIN=`which git`
alias git=check_git
compdef check_git=git
@basilfx
basilfx / git-multi-status.py
Created July 8, 2015 09:24
Git Multi-Branch Status
#!/usr/bin/env python
import os
import sys
import subprocess
import multiprocessing
# List of folders to check status on
FOLDERS = [
# Put your project folders here -- absolute paths please.
@basilfx
basilfx / git-check-add.py
Last active August 29, 2015 14:24
Git Check Before Add
#!/usr/bin/env python
import sys
def main():
"""
Main entry point.
"""
if "commit -am" in " ".join(sys.argv).lower():
@basilfx
basilfx / FeatureContext.php
Created September 24, 2015 19:28
JavaScript errors in Behat 3 + Mink 2 + Selenium 2
<?php
use Behat\Behat\Hook\Scope\AfterStepScope;
use Behat\MinkExtension\Context\MinkContext;
class FeatureContext extends MinkContext
{
/**
* Grab the JavaScript errors from the session. Only works in companion
* with a global window variable `errors` that contains the JavaScript
@basilfx
basilfx / convert.py
Created November 16, 2015 21:07
Initialize EFM32 targets.
import shutil
import glob
import sys
import os
import re
# This file contains all templates for files
import templates
@basilfx
basilfx / README.md
Last active May 21, 2023 06:01
OctoPi to Read-only

OctoPi to Read-only

These steps will provide a read-only OctoPi installation while still having a read/write home directory. In other words, as long as you don't have to update system files, this installation will be fully functional.

  • Install OctoPi on a 8GB (or more) SD card and boot it at least once.
  • Mount it with a Linux machine (e.g. Ubuntu).
  • Use sudo gparted and configure the remaining space as EXT4.
  • There are now three partitions. Mount the last two.
  • Move /home/pi to the new and empty partition.
  • Edit /etc/fstab:
<?xml version="1.0" encoding="UTF-8"?><cdtprojectproperties>
<!-- Automatically generated from make eclipsesym -->
<!--
Instrucions:
In Eclipse:
1. Open the project properties, menu Project->Properties
2. Select C/C++ General->Paths and Symbols
2a. (optional) Click Restore Defaults to delete any existing macros and include paths
@basilfx
basilfx / em_rtcc_utils.h
Last active January 23, 2016 12:41
EFM32 Gemstone RTCC conversion macros
#ifndef __SILICON_LABS_EM_RTCC_UTILS_H__
#define __SILICON_LABS_EM_RTCC_UTILS_H__
#include "em_device.h"
#if defined( RTCC_COUNT ) && ( RTCC_COUNT == 1 )
#ifdef __cplusplus
extern "C" {
#endif
@basilfx
basilfx / install.sh
Created March 11, 2016 07:52
Eclipse with CDT + ARM plugin
#!/bin/bash
wget -O "/tmp/eclipse.tar.gz" "http://ftp.snt.utwente.nl/pub/software/eclipse//technology/epp/downloads/release/mars/2/eclipse-java-mars-2-linux-gtk-x86_64.tar.gz"
wget -O "/tmp/cdt-plugin.zip" "http://ftp.snt.utwente.nl/pub/software/eclipse//tools/cdt/releases/8.8.1/cdt-8.8.1.zip"
wget -O "/tmp/arm-plugin.zip" "https://github.com/gnuarmeclipse/plug-ins/releases/download/v2.11.3-201602101653/ilg.gnuarmeclipse.repository-2.11.3-201602101653.zip"
tar xvf "/tmp/eclipse.tar.gz" -C "/opt"
unzip "/tmp/cdt-plugin.zip" -d "/tmp/cdt-plugin"
unzip "/tmp/arm-plugin.zip" -d "/tmp/arm-plugin"