Skip to content

Instantly share code, notes, and snippets.

View npmman.sh
#!/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
View create_ulms_key.sh
#!/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'
View thinkpadbrightness.sh
#!/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
View 3display.sh
#!/bin/sh
# IN=LVDS-0;
IN=eDP1
LASTDISPLAY=$IN
setoff() {
for display in `xrandr | awk '/ disconnected/ {print $1}'`; do
echo "maybe disabling $display";
View abbrevations.vim
inoremap { {}<Left>
inoremap ( ()<Left>
inoremap [ []<Left>
augroup myMacros
" iab locatoin location
" iab locatoins locations
" iab Locatoins Locations
" iab Locatoin Location
" iab locaiton location
View volume.sh
#!/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 Aug 29, 2015
expands comments on click
View hup-comment-expand.js
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 Feb 9, 2015
Remount nfs storage
View storage-check.sh
#!/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 Mar 1, 2010
YUI 2 toggleClass
View gist:318378
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 Jun 12, 2010
hide google reader watcher statusbar icon with stylish
View gist:435666
@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;
}