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
What I like about this way of doing this is that it takes advantage of Bash internals without external commands. | |
for i in *; do mv $i ${i//+/%2b}; done |
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
xmllint --format - | |
("-" for standard input) |
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 https://groups.google.com/d/msg/gnu.emacs.help/gr5lC8sPyks/SNx6JblcuvgJ: | |
sysctl -n hw.logicalcpu_max |
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
set guifont=Menlo\ Regular:h18 | |
set number | |
" configure expanding of tabs for various file types | |
au BufRead,BufNewFile *.py set expandtab | |
au BufRead,BufNewFile *.c set noexpandtab | |
au BufRead,BufNewFile *.h set noexpandtab | |
au BufRead,BufNewFile Makefile* set noexpandtab | |
" -------------------------------------------------------------------------------- |
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
Emscripten does not work with LLVM 3.3, which is provided with Fedora 19. | |
Download LLVM 3.2 and Clang from http://llvm.org/releases/. Copy the clang | |
source code into tools\clang, and run make (but not make install). | |
Set LLVM_ROOT='/home/yourname/Development/llvm-3.2.src/Release+Asserts/bin' in ~./emscripten. | |
sudo yum install nodejs - I found that chromium installed later versions | |
of the v8 package, which meant that nodejs would not install. So download | |
Node.js from http://nodejs.org/download/. |
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
/* most efficient way to print the last X lines of a file. | |
* | |
* it's done using my favourite system call - mmap(2). Instead of reading the file | |
* from start to finish and count newlines, the program maps the file into memory and | |
* scans it backwards from the end, counting newline characters as it goes. When it decided | |
* thet it found the beginning of the X line from the end (or reached the beginning of the file) | |
* it prints the entire block of lines in one call. | |
* | |
* Options to improve: | |
* 1. Use direct call to write(2) on file descriptor 1 instead of fwrite() |
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
#!/usr/local/bin/gawk -f | |
# Taken from http://stackoverflow.com/a/8949920/164137 | |
BEGIN { | |
FS="," | |
FPAT="([^,]+)|(\"[^\"]+\")" | |
} | |
{ |
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/sh | |
# Shell script to install your public key on a remote machine | |
# Takes the remote machine name as an argument. | |
# Obviously, the remote machine must accept password authentication, | |
# or one of the other keys in your ssh-agent, for this to work. | |
ID_FILE="${HOME}/.ssh/id_rsa.pub" | |
if [ "-i" = "$1" ]; then |
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 | |
spin='-\|/' | |
i=0 | |
ceol=`tput el` | |
while read filename | |
do | |
if [[ -f $filename ]] | |
then | |
i=$(( (i+1) % 4 )) |
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
boxes = Dir.glob("puppet/hiera/nodes/*.yaml").map {|f| YAML.load(File.read(f)) } | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
boxes.each do |attrs| | |
# Required attributes | |
boxname = attrs['box'] |
OlderNewer