I've been trying to understand how to setup systems from
the ground up on Ubuntu. I just installed redis
onto
the box and here's how I did it and some things to look
out for.
To install:
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
Prereq:
apt-get install zsh
apt-get install git-core
Getting zsh to work in ubuntu is weird, since sh
does not understand the source
command. So, you do this to install zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key | |
# that enables you to choose a character from a menu of options. If you are on Lion | |
# try it by pressing and holding down 'e' in any app that uses the default NSTextField | |
# for input. | |
# | |
# It's a nice feature and continues the blending of Mac OS X and iOS features. However, | |
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode, | |
# as it means you cannot press and hold h/j/k/l to move through your file. You have | |
# to repeatedly press the keys to navigate. |
#/bin/bash | |
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password | |
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'` | |
if [ -z "$REPO_URL" ]; then | |
echo "-- ERROR: Could not identify Repo url." | |
echo " It is possible this repo is already using SSH instead of HTTPS." | |
exit | |
fi |
<html> | |
<body> | |
<!-- really dirty! this is just a test drive ;) --> | |
<script type="text/javascript" src="https://raw.github.com/mozilla/pdf.js/gh-pages/build/pdf.js"></script> | |
<script type="text/javascript"> | |
function renderPDF(url, canvasContainer, options) { | |
var options = options || { scale: 1 }; |
<?php | |
/** | |
* This function computes a hash of an integer. This can be used to not expose values to a customer, such as | |
* not giving them the id value for passing them to URLs. This algorithm is a bidirectional encryption (Feistel cipher) that maps | |
* the integer space onto itself. | |
* | |
* @link http://wiki.postgresql.org/wiki/Pseudo_encrypt Algorithm used | |
* @link http://en.wikipedia.org/wiki/Feistel_cipher Wikipedia page about Feistel ciphers | |
* @param int $value | |
* @return int |
#####Copied from askubuntu's Enabling mic mute button and light on Lenovo Thinkpad
There are two possible "hardware" indicators (to show that mute is on or off):
The Power button light (green) will blink to show when mute is on The Mic mute button light (orange) will be on or off to show mute status (just like in Windows)
Solution 2 requires a patched thinkpad_acpi
kernel module, and is only recommended for advanced users who know what they are doing. This is because the patch is not included by the thinkpad_acpi
developers by default, (See this discussion for more details).
###Common Steps
type Whatever struct { | |
someField int | |
} | |
func (w Whatever) MarshalJSON() ([]byte, error) { | |
return json.Marshal(struct{ | |
SomeField int `json:"some_field"` | |
}{ | |
SomeField: w.someField, | |
}) |