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 | |
RECIPIENT="your.email@address.here"; | |
PREFIX="LOGIN ALERT!"; | |
REMOTEIP=$(/bin/echo $SSH_CLIENT | /usr/bin/awk '{ print $1 }'); | |
TIME=$(/bin/date +'%r, %D'); | |
HOST=$(/bin/hostname -f); | |
if [[ "$REMOTEIP" == "" ]]; then | |
REMOTEIP='localhost'; | |
fi |
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
# put timestamps in my bash history | |
export HISTTIMEFORMAT='%F %T ' | |
# don't put duplicate commands into the history | |
export HISTCONTROL=ignoredups | |
# record only the most recent duplicated command (see above) | |
export HISTCONTROL=ignoreboth | |
# don't record these commands in the history; who cares about ls? |
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
# SSL self signed localhost for rails start to finish, no red warnings. | |
# 1) Create your private key (any password will do, we remove it below) | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
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
$ \curl -sSL https://get.rvm.io | bash -s stable | |
$ echo "source ~/.profile" >> ~/.bash_profile | |
$ echo "gem: —no-document" >> ~/.gemrc | |
$ rvm autolibs enable | |
$ rvm install ruby | |
$ gem install rails | |
$ rvm use 2.2 --default | |
# Update your RVM to the latest statble version. | |
rvm get latest | |
# Update your RVM to the most recent version. (most bug fixes) |
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
Redis Marshaling | |
If you have time consuming method in your app that you call frequently, chances are that you’d like to cache it. Redis is great key-value store that can be used for this purpose. However, redis only store string values. In order to store other kinds of objects, you’ll have to use marshaling. | |
There is a built-in ruby class called Marshal that does the job well. The only thing you have to do is to call Marshal.dump method and pass it an object. The exact opposite is the Marshal.load method. | |
I’ve created helper method for easier integration with Redis. Here is how it looks: | |
module RedisHelper |
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
http://redis.io/topics/admin | |
Redis Administration | |
This page contains topics related to the administration of Redis instances. Every topic is self contained in form of a FAQ. New topics will be created in the future. | |
Redis setup hints | |
We suggest deploying Redis using the Linux operating system. Redis is also tested heavily on OS X, and tested from time to time on FreeBSD and OpenBSD systems. However Linux is where we do all the major stress testing, and where most production deployments are working. | |
Make sure to set the Linux kernel overcommit memory setting to 1. Add vm.overcommit_memory = 1 to /etc/sysctl.conf and then reboot or run the command sysctl vm.overcommit_memory=1 for this to take effect immediately. | |
Make sure to disable Linux kernel feature transparent huge pages, it will affect greatly both memory usage and latency in a negative way. This is accomplished with the following command: echo never > sys/kernel/mm/transparent_hugepage/enabled. | |
Make sure to setup some swap in your syst |
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
### start_processing.action_controller | |
| Key | Value | | |
| ------------- | --------------------------------------------------------- | | |
| `:controller` | The controller name | | |
| `:action` | The action | | |
| `:params` | Hash of request parameters without any filtered parameter | | |
| `:format` | html/js/json/xml etc | | |
| `:method` | HTTP request verb | |
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
<% header "Content-Type" => "text/html" %> | |
<h1>Let's run some ruby code: <%= rand %></h1> |
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
{ | |
"vars": { | |
"@gray-base": "#000", | |
"@gray-darker": "lighten(@gray-base, 13.5%)", | |
"@gray-dark": "lighten(@gray-base, 20%)", | |
"@gray": "lighten(@gray-base, 33.5%)", | |
"@gray-light": "lighten(@gray-base, 46.7%)", | |
"@gray-lighter": "lighten(@gray-base, 93.5%)", | |
"@brand-primary": "darken(#428bca, 6.5%)", | |
"@brand-success": "#5cb85c", |
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
# run with Piece.xor_files 'output_filepath', ['infilepath1','infilepath2'] | |
require 'inline' | |
Class Piece | |
inline do |builder| | |
builder.include '<stdlib.h>' | |
builder.include '<stdio.h>' | |
builder.c_singleton <<-C_CODE | |
/* | |
rb_input_paths_array should be a ruby array of strings, |
OlderNewer