Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# Copyright (C) 2014 <Lajos Koszti>
# 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:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOF
#!/bin/bash
str=`grep -o "_t_('[a-z0-9_.]\+" $1 | head -n 1 | cut -c6-500 | rev | cut -d. -f2- | rev`
shift
echo "$str.$@" | sed -e 's/ /./g'
#!/bin/sh
# /etc/acpi/thinkpadbrightness.sh
#
# Script to change brightness of a ThinkPad t540p
#
# put this to /etc/acpi/events/thinkpad-brightness-down
#
# event=video/brightnessdown BRTDN 00000087 00000000
# action=/etc/acpi/thinkpadbrightness.sh down
#!/bin/sh
# IN=LVDS-0;
IN=eDP1
LASTDISPLAY=$IN
setoff() {
for display in `xrandr | awk '/ disconnected/ {print $1}'`; do
echo "maybe disabling $display";
inoremap { {}<Left>
inoremap ( ()<Left>
inoremap [ []<Left>
augroup myMacros
" iab locatoin location
" iab locatoins locations
" iab Locatoins Locations
" iab Locatoin Location
" iab locaiton location
#!/bin/sh
SINK_IDS=$(pactl list sinks short | awk '/RUNNING|IDLE|SUSPENDED/ {print $2}')
for id in $SINK_IDS;do
case $1 in
"mute")
pactl set-sink-mute $id toggle
;;
"down")
@Ajnasz
Ajnasz / hup-comment-expand.js
Last active August 29, 2015 14:12
expands comments on click
var comments = document.querySelector('#comments');
function findParentComment(elem) {
while (elem && elem.parentNode) {
if (elem.classList.contains('comment')) {
return elem;
}
elem = elem.parentNode;
}
@Ajnasz
Ajnasz / storage-check.sh
Created February 9, 2015 19:02
Remount nfs storage
#!/bin/sh
# Remount nfs storage
ls /storage > /dev/null
if [ "$?" -ne "0" ]; then
echo "Error listing /storage" 1>&2
umount /storage
mount /storage
@Ajnasz
Ajnasz / gist:318378
Created March 1, 2010 13:46
YUI 2 toggleClass
YAHOO.util.Dom.toggleClass = function(el, cn) {
return YAHOO.util.Dom.hasClass(el, cn) ? YAHOO.util.Dom.removeClass(el, cn) : YAHOO.util.Dom.addClass(el, cn);
};
YAHOO.util.Element.prototype.toggleClass = function(cn) {
return YAHOO.util.Dom.toggleClass(this.get('element'), cn);
};
YAHOO.util.Dom.toggleClass('elementid', 'hidden');
// or
@Ajnasz
Ajnasz / gist:435666
Created June 12, 2010 12:01
hide google reader watcher statusbar icon with stylish
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul); /* you should not put this line into the userchrome.css if you already have it */
#GRW-statusbar {
display:none;
}