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
| def name(n): | |
| onesteens = ['one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen'] | |
| tens = ['twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety'] | |
| if n < 20: | |
| return onesteens[n-1] | |
| if n > 19 and n < 100: | |
| dm = divmod(n,10) |
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
| program test1 | |
| integer :: a,b,c | |
| do a=1,1000 | |
| do b=a+1,1000 | |
| do c=b+1,1000 | |
| if(a*a+b*b==c*c) then | |
| if (a+b+c==1000) then | |
| write(*,*) a,b,c | |
| stop |
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 <stdio.h> | |
| int main(){ | |
| int a,b,c; | |
| for (a=0;a<10000;a++){ | |
| for(b=a+1;b<10000;b++){ | |
| for(c=b+1;c<10000;c++){ | |
| if (a*a+b*b==c*c){ | |
| if (a+b+c==1000){ |
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
| # -*- coding: utf-8 -*- | |
| class Base256 | |
| def initialize | |
| @list = [['aardvark','adroitness'],['absurd','adviser'],['accrue','aftermath'],['acme','aggregate'],['adrift','alkali'],['adult','almighty'],['afflict','amulet'],['ahead','amusement'],['aimless','antenna'],['Algol','applicant'],['allow','Apollo'],['alone','armistice'],['ammo','article'],['ancient','asteroid'],['apple','Atlantic'],['artist','atmosphere'],['assume','autopsy'],['Athens','Babylon'],['atlas','backwater'],['Aztec','barbecue'],['baboon','belowground'],['backfield','bifocals'],['backward','bodyguard'],['banjo','bookseller'],['beaming','borderline'],['bedlamp','bottomless'],['beehive','Bradbury'],['beeswax','bravado'],['befriend','Brazilian'],['Belfast','breakaway'],['berserk','Burlington'],['billiard','businessman'],['bison','butterfat'],['blackjack','Camelot'],['blockade','candidate'],['blowtorch','cannonball'],['bluebird','Capricorn'],['bombast','caravan'],['bookshelf','caretaker'],['brackish','celebrate'],['breadline','cellulose'],['br |
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
| # This doesnt handle padding or non ascii, but its a rough implementation based on the wikipedia description | |
| module RobBase64 | |
| def self.encodebyte(byte) | |
| case byte | |
| when 0..25 then (byte+65).chr | |
| when 26..51 then (byte-26+97).chr | |
| when 52..61 then (byte-4).chr | |
| when 62 then "+" | |
| when 63 then "/" |
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
| #!/bin/sh | |
| INBOX="/path/to/Maildir/cur" | |
| SPAM="/path/to/Maildir/.spam/cur" | |
| cd $INBOX | |
| for i in `find ./ -type f -mmin -2` | |
| do | |
| echo "Testing $i" | |
| if (cat $i | spamassassin | grep 'X-Spam-Flag..YES') | |
| then echo "$i is spam" | |
| mv $i $SPAM |
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
| # -*- coding: utf-8 -*- | |
| pairs = [["あ","a"], | |
| ["か","ka"], | |
| ["さ","sa"], | |
| ["た","ta"], | |
| ["な","na"], | |
| ["は","ha"], | |
| ["ま","ma"], | |
| ["や","ya"], |
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
| def lit(src) | |
| eval src.split("\n").delete_if { |l| l[0]!='>' }.map {|l| l[1,l.length] }.join("\n") | |
| end | |
| lit <<src | |
| This is a big wall of text with no Ruby code... | |
| Does this work? | |
| 1 1 + . | |
| I bet it didn't... maybe the following works: |
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 <stdio.h> | |
| #include <string.h> | |
| #include "mongoose.h" | |
| #include <chibi/eval.h> | |
| static void *callback(enum mg_event event, | |
| struct mg_connection *conn, | |
| const struct mg_request_info *request_info) { |
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
| # from: http://www.informit.com/articles/article.aspx?p=683059&seqNum=36 | |
| class String | |
| def levenshtein(other, ins=2, del=2, sub=1) | |
| # ins, del, sub are weighted costs | |
| return nil if self.nil? | |
| return nil if other.nil? | |
| dm = [] # distance matrix | |
| # Initialize first row values | |
| dm[0] = (0..self.length).collect { |i| i * ins } |