This file contains hidden or 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 'date' | |
| t = Time.now | |
| endDate = Date.new(t.year, t.month, t.day) | |
| startDate = Date.new(2011, 11, 22) | |
| days = endDate - startDate | |
| puts days.to_i |
This file contains hidden or 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
| # stolen from http://invert.svbtle.com/using-vim-as-a-password-manager | |
| import random | |
| f = open('/usr/share/dict/words') | |
| words = map(lambda x: x.strip(), f.readlines()) | |
| password = '-'.join(random.choice(words) for i in range(2)).capitalize() | |
| password += str(random.randint(1, 9999)) | |
| print password |
This file contains hidden or 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
| # Manually secure port 6379 | |
| sudo iptables -A INPUT -p tcp --dport 6379 -s xxx.xxx.xxx.xxx -j ACCEPT | |
| sudo iptables -A INPUT -p tcp --dport 6379 -j DROP | |
| sudo iptables -L | |
| # Save current firewall config | |
| sudo iptables-save > /etc/iptables.conf | |
| # Load iptables.conf on startup | |
| sudo nano /etc/rc.local |
This file contains hidden or 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
| # Wait for it | |
| `hostname` | |
| Done. |
This file contains hidden or 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
| # Credit / Stolen from http://natelandau.com/how-to-notify-services-when-post-jekyll/ | |
| # Ping Pingomatic | |
| desc 'Ping pingomatic' | |
| task :pingomatic do | |
| begin | |
| require 'xmlrpc/client' | |
| puts '* Pinging ping-o-matic' | |
| XMLRPC::Client.new('rpc.pingomatic.com', '/').call('weblogUpdates.extendedPing', 'YOURSITE.com' , 'http://YOURSITE.com', 'http://YOURSITE.com/atom.xml') | |
| rescue LoadError |
This file contains hidden or 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
| <?php | |
| return array ( | |
| '(UTC-11:00) Midway Island' => 'Pacific/Midway', | |
| '(UTC-11:00) Samoa' => 'Pacific/Samoa', | |
| '(UTC-10:00) Hawaii' => 'Pacific/Honolulu', | |
| '(UTC-09:00) Alaska' => 'US/Alaska', | |
| '(UTC-08:00) Pacific Time (US & Canada)' => 'America/Los_Angeles', | |
| '(UTC-08:00) Tijuana' => 'America/Tijuana', | |
| '(UTC-07:00) Arizona' => 'US/Arizona', |
This file contains hidden or 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
| SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" | |
| FROM information_schema.TABLES GROUP BY table_schema ; |
This file contains hidden or 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
| table { display: table } | |
| tr { display: table-row } | |
| thead { display: table-header-group } | |
| tbody { display: table-row-group } | |
| tfoot { display: table-footer-group } | |
| col { display: table-column } | |
| colgroup { display: table-column-group } | |
| td, th { display: table-cell } | |
| caption { display: table-caption } |
This file contains hidden or 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
| # Block Facebook IPv4 | |
| 127.0.0.1 www.facebook.com | |
| 127.0.0.1 facebook.com | |
| 127.0.0.1 login.facebook.com | |
| 127.0.0.1 www.login.facebook.com | |
| 127.0.0.1 fbcdn.net | |
| 127.0.0.1 www.fbcdn.net | |
| 127.0.0.1 fbcdn.com | |
| 127.0.0.1 www.fbcdn.com | |
| 127.0.0.1 static.ak.fbcdn.net |
This file contains hidden or 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
| <!-- The icons of the countries are provided by https://github.com/djaiss/mapsicon, available under a `do what you want with it` license. --> |