Skip to content

Instantly share code, notes, and snippets.

View jeremija's full-sized avatar

Jerko Steiner jeremija

View GitHub Profile
@jeremija
jeremija / charger-brightness.sh
Last active December 25, 2015 03:59
A script which automatically dims the brightness when the laptop is disconnected from charger or sets it to a maximum value if the charger is connected.
#!/bin/bash
# This script automatically dims the brightness when the laptop is disconnected
# from charger or sets it to maximum value if the charger is connected
#
# Usage: place a symbolic link to this file in /etc/pm/power.d/ directory.
# Tested with Xubuntu 13.04 (x64) running on Thinkpad X230.
#
# Author: www.github.com/jeremija
# function for logging. first argument should be the text to log
@jeremija
jeremija / gtkrc-eclipse
Created October 14, 2013 06:46
A .gtkrc-2.0 file for eclipse. Launch eclipse with GTK2_RC_FILES=`gtkrc-eclipse ./eclipse`.
gtk_color_scheme = "base_color:#f9f9f9\nbg_color:#dedede\ntooltip_bg_color:#eeeeee\nselected_bg_color:#d64937\ntext_color:#333333\nfg_color:#555555\ntooltip_fg_color:#2d2d2d\nselected_fg_color:#f9f9f9\nmenubar_bg_color:#2d2d2d\nmenubar_fg_color:#dcdcdc\ntoolbar_bg_color:#dedede\ntoolbar_fg_color:#555555\nmenu_bg_color:#2d2d2d\nmenu_fg_color:#dcdcdc\npanel_bg_color:#2d2d2d\npanel_fg_color:#dcdcdc\nlink_color:#fc6f5d"
style "tooltips" {
xthickness = 3
ythickness = 3
bg[NORMAL] = @tooltip_bg_color
bg[SELECTED] = @tooltip_bg_color
fg[NORMAL] = @tooltip_fg_color
@jeremija
jeremija / thinklight-led.sh
Last active December 26, 2015 08:09
Scripts for blinking of the power LED on a Thinkpad X230. You can use the `thinklight-led.sh "0 blink"` in any application which can execute a command on an event.
#!/bin/sh
#
# Place this file in /usr/local/bin folder.
# You might want to edit the /etc/sudoers file and add a line like this:
# $user ALL=NOPASSWD: /usr/local/bin/thinklight-led.sh
#
# Replace the $user variable with your username.
#
# author: www.github.com/jeremija
@jeremija
jeremija / caps-lock.sh
Created November 24, 2013 10:17
Caps lock state notification (xfce4 compatible)
#!/bin/sh
#state does not change immediately
sleep 0.2
#determine the state
STATE=`xset q | grep -oE "Caps Lock: *?(on|off)" | grep -oE "(on|off)"`
#send a notification
notify-send -i preferences-desktop-keyboard-shortcuts "Caps lock" "$STATE"
@jeremija
jeremija / gist:7729929
Created December 1, 2013 08:38
Recursive object traversal
function traverse(data) {
for (var objName in data) {
if (!data.hasOwnProperty(objName)) {
continue;
}
var obj = data[objName];
if (typeof obj === 'object') {
console.log('obj: ' + objName + ' = {}...');
this.traverse(obj);

Keybase proof

I hereby claim:

  • I am jeremija on github.
  • I am steiner (https://keybase.io/steiner) on keybase.
  • I have a public key whose fingerprint is 3839 4E6E 8C90 78C2 4F6A 221A DD8C 9510 EE19 F834

To claim this, I am signing this object:

@jeremija
jeremija / resize.sh
Created September 17, 2014 18:12
Resize with watermark
#!/bin/bash
# author jsteiner
#
# Resizes an image and adds a watermark. To customize which watermark is added,
# edit the $WATERMARK variable below.
#
DIR=`dirname "$BASH_SOURCE"`
WATERMARK="$DIR/watermark.png"
SRC="$1"
@jeremija
jeremija / log-test.js
Created September 23, 2014 21:47
AMD module for logging
define(['Squire'], function(Squire) {
'use strict';
var injector = new Squire();
var logArgs, warnArgs, errorArgs,
logThis, warnThis, errorThis;
var win = {
'Function': {
'prototype': {
// Usage:
//
// 1. Put this in the file that gets first loaded by RequireJS
// 2. Once the page has loaded, type window.rtree.map() in the console
// This will map all dependencies in the window.rtree.tree object
// 3. To generate UML call window.rtree.toUml(). The output can be used
// here: http://yuml.me/diagram/scruffy/class/draw
requirejs.onResourceLoad = function (context, map, depMaps) {
if (!window.rtree) {
window.rtree = {};
@jeremija
jeremija / auto-update-script.sh
Last active August 29, 2015 14:06
update applications on the server and restart the service without the prompts
#!/bin/bash
# Copies file to the server and restarts a service on the server. If you have uploaded
# your public ssh key to the server, you should be able to run this without any prompts.
#
# If your private ssh key is password protected, consider using ssh-add to avoid being
# prompted for password every time.
#
# author jsteiner
host=marsh