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
<? | |
// generate a 1024 bit rsa private key, returns a php resource, save to file | |
$privateKey = openssl_pkey_new(array( | |
'private_key_bits' => 1024, | |
'private_key_type' => OPENSSL_KEYTYPE_RSA, | |
)); | |
openssl_pkey_export_to_file($privateKey, './keys/privatekey', $passphrase); | |
// get the public key $keyDetails['key'] from the private key; |
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
<? | |
$message="Test Message"; | |
//encrypt using publickey | |
$pubKey = openssl_pkey_get_public(file_get_contents('./keys/public')); | |
openssl_public_encrypt($message, $encryptedData, $pubKey); | |
//decrypt using privatekey | |
$privateKey = openssl_pkey_get_private(file_get_contents('./keys/private')); | |
openssl_private_decrypt($encryptedData, $decryptedData, $privateKey); | |
echo "Message : " . $message ."\n<br>\n"; | |
echo "Encrypted : " . $encryptedData ."\n<br>\n"; |
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
_grailsscripts() { | |
SCRIPT_DIRS="$GRAILS_HOME/scripts ./scripts ~/.grails/scripts" | |
if [ -d plugins ] | |
then for PLUGIN_DIR in $(ls -d plugins/*/scripts 2> /dev/null); do | |
SCRIPT_DIRS="$SCRIPT_DIRS $PLUGIN_DIR" | |
done | |
fi | |
for D in $SCRIPT_DIRS; do | |
if [ -d $D ] |
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 dash={ symbol , num -> symbol*num} | |
list= (1..20).toList() | |
5.times { | |
Collections.shuffle(list) | |
println list | |
} | |
println dash('-',35) |
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
/* | |
* To change this template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package javaapplication1; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.FileOutputStream; | |
import java.io.OutputStream; |
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
# Decrypt the given cyphertext using the Caesar cipher. Shift by the given | |
# shift value. | |
def encrypt(string, shift): | |
# for i in range('A', 'Z'): | |
for c in string: | |
print chr((((ord(c)-ord('a'))+shift)%26)+ord('a')), | |
def decrypt(ciphertext,shift): | |
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
########## BEGIN DESCRIPTION ############################################ | |
## | |
## Caeser Cipher Decryption. | |
## Write a function named decrytpion which accepts an encrypted English | |
## phrase - ciphertext - (parameter 1) and a shift value (parameter 2) | |
## and decrypts the phrase into plaintext. | |
## | |
## *See tests for examples of input and expected output* | |
## | |
########## END DESCRIPTION ############################################## |
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
import groovyx.net.http.RESTClient | |
import groovy.util.slurpersupport.GPathResult | |
import static groovyx.net.http.ContentType.* | |
def userName= 'user' | |
def passwd ='pass' | |
twitter = new RESTClient( 'https://twitter.com/statuses/' ) | |
twitter.auth.basic userName, passwd | |
def msg = "I'm using HTTPBuilder's RESTClient on ${new Date()}" | |
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
import groovyx.net.http.RESTClient | |
import groovy.util.slurpersupport.GPathResult | |
import static groovyx.net.http.ContentType.* | |
def userName= 'user' | |
def passwd ='pass' | |
twitter = new RESTClient( 'https://twitter.com/statuses/' ) | |
twitter.client.params.setBooleanParameter 'http.protocol.expect-continue', false | |
twitter.auth.basic userName, passwd | |
def msg = "I'm using HTTPBuilder's RESTClient on ${new Date()}" |
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
class AirportMapping{ | |
static constraints = { | |
name() | |
iata(maxSize:3) | |
state(maxSize:2) | |
lat() | |
lng() | |
} | |
static mapping = { |