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 'rubygems' | |
require 'nokogiri' | |
require 'fileutils' | |
require 'date' | |
require 'uri' | |
# usage: ruby import.rb my-blog.xml | |
# my-blog.xml is a file from Settings -> Basic -> Export in blogger. | |
data = File.read ARGV[0] |
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
#!/usr/bin/env ruby | |
# | |
# Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156) | |
# | |
# ## Advisory | |
# | |
# https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion | |
# | |
# ## Caveats | |
# |
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
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
module Player | |
describe MovieList, "with optional description" do | |
it "is pending example, so that you can write ones quickly" | |
it "is already working example that we want to suspend from failing temporarily" do | |
pending("working on another feature that temporarily breaks this one") |
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
module Models | |
module Connections | |
extend ActiveSupport::Concern | |
included do | |
class_attribute :using_database, :_database_config | |
end | |
module ClassMethods |
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
// scala -P:continuations:enable cont.scala | |
import scala.util.continuations.{reset,shift,cpsParam} | |
def saveCont[A,B](resetFun : (Unit => A @cpsParam[B,Unit] ) => B @cpsParam[B,Unit]) : A => B = { | |
var cc : A => B = null; | |
val switchFun : (Unit => A @cpsParam[B,Unit] )= Unit => { | |
shift{ k : (A => B) => | |
cc = k | |
} | |
} |
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
#include <X11/Xlib.h> | |
void move(int dx, int dy) { | |
Display* d; | |
d = XOpenDisplay(0); | |
XWarpPointer(d,0,0,0,0,0,0,dx,dy); | |
XCloseDisplay(d); | |
} | |
int main(void) { |
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
#!/usr/bin/perl -w | |
use strict; | |
use Benchmark; | |
my $h = { map { $_, $_ } 1..10000 }; | |
timethese( 1000, { | |
each => sub{ my $i = 0; while( my ($k, $v) = each %$h ) { $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
<?xml version="1.0" encoding="UTF-8"?> | |
<items> | |
<item> | |
<TmpId>1</TmpId> | |
<Id>123</Id> | |
</item> | |
<item> | |
<TmpId>1</TmpId> | |
<Id>124</Id> | |
</item> |
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
#!/usr/bin/perl -w | |
use strict; | |
use AnyEvent::HTTP; | |
use Time::HiRes qw/time/; | |
use constant LOGGER_INTERVAL => 1; | |
use constant USAGE => "$0 [requests_count] [threads_count] [url]\n"; | |
my ( $max_requests, $max_threads, $url ) = @ARGV; | |
die USAGE unless $max_requests && $max_threads && $url; |
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
Element.addMethods({ | |
png_fix: function(el) { | |
var el = $(el); | |
var pos = navigator.userAgent.indexOf("MSIE "); | |
if (!(Prototype.Browser.IE && el.match('img') && el.src.include('png')) || pos == -1 ) return el; | |
var version = navigator.userAgent.substring(pos + 5); | |
if (! (((version.indexOf("5.5") == 0) || (version.indexOf("6") == 0)) && (navigator.platform == ("Win32"))) ) return el; |
NewerOlder