This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatTime(e, mi) { | |
if (mi) { | |
e = (e / 1000).toFixed(0); | |
} | |
var sForm = ( e % 60 ), | |
hours = "", | |
minutes = ( (e-sForm) / 60 ), | |
seconds = sForm < 10 ? "0" + sForm : sForm; | |
if (minutes>60) { | |
hours = ( (minutes-(minutes%60)) / 60 ) + "."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# fixed the old one -- it was useless when pasting in to a terminal, echo ads a new line character | |
echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"|xargs echo -n | /usr/bin/xclip -selection clipboard | |
notify-send -t 2000 "Sökvägen är nu kopierad :)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Handles spaces in file, plus no trailing new line that 'cat file' would have added. | |
for arg | |
do | |
awk 'NR > 1 { print h } { h = $0 } END { ORS = ""; print h }' "$arg" | xclip -selection clipboard | |
done | |
notify-send -t 2000 "The content of the file was Copied :)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this to ~/.bashrc ( or any alias file you have specified to include ) | |
alias _rm='mv -f -t ~/.local/share/Trash/files' | |
# usage - can't say how many times this has savd my ass, rm is so easy to misuse. | |
$ _rm file.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Error free, [console] function shortcuts - First version | |
20110330 - http://elundmark.se/ | |
Minified version: http://dl.dropbox.com/u/1907097/elundmark-se-UserScripts/logger.min.js | |
Includes console.---: log, info, warn, error, assert, dir, time, timeEnd | |
Example: _log(myObject); _warn("one value"); | |
_error({ multiple:"values",foo:"bar" }); _assert(1<0); | |
*/ | |
var _C = console, // I only use console explicitly below for readbility | |
hasConsoleLog = typeof _C.log === "function", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lazy way to copy text to clipboard | |
copy () { echo "$1"|xargs echo -n | /usr/bin/xclip -selection clipboard ; } | |
# zip file/folder | |
zipf () { zip -r "$1".zip "$1" ; } | |
# make .tar.gz | |
tarf () { tar -cvzf "$1".tar.gz $1 ; } | |
# extract .tar.gz | |
xtarf () { tar xzvf "$1" -C "$2" ; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Paste into ~/.bash_aliases (Ubuntu) | |
copy_md5 () { echo -n $(md5sum $1 | cut -d ' ' -f 1) | /usr/bin/xclip -selection clipboard ; } | |
# Note that it doesn't add a new line, so it can be re-used inside the terminal right way. | |
# I made this Nautilus script as well, with a notification | |
#!/bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
STATUS=$(/etc/init.d/apache2 status) | |
if [[ $STATUS =~ "NOT" ]] ; then | |
ACTION="start" | |
else | |
ACTION="stop" | |
fi | |
if [ $ACTION = "start" ] | |
then | |
/etc/init.d/mysql start &&\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A local Pastbin alternative for Linux (supercheesy) | |
# This pastes your Clipboard to a set file "here Pastebin.txt" | |
# It does NOT Append, but instead it makes it easier to read and | |
# Prepends new text to the file. Built in protection if the script | |
# is already running so nothing gets overwritten. | |
# FTP UPLOAD: Uncomment the block further down and fill in the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copy and paste into the adress field */ | |
javascript:(function(){var trunk= function(s,l){return s.substr(0,l-1)+(s.length>l?'...':'');},a=window,b=document,s=a.getSelection?a.getSelection():b.getSelection?b.getSelection():b.selection.createRange().text,s=s?s:"",c=function(s){return encodeURIComponent(s);},d=a.open("http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+c(b.location)+"&annotation="+trunk(c(s),1100)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=420px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})(); | |
/* Beautified */ | |
(function() { | |
var trunk = function(s, l) { | |
return s.substr(0, l - 1) + (s.length > l ? '...' : ''); | |
}, |
OlderNewer