Skip to content

Instantly share code, notes, and snippets.

View robobenklein's full-sized avatar
:electron:
translating thoughts to code

Ben Klein robobenklein

:electron:
translating thoughts to code
View GitHub Profile
@robobenklein
robobenklein / d099a2ab-ff9f-43f3-b728-f7fc32827acb.desktop
Created September 3, 2017 21:36
Nautilus open terminator via right click, put this in `.local/share/file-manager/actions/`
[Desktop Entry]
Type=Action
TargetLocation=true
TargetContext=false
ToolbarLabel[en_US]=Terminator
ToolbarLabel[en]=Terminator
ToolbarLabel[C]=Terminator
Name[en_US]=Terminator
Name[en]=Terminator
Name[C]=Terminator
@robobenklein
robobenklein / Makefile
Last active January 29, 2018 03:55
CS140 Makefile
# CS140 makefile
# original by robobenklein / bklein3@utk
# GPLv3 license
# contact me if this breaks for some reason,
# but it's not my fault if you delete your programs using this
CC:=g++
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))

Keybase proof

I hereby claim:

  • I am robobenklein on github.
  • I am robobenklein (https://keybase.io/robobenklein) on keybase.
  • I have a public key ASABZwYqZ2MXHKEUy9PIrMb2fTyYEH2qP6WJ6YIudju9lwo

To claim this, I am signing this object:

@robobenklein
robobenklein / gpg-agent.sh
Created July 16, 2015 13:27
Shell script to switch between Gnome Keyring and the original GPG Agent for handling GPG keys.
echo "The Gnome Keyring's GPG protocol is not complete."
echo "Choose wether to use the Gnome Agent or the GPG agent to manage the keys."
echo "[help] for more information."
read -p "Should we use [gnome] keyring agent or [gpg] agent? : " action
case $action in
gnome ) sudo dpkg-divert --rename --remove /etc/xdg/autostart/gnome-keyring-gpg.desktop && echo "Gnome Keyring GPG agent ENABLED.";;
gpg ) sudo dpkg-divert --local --rename --divert /etc/xdg/autostart/gnome-keyring-gpg.desktop-disable --add /etc/xdg/autostart/gnome-keyring-gpg.desktop && echo "Gnome Keyring GPG agent DISABLED.";;
help ) echo "Some versions of Gnome Keyring hijack the connection to GPG Agent (they intercept all the communication between gpg or gpgsm and gpg-agent) by setting the GPG_AGENT_INFO environment variable to point to the Gnome Keyring process. Gnome Keyring then filters all communication with gpg-agent. See http://wiki.gnupg.org/GnomeKeyring for more info why.";;
esac
@robobenklein
robobenklein / java-version.sh
Created June 25, 2015 23:11
Easily Switch between Webupd8's Java 7 and Java 8 by shell script.
read -p "Which java version should we switch to? 7 or 8? : " action
case $action in
7 ) sudo update-java-alternatives -s java-7-oracle && echo "Switched to Java 7";;
8 ) sudo update-java-alternatives -s java-8-oracle && echo "Switched to Java 8";;
esac
@robobenklein
robobenklein / serialRead.py
Created March 5, 2015 18:32
This program reads serial input and logs it to file with timestamp.
# -*- coding: utf-8 -*-
'''
This program reads serial input from the 'sport' and logs it to file with timestamp.
It may not be the best code out there but it works for all my intents and purposes.
Credit to Tim and Ben Klein
This code is licensed under WFTPL, http://www.wtfpl.net/txt/copying/
Although it would still be nice to give some kind of credit ;)
# This requires the 'beep' command.
beep 658 125
beep 1320 500
beep 990 250
beep 1056 250
beep 1188 250
beep 1320 125
beep 1188 125
beep 1056 250
@robobenklein
robobenklein / softwarePhilosophy.txt
Created November 20, 2014 15:32
Robosane Software Philosophy
Robosane aims to provide software that not only "just works," but is enjoyable for both users and developers.
Our programs should never put users, computers, or anything else at risk, and never use coding tactics that make our code unnecessarily hard to understand.
Code can be published under any license, however Robosane encourages developers to Open Source their works.
@robobenklein
robobenklein / cookies.js
Last active August 29, 2015 14:09
Get and Set Cookies the easy way.
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {