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
<%= link_to content_tag(:span, '', :class => "ui-icon ui-icon-folder-open"), yourname, :title => "Show", :class => "ui-state-default ui-corner-all", :id => "no-border" %> | |
<%= link_to content_tag(:span, '', :class => "ui-icon ui-icon-gear"), edit_yourname_path(yourname), :title => "Edit", :class => "ui-state-default ui-corner-all", :id => "no-border" %> | |
<%= link_to content_tag(:span, '', :class => "ui-icon ui-icon-trash"), yourname, :confirm => "Are you sure you?", :title => "Delete", :method => :delete, :class => "ui-state-default ui-corner-all", :id => "no-border" %> |
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 truncate_words(text, length, end_string = ' ...') | |
words = text.split() | |
words = words[0..(length-1)].join(' ') + (words.length > length ? end_string : '') | |
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
validate email: /\A([\w\.\-\+]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i | |
validate url: ^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/ix | |
validate ip: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i | |
validate ip ranges: /^\b(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-4]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9]?)\b$/i | |
validate netmask: /^(((128|192|224|240|248|252|254)\.0\.0\.0)|(255\.(0|128|192|224|240|248|252|254)\.0\.0)|(255\.255\.(0|128|192|224|240|248|252|254)\.0)|(255\.255\.255\.(0|128|192|224|240|248|252|254)))$/i |
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
example: | |
PRI = 191 | |
To get the Facility | |
Divide the PRI number by 8. | |
191/8 = 23.875 | |
The whole number part is the facility. | |
To get the Severity |
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
>> %w(lorem ipsum dolor sit).to_sentence | |
=> "lorem, ipsum, dolor, and sit" | |
>> %w(lorem ipsum dolor sit).to_sentence(:words_connector => ' + ') | |
=> "lorem + ipsum + dolor, and sit" | |
>> %w(lorem ipsum).to_sentence(:two_words_connector => ' through ') | |
=> "lorem through ipsum" | |
# No effect if more than two words |
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
// new account form | |
$(function() { | |
$('.account-edit-dialog-form').dialog({ autoOpen: false }) | |
$( ".account-edit-dialog-form" ).dialog({ | |
autoOpen: false, | |
height: 300, | |
width: 500, | |
modal: true, |
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
source "http://rubygems.org" | |
gem 'sinatra', '~> 1.3.2', :require => 'sinatra' | |
gem 'data_mapper', '~> 1.2.0' | |
gem 'dm-mongo-adapter', :git => 'https://github.com/solnic/dm-mongo-adapter.git', :branch => "dm-1.2-compatible" | |
gem 'bson_ext', '~> 1.4.0' | |
gem 'mongo', '~> 1.4.0' | |
gem 'mongodb', '~> 2.0.0' | |
gem 'dm-sqlite-adapter' | |
gem 'haml' |
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
from shodan import WebAPI | |
import re,socket | |
key = 'YOURKEYHERE' | |
filter = 'netcam' | |
def checkCam(ip): | |
try: | |
sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) | |
sock.settimeout(1.5) |
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
<?php | |
$sDataFile = 'guestbook.dat'; | |
$sLogFile = 'adminlog.dat'; | |
touch($sDataFile); | |
touch($sLogFile); | |
if (isset($_GET['logfile'])) show_logfile($sLogFile); |
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
<html><body><h1>1KB Forum</h1><?mysql_connect('localhost','username','********');mysql_select_db('d');extract($_REQUEST);$v=intval($v);$i=0;$q='mysql_query';$f='mysql_fetch_row';$n='mysql_num_rows';$x='<input type="';$s="SELECT*FROM";$t='CREATE TABLE IF NOT EXISTS t(i INT AUTO_INCREMENT,a INT,b TEXT,KEY(i))';$h='htmlspecialchars';$q($t);$q(str_replace('t','p',$t));$l=' ORDER BY';$o='';$u='INSERT INTO';$c="b)VALUES('";if($b){if(!$v)$q("$u t($c$e')");$v=max($v,mysql_insert_id());$q("$u p(a,$c$v','$b')");}if($v){$t=$q("$s p WHERE a=$v$l i");echo'<a href="f.php">Back</a>';for(;$i<$n($t);++$i){$r=$f($t);echo'<hr/>'.nl2br($h($r[2]));}}else{$t=$q("$s t$l-i");for(;$i<$n($t);++$i){$r=$f($t);echo'<a href="f.php?v='.$r[0].'">'.$h($r[2]).'</a><br/>';}$o='Title:'.$x.'text"name="e"/><br/>';}echo'<hr/>Post:<form action="f.php"method="post">'.$x.'hidden"name="v"value="'."$v\"/>$o<textarea name=\"b\"></textarea>$x";?>submit"name="w"value="Post"/></form></body></html> |
OlderNewer