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 'rubygems' | |
require 'cucumber/rake/task' | |
Cucumber::Rake::Task.new(:features) do |t| | |
t.cucumber_opts = "--format pretty" | |
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
Writing to Memory | |
Exploiting format string vulnerabilities is all about providing input that uses a format character that expects its value to be passed by reference and you control that reference. I used ‘%s’ to read from memory. I’m going to use %n to write to memory. | |
%n Number of characters written by this printf. | |
Lucky for us, there is a really easy way to control the number of characters written by printf. When you specify a format character, you can optionally give it an integer for the width of the format character. | |
%#x Number of characters prepended as padding. | |
We can use this to control how many characters are written by printf. |
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 sqrt(x: Double): Double = sqrtIter(1.0, x) | |
def sqrtIter(guess: Double, x: Double): Double = | |
if (isGoodEnough(guess, x)) guess | |
else sqrtIter(improve(guess, x), x) | |
def improve(guess: Double, x: Double) = | |
(guess + x / guess) / 2 | |
def isGoodEnough(guess: Double, x: Double) = | |
abs(square(guess) - x) < 0.001 |
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
Query Table with Excel as Data Source | |
Query tables can be of great help if you need to extract particular data from a data source | |
It represents a worksheet table built from data returned from an external data source, such as an SQL server or a Microsoft Access database. The QueryTable object is a member of the QueryTables collection | |
However, it need to be SQL server or a Microsoft Access database always. You can use CSV file or our fellow Microsoft Excel spreadsheet as a data source for QueryTable | |
Here is one such example, which extracts data from MS Excel sheet | |
Use the Add method to create a new query table and add it to the QueryTables collection. |
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
# MacPorts | |
export PATH=/opt/local/bin:/opt/local/sbin:$PATH | |
export MANPATH=/opt/local/share/man:$MANPATH | |
# Terminal colours (after installing GNU coreutils) | |
NM="\[\033[0;38m\]" #means no background and white lines | |
HI="\[\033[0;37m\]" #change this for letter colors | |
HII="\[\033[0;31m\]" #change this for letter colors | |
SI="\[\033[0;33m\]" #this is for the current directory | |
IN="\[\033[0m\]" |
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
# MacPorts | |
export PATH=/opt/local/bin:/opt/local/sbin:$PATH | |
export MANPATH=/opt/local/share/man:$MANPATH | |
# Terminal colours (after installing GNU coreutils) | |
NM="\[\033[0;38m\]" #means no background and white lines | |
HI="\[\033[0;37m\]" #change this for letter colors | |
HII="\[\033[0;31m\]" #change this for letter colors | |
SI="\[\033[0;33m\]" #this is for the current directory | |
IN="\[\033[0m\]" |
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
#!/usr/bin/perl | |
use Crypt::Eksblowfish::Bcrypt; | |
use Crypt::Random; | |
$password = 'bigtest'; | |
$encrypted = encrypt_password($password); | |
print "$password is encrypted as $encrypted\n"; | |
print "Yes the password is $password\n" if check_password($password, $encrypted); | |
print "No the password is not smalltest\n" if !check_password('smalltest', $encrypted); |
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 System.Xml; | |
using System.IO; | |
using System.Collections.Generic; | |
using System.Web.UI; | |
using System; | |
using System.Linq; | |
using System.Text; | |
using System.Web; | |
using System.Web.Configuration; | |
using System.Web.UI.WebControls; |
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
$ ghci -XTemplateHaskell | |
Prelude> :m +Language.Haskell.TH | |
Prelude Language.Haskell.TH> runQ [| let x = 5 in x * x |] | |
LetE [ValD (VarP x_0) (NormalB (LitE (IntegerL 5))) []] (InfixE (Just (VarE x_0)) (VarE GHC.Num.*) (Just (VarE x_0))) | |
Prelude Language.Haskell.TH> $(runQ [| let x = 5 in x * x |]) | |
25 |
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
package com.exercise.AndroidPaint; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.graphics.Canvas; | |
import android.os.Bundle; | |
import android.view.View; |