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 this to the rails console to test your email settings | |
class MyMailer < ActionMailer::Base | |
def test_email | |
@recipients = "[email protected]" | |
@from = "[email protected]" | |
@subject = "test from the Rails Console" | |
@body = "This is a test email" | |
end | |
end |
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
/* | |
* get screenshot PNG from web page | |
* | |
* build: | |
* FLAGS=`pkg-config --cflags --libs gtk+-x11-2.0 glib-2.0 webkit-1.0` | |
* gcc -Wall $FLAGS getscreenshot.c -o getscreenshot | |
* | |
* usage: | |
* /usr/bin/xvfb-run -s "-screen 0 1024x768x24" ./getscreenshot test.html | |
* |
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
/etc/hosts: | |
127.0.0.1 myhost jboss_server | |
NGINX: | |
server { | |
listen myhost:80; | |
server_name myhost; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; |
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
Class Main { | |
public void bfs() | |
{ | |
// BFS uses Queue data structure | |
Queue queue = new LinkedList(); | |
queue.add(this.rootNode); | |
printNode(this.rootNode); | |
rootNode.visited = true; | |
while(!queue.isEmpty()) { | |
Node node = (Node)queue.remove(); |
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
# RSpec's subject method, both implicitly and explicitly set, is useful for | |
# declaratively setting up the context of the object under test. If you provide a | |
# class for your describe block, subject will implicitly be set to a new instance | |
# of this class (with no arguments passed to the constructor). If you want | |
# something more complex done, such as setting arguments, you can use the | |
# explicit subject setter, which takes a block. | |
describe Person do | |
context "born 19 years ago" do | |
subject { Person.new(:birthdate => 19.years.ago } | |
it { should be_eligible_to_vote } |
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
# MySQL. Versions 4.1 and 5.0 are recommended. | |
# | |
# Install the MySQL driver: | |
# gem install mysql2 | |
# | |
# And be sure to use new-style password hashing: | |
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
development: | |
adapter: mysql2 | |
encoding: utf8 |
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
/* Tiny web server in Golang for sharing a folder | |
Copyright (c) 2010-2014 Alexis ROBERT <[email protected]> | |
Contains some code from Golang's http.ServeFile method, and | |
uses lighttpd's directory listing HTML template. */ | |
package main | |
import "net/http" | |
import "net/url" |
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
module System | |
extend self | |
def cpu_count | |
return Java::Java.lang.Runtime.getRuntime.availableProcessors if defined? Java::Java | |
return File.read('/proc/cpuinfo').scan(/^processor\s*:/).size if File.exist? '/proc/cpuinfo' | |
require 'win32ole' | |
WIN32OLE.connect("winmgmts://").ExecQuery("select * from Win32_ComputerSystem").NumberOfProcessors | |
rescue LoadError | |
Integer `sysctl -n hw.ncpu 2>/dev/null` rescue 1 | |
end |
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
<cluster-user>admin</cluster-user> | |
<cluster-password>mypassword</cluster-password> |
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
# app/config/deploy.rb | |
# Most of the changes specific to your environment will be set in | |
# the `app/config/deploy/[env].rb` files. | |
# define multiple deployments | |
set :stages, %w(production staging) | |
set :default_stage, "staging" |
OlderNewer