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
$Username = "su" | |
# Likely needs a capital letter, certain length and a number. | |
$Password = "TempPassword1" | |
$group = "Administrators" | |
$adsi = [ADSI]"WinNT://$env:COMPUTERNAME" | |
$existing = $adsi.Children | where {$_.SchemaClassName -eq 'user' -and $_.Name -eq $Username } |
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
def authorize!(role={}, object) | |
ability = Ability.new(current_user) | |
unless ability.can?(role, object) | |
unauthorized! | |
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
#!/bin/bash | |
# Initialize our own variables: | |
GROUP="default" | |
REGION="ap-northeast-1" | |
# Get our real public IP. | |
IP_ADDRESS=`curl ifconfig.me --silent` |
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 | |
# Initialize our own variables: | |
GROUP="default" | |
REGION="ap-northeast-1" | |
# Get our real public IP. | |
IP_ADDRESS=`curl ifconfig.me --silent` |
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
def artists(query) | |
results = search('artist', query) | |
artists = [] | |
results['artists'].each do |artist| | |
artists << Resources::Artist.new(artist) | |
end | |
Resources::Base.new(results['info'], artists) | |
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
require 'sinatra' | |
require 'net/http' | |
get '/' do | |
is_up = Net::HTTP.start('play.noobonicplague.com').head('/') | |
code = is_up.code | |
if code == '200' | |
"It's up!" | |
else |
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
... | |
rescue Trac::TracException | |
@retries_trac ||= 0 | |
@retries_trac += 1 | |
@logger.info("Trac isn't responding - Retry ##{@retries_trac}.") | |
retry if @retries_trac < 10 | |
.... |
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
def my_test | |
puts 'test1' | |
begin | |
puts 'test2' | |
raise Exception, 'Oh noes!' | |
rescue Exception | |
retry | |
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
Started POST "/users/sign_in" for 192.168.28.1 at 2013-07-11 13:39:35 -0700 | |
Processing by Devise::SessionsController#create as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"xodISf4lGqUE6JBs3plknQwFfkTF1MZwIMk8MBhAuGQ=", "user"=>{"username"=>"tjbiddle", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"} | |
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."username" = 'tjbiddle' LIMIT 1 | |
Completed 401 Unauthorized in 128ms | |
Processing by Devise::SessionsController#new as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"xodISf4lGqUE6JBs3plknQwFfkTF1MZwIMk8MBhAuGQ=", "user"=>{"username"=>"tjbiddle", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"} | |
Rendered devise/shared/_links.erb (0.8ms) | |
Rendered devise/sessions/new.html.erb within layouts/application (46.6ms) | |
Completed 200 OK in 259ms (Views: 249.4ms | ActiveRecord: 0.0ms) |
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
# Using friendly IDs to translate the name in the route to the ID. | |
project_name = params[:id].to_s | |
if Project.where('name like ?', project_name).empty? | |
@project = Project.new | |
@project.name = project_name | |
notify("info", "Project does not exist - Create one!") | |
return render :action => 'new' | |
else | |
@project = Project.where('name like ?', project_name).first |
NewerOlder