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
# Tested with: | |
# xrandr --version | |
# xrandr program version 1.4.0 | |
# Server reports RandR version 1.4 | |
xrandr --primary HDMI2 |
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
find . -name ".git" | sed -re 's@\./(.*)/\.git@\1@g' |
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
From http://msdn.microsoft.com/en-us/library/ms684190%28VS.85%29.aspx | |
psexec -i -s -h %systemroot%\system32\cmd.exe | |
or | |
runas.exe /savecred /user:administrator %systemroot%\system32\cmd.exe | |
WhoAmI.exe | |
or | |
echo %userprofile% |
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
secedit /export /areas USER_RIGHTS /cfg OUTFILE.CFG | |
whoami /PRIV | |
scedit: http://technet.microsoft.com/en-us/library/bb490997.aspx | |
whoami: http://technet.microsoft.com/en-us/library/cc771299.aspx | |
Interesting: |
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
;; Took from postmodern's s-sql.lisp | |
(defun reduce-strings (list) | |
"Join adjacent strings in a list, leave other values intact." | |
(let ((accum ()) | |
(span "")) | |
(dolist (part list) | |
(cond ((stringp part) (setf span (concatenate 'string span part))) | |
(t (when (not (string= "" span)) | |
(push span accum) |
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
# Note: havn't tested it yet. | |
follow () { | |
cd "$(dirname "$(readlink -f "$1")")" | |
} | |
# Example: | |
# follow $(which sbcl) | |
# follow a_symlink | |
# follow ~ |
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 | |
# | |
# Not perfect, but does the job pretty well. | |
# | |
for file in `ls -1 *.wav` | |
do | |
outfile=`echo $file | /bin/sed 's/\(.*\)\..*/\1/'`.ulaw | |
echo "Converting $file to $outfile" | |
sox -V $file -r 8000 -c 1 -t ul $outfile |
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
# Note that sometimes, these escape sequences are in the prompt, | |
# resetting the title at every command. | |
set_terminal_title () { | |
echo -en "\033]0;$@\a" | |
} |
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 loadJS(src, retryP, delay) { | |
try { | |
var scriptTag = document.createElement('script'); | |
scriptTag.type = 'text/javascript'; | |
scriptTag.src = src; | |
var fail = function (event) { | |
console.error("Unable to load the script: '" + src + "'"); | |
if (retryP) { | |
window.setTimeout(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
# Disclaimer, not tested yet, I did the equivalent in vim. | |
# curl/wget this: https://moodle.polymtl.ca/pluginfile.php/69155/mod_folder/content/0/INF4420a%20intra%20A2014_version%20AAAA0001%20avec%20solution.pdf?forcedownload=1 | |
# Copy the text in it, from the 1st question to the last. | |
# Remove Q5 and Q6 because they didn't survived the Ctrl-C Ctrl-V. | |
# Then | |
# 1st regex 2nd regex 3rg regex 4th regex Buffer (not avail on all system) | |
sed -ir -e 's/(^[0-9]{0,2}\..*)/\n\1/g' -e 's/^[a-e]/\ [ ] \1/g' -e '/^INF/d' -e '/^Poly/d' <FILENAME> | sponge <FILENAME> | |
# -r on BSD (so OSX) is -E |