$ rails g model User
belongs_to
has_one
| require 'puppet' | |
| require 'pp' | |
| prefix="demo-puppet" | |
| Puppet[:modulepath]=File.join(prefix,"modules") | |
| Puppet[:manifestdir]=File.join(prefix,"manifests") | |
| Puppet[:manifest]=File.join(prefix,"manifests","roles","logger.pp") | |
| #Puppet[:manifest]=File.join(prefix,"manifests","site.pp") | |
| code="import '#{Puppet[:manifest]}'\n" |
| #!/usr/bin/ruby | |
| # | |
| # Moved to: https://github.com/uriel1998/volumerb | |
| # | |
| # This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 | |
| # Unported License. To view a copy of this license, visit | |
| # http://creativecommons.org/licenses/by-sa/3.0/. | |
| # | |
| # Forked/derived from original by Jasper Van der Jeugt (jaspervdj); |
| class String | |
| def to_bool | |
| return true if self == true || self =~ (/(true|t|yes|y|1)$/i) | |
| return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i) | |
| raise ArgumentError.new("invalid value for Boolean: \"#{self}\"") | |
| end | |
| end |
| /* Random MAC address generator. | |
| Orignal code written by http://www.hypervivid.com/. | |
| Code modified by Jeffrey Leung e-mail: [email protected]. | |
| This software is distrubited under the GNU/GPL open source licensce. | |
| Please note: This software comes in "AS-IS" basis, therefore there is no | |
| guarantee in this program's proper function. | |
| Any modifications are welcome. | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
| #!/usr/bin/env perl | |
| # | |
| # A simple script to repeatedly check on-call status for United States | |
| # District Court juror instructions. It will send mail with any instructions | |
| # and, if necessary, schedule itself to check again when instructed. | |
| # | |
| # Usage: /path/to/jury-mojo.pl PARTICIPANT_ID ZIP_CODE | |
| use 5.012; | |
| use Mojo::UserAgent; |
| (Continued from part 1: https://gist.github.com/2905683) | |
| In this 2nd try, | |
| I had monitored git folder while run these following commands: | |
| C:\git\test> git status | |
| C:\git\test> git branch b1 | |
| C:\git\test> git checkout b1 | |
| C:\git\test> git add readme.txt | |
| C:\git\test> git commit -m "readme" |
| # (create oauth2 tokens from Google Console) | |
| client_id = "" | |
| client_secret = "" | |
| # (paste the scope of the service you want here) | |
| # e.g.: https://www.googleapis.com/auth/gan | |
| scope = "" | |
| """ | |
| Two things are wrong with Django's default `SECRET_KEY` system: | |
| 1. It is not random but pseudo-random | |
| 2. It saves and displays the SECRET_KEY in `settings.py` | |
| This snippet | |
| 1. uses `SystemRandom()` instead to generate a random key | |
| 2. saves a local `secret.txt` |