Skip to content

Instantly share code, notes, and snippets.

View KurtJacobson's full-sized avatar

Kurt Jacobson KurtJacobson

View GitHub Profile
@KurtJacobson
KurtJacobson / halunits.py
Last active May 10, 2017 17:36
Userspace HAL component for LinuxCNC that creates two HAL pins indicating the current G20/G21 state
#!/usr/bin/python
# Author: Kurt Jacobson
# Date: 04/15/17
# Email: kurtcjacobson@gmail.com
# License: GPL
# DESCRIPTION
# Userspace HAL component for LinuxCNC that creates two HAL pins
# indicating the current G20/G21 state
<?xml version="1.0" encoding="UTF-8"?>
<style-scheme id="kcj" _name="KCJ" version="1.0">
<author>Kurt Jacobson</author>
<_description></_description>
<!-- COLORS -->
<color name="comment_color" value="#608b4e"/>
<color name="number_color" value="#b5cea8"/>
<color name="string_color" value="#d69d62"/>
@KurtJacobson
KurtJacobson / grub
Created August 4, 2017 16:37
Auto boot Ubuntu with RTAI
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT="Previous Linux versions>Ubuntu, with Linux 3.4-9-rtai-686-pae"
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@KurtJacobson
KurtJacobson / move_widget.py
Created September 23, 2017 04:38
A simple example demonstrating how to move GTK+ widgets with the mouse.
#!/usr/bin/env python
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class MoveButton(Gtk.Fixed):
def __init__(self):
@KurtJacobson
KurtJacobson / UsefulCommands.md
Last active September 29, 2017 01:37
Random Useful Commands

git

Count number of lines in a git working tree
git diff --shortstat `git hash-object -t tree /dev/null`

Current branch name
git rev-parse --abbrev-ref HEAD

Gets current sort hash
git rev-parse --short HEAD

@KurtJacobson
KurtJacobson / colored_log.py
Last active September 29, 2017 12:23
Colored formatter for logging in python. Supports logging to a file without the escape sequences.
#!/usr/bin/env python
# Copyright (c) 2017 Kurt Jacobson
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import hal
import sys
import signal
import linuxcnc
import copy
import time
#define ENCODER_OPTIMIZE_INTERRUPTS
#include <Encoder.h>
#include <LedControl.h>
Encoder knob(0, 1);
LedControl lc = LedControl(12, 11, 10, 3);
int steps = 0;

Keybase proof

I hereby claim:

  • I am kurtjacobson on github.
  • I am kcj (https://keybase.io/kcj) on keybase.
  • I have a public key ASAPsvmYx17Ca74L-ooYbmOQrs14xHl7f9losSG6-kpNPgo

To claim this, I am signing this object: