code
stringlengths
1
46.1k
label
class label
1.18k classes
domain_label
class label
21 classes
index
stringlengths
4
5
(show . (+1) . read) "1234"
727Increment a numerical string
8haskell
5xhug
import java.io.BufferedReader; import java.io.FileReader; public class IbeforeE { public static void main(String[] args) { IbeforeE now=new IbeforeE(); String wordlist="unixdict.txt"; if(now.isPlausibleRule(wordlist)) System.out.println("Rule is plausible."); else System.out.println("Rule is not plausible."); } boolean isPlausibleRule(String filename) { int truecount=0,falsecount=0; try { BufferedReader br=new BufferedReader(new FileReader(filename)); String word; while((word=br.readLine())!=null) { if(isPlausibleWord(word)) truecount++; else if(isOppPlausibleWord(word)) falsecount++; } br.close(); } catch(Exception e) { System.out.println("Something went horribly wrong: "+e.getMessage()); } System.out.println("Plausible count: "+truecount); System.out.println("Implausible count: "+falsecount); if(truecount>2*falsecount) return true; return false; } boolean isPlausibleWord(String word) { if(!word.contains("c")&&word.contains("ie")) return true; else if(word.contains("cei")) return true; return false; } boolean isOppPlausibleWord(String word) { if(!word.contains("c")&&word.contains("ei")) return true; else if(word.contains("cie")) return true; return false; } }
728I before E except after C
9java
w68ej
import java.math.BigInteger; import java.util.*; public class IBAN { private static final String DEFSTRS = "" + "AL28 AD24 AT20 AZ28 BE16 BH22 BA20 BR29 BG22 " + "HR21 CY28 CZ24 DK18 DO28 EE20 FO18 FI18 FR27 GE22 DE22 GI23 " + "GL18 GT28 HU28 IS26 IE22 IL23 IT27 KZ20 KW30 LV21 LB28 LI21 " + "LT20 LU20 MK19 MT31 MR27 MU30 MC27 MD24 ME22 NL18 NO15 PK24 " + "PS29 PL28 PT25 RO24 SM27 SA24 RS22 SK24 SI19 ES24 SE24 CH21 " + "TN24 TR26 AE23 GB22 VG24 GR27 CR21"; private static final Map<String, Integer> DEFINITIONS = new HashMap<>(); static { for (String definition : DEFSTRS.split(" ")) DEFINITIONS.put(definition.substring(0, 2), Integer.parseInt(definition.substring(2))); } public static void main(String[] args) { String[] ibans = { "GB82 WEST 1234 5698 7654 32", "GB82 TEST 1234 5698 7654 32", "GB81 WEST 1234 5698 7654 32", "SA03 8000 0000 6080 1016 7519", "CH93 0076 2011 6238 5295 7", "XX00 0000", "", "DE", "DE13 _ 1234 1234 1234 12"}; for (String iban : ibans) System.out.printf("%s is%s.%n", iban, validateIBAN(iban) ? "valid" : "not valid"); } static boolean validateIBAN(String iban) { iban = iban.replaceAll("\\s", "").toUpperCase(Locale.ROOT); int len = iban.length(); if (len < 4 || !iban.matches("[0-9A-Z]+") || DEFINITIONS.getOrDefault(iban.substring(0, 2), 0) != len) return false; iban = iban.substring(4) + iban.substring(0, 4); StringBuilder sb = new StringBuilder(); for (int i = 0; i < len; i++) sb.append(Character.digit(iban.charAt(i), 36)); BigInteger bigInt = new BigInteger(sb.toString()); return bigInt.mod(BigInteger.valueOf(97)).intValue() == 1; } }
729IBAN
9java
knahm
def humble?(i) while i % 2 == 0; i /= 2 end while i % 3 == 0; i /= 3 end while i % 5 == 0; i /= 5 end while i % 7 == 0; i /= 7 end i == 1 end count, num = 0, 0 digits = 10 limit = 10 ** digits humble = Array.new(digits + 1, 0) while (num += 1) < limit if humble?(num) humble[num.to_s.size] += 1 print num, if count < 50 count += 1 end end print (1..digits).each { |num| printf(, humble[num], num) }
726Humble numbers
14ruby
r01gs
require 'file'
723Include a file
14ruby
r0wgs
mod test; fn main() { test::some_function(); }
723Include a file
15rust
78xrc
var ibanLen = { NO:15, BE:16, DK:18, FI:18, FO:18, GL:18, NL:18, MK:19, SI:19, AT:20, BA:20, EE:20, KZ:20, LT:20, LU:20, CR:21, CH:21, HR:21, LI:21, LV:21, BG:22, BH:22, DE:22, GB:22, GE:22, IE:22, ME:22, RS:22, AE:23, GI:23, IL:23, AD:24, CZ:24, ES:24, MD:24, PK:24, RO:24, SA:24, SE:24, SK:24, VG:24, TN:24, PT:25, IS:26, TR:26, FR:27, GR:27, IT:27, MC:27, MR:27, SM:27, AL:28, AZ:28, CY:28, DO:28, GT:28, HU:28, LB:28, PL:28, BR:29, PS:29, KW:30, MU:30, MT:31 } function isValid(iban) { iban = iban.replace(/\s/g, '') if (!iban.match(/^[\dA-Z]+$/)) return false var len = iban.length if (len != ibanLen[iban.substr(0,2)]) return false iban = iban.substr(4) + iban.substr(0,4) for (var s='', i=0; i<len; i+=1) s+=parseInt(iban.charAt(i),36) for (var m=s.substr(0,15)%97, s=s.substr(15); s; s=s.substr(13)) m=(m+s.substr(0,13))%97 return m == 1 } document.write(isValid('GB82 WEST 1234 5698 7654 32'), '<br>')
729IBAN
10javascript
e3sao
null
728I before E except after C
11kotlin
bdwkb
(load "filename")
723Include a file
16scala
kn0hk
my $i = 0; print ++$i, "\n" while 1;
714Integer sequence
2perl
d5jnw
null
728I before E except after C
1lua
pfxbw
String s = "12345"; s = String.valueOf(Integer.parseInt(s) + 1);
727Increment a numerical string
9java
9b5mu
let s = '9999'; let splusplus = (+s+1)+"" console.log([splusplus, typeof splusplus])
727Increment a numerical string
10javascript
uwjvb
null
729IBAN
11kotlin
gsh4d
null
727Increment a numerical string
11kotlin
zrcts
package main import ( "fmt" "log" ) func main() { var n1, n2 int fmt.Print("enter number: ") if _, err := fmt.Scan(&n1); err != nil { log.Fatal(err) } fmt.Print("enter number: ") if _, err := fmt.Scan(&n2); err != nil { log.Fatal(err) } switch { case n1 < n2: fmt.Println(n1, "less than", n2) case n1 == n2: fmt.Println(n1, "equal to", n2) case n1 > n2: fmt.Println(n1, "greater than", n2) } }
725Integer comparison
0go
pf0bg
local length= { AL=28, AD=24, AT=20, AZ=28, BH=22, BE=16, BA=20, BR=29, BG=22, CR=21, HR=21, CY=28, CZ=24, DK=18, DO=28, EE=20, FO=18, FI=18, FR=27, GE=22, DE=22, GI=23, GR=27, GL=18, GT=28, HU=28, IS=26, IE=22, IL=23, IT=27, JO=30, KZ=20, KW=30, LV=21, LB=28, LI=21, LT=20, LU=20, MK=19, MT=31, MR=27, MU=30, MC=27, MD=24, ME=22, NL=18, NO=15, PK=24, PS=29, PL=28, PT=25, QA=29, RO=24, SM=27, SA=24, RS=22, SK=24, SI=19, ES=24, SE=24, CH=21, TN=24, TR=26, AE=23, GB=22, VG=24 } function validate(iban) iban=iban:gsub("%s","") local l=length[iban:sub(1,2)] if not l or l~=#iban or iban:match("[^%d%u]") then return false
729IBAN
1lua
r0kga
i=1 while i: print(i) i += 1
714Integer sequence
3python
f4hde
def comparison = { a, b -> println "a? b = ${a}? ${b} = a ${a < b? '<': a > b? '>': a == b? '==': '?'} b" }
725Integer comparison
7groovy
78erz
z <- 0 repeat { print(z) z <- z + 1 }
714Integer sequence
13r
o2g84
myCompare :: Integer -> Integer -> String myCompare a b | a < b = "A is less than B" | a > b = "A is greater than B" | a == b = "A equals B" main = do a <- readLn b <- readLn putStrLn $ myCompare a b
725Integer comparison
8haskell
f4cd1
use warnings; use strict; sub result { my ($support, $against) = @_; my $ratio = sprintf '%.2f', $support / $against; my $result = $ratio >= 2; print "$support / $against = $ratio. ", 'NOT ' x !$result, "PLAUSIBLE\n"; return $result; } my @keys = qw(ei cei ie cie); my %count; while (<>) { for my $k (@keys) { $count{$k}++ if -1 != index $_, $k; } } my ($support, $against, $result); print 'I before E when not preceded by C: '; $support = $count{ie} - $count{cie}; $against = $count{ei} - $count{cei}; $result += result($support, $against); print 'E before I when preceded by C: '; $support = $count{cei}; $against = $count{cie}; $result += result($support, $against); print 'Overall: ', 'NOT ' x ($result < 2), "PLAUSIBLE.\n";
728I before E except after C
2perl
6jl36
1.step{|n| puts n}
714Integer sequence
14ruby
zrbtw
fn main() { for i in 0.. { println!("{}", i); } }
714Integer sequence
15rust
37pz8
package main import ( "fmt" "gonum.org/v1/gonum/mat" ) func eye(n int) *mat.Dense { m := mat.NewDense(n, n, nil) for i := 0; i < n; i++ { m.Set(i, i, 1) } return m } func main() { fmt.Println(mat.Formatted(eye(3))) }
730Identity matrix
0go
78kr2
Stream from 1 foreach println
714Integer sequence
16scala
mkeyc
>
727Increment a numerical string
1lua
37lzo
def makeIdentityMatrix = { n -> (0..<n).collect { i -> (0..<n).collect { j -> (i == j) ? 1: 0 } } }
730Identity matrix
7groovy
uwgv9
import java.io.*; public class compInt { public static void main(String[] args) { try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int nbr1 = Integer.parseInt(in.readLine()); int nbr2 = Integer.parseInt(in.readLine()); if(nbr1<nbr2) System.out.println(nbr1 + " is less than " + nbr2); if(nbr1>nbr2) System.out.println(nbr1 + " is greater than " + nbr2); if(nbr1==nbr2) System.out.println(nbr1 + " is equal to " + nbr2); } catch(IOException e) { } } }
725Integer comparison
9java
0czse
use strict ; use warnings ; use Math::BigInt ; my %countrycodelengths = ( "AL" => 28, "AD" => 24, "AT" => 20, "AZ" => 28, "BE" => 16, "BH" => 22, "BA" => 20, "BR" => 29, "BG" => 22, "CR" => 21, "HR" => 21, "CY" => 28, "CZ" => 24, "DK" => 18, "DO" => 28, "EE" => 20, "FO" => 18, "FI" => 18, "FR" => 27, "GE" => 22, "DE" => 22, "GI" => 23, "GR" => 27, "GL" => 18, "GT" => 28, "HU" => 28, "IS" => 26, "IE" => 22, "IL" => 23, "IT" => 27, "KZ" => 20, "KW" => 30, "LV" => 21, "LB" => 28, "LI" => 21, "LT" => 20, "LU" => 20, "MK" => 19, "MT" => 31, "MR" => 27, "MU" => 30, "MC" => 27, "MD" => 24, "ME" => 22, "NL" => 18, "NO" => 15, "PK" => 24, "PS" => 29, "PL" => 28, "PT" => 25, "RO" => 24, "SM" => 27, "SA" => 24, "RS" => 22, "SK" => 24, "SI" => 19, "ES" => 24, "SE" => 24, "CH" => 21, "TN" => 24, "TR" => 26, "AE" => 23, "GB" => 22, "VG" => 24 ) ; sub validate_iban { my $ibanstring = shift ; $ibanstring =~ s/\s+//g ; return 0 unless $ibanstring =~ /[0-9a-zA-Z]+/ ; $ibanstring = uc $ibanstring ; return 0 if ( not exists $countrycodelengths{ substr( $ibanstring , 0 , 2 ) } ); return 0 if length ( $ibanstring ) != $countrycodelengths{ substr( $ibanstring , 0 , 2 ) } ; $ibanstring =~ s/(.{4})(.+)/$2$1/ ; $ibanstring =~ s/([A-Z])/ord( $1 ) - 55/eg ; my $number = Math::BigInt->new( $ibanstring ) ; if ( $number->bmod( 97 ) == 1 ) { return 1 ; } else { return 0 ; } } if ( validate_iban( "GB82 WEST 1234 5698 7654 32" ) ) { print "GB82 WEST 1234 5698 7654 32 is a valid IBAN number!\n" ; } else { print "Sorry! GB82 WEST 1234 5698 7654 32 is not valid!\n" ; } if ( validate_iban( "GB82TEST12345698765432" ) ) { print "GB82TEST12345698765432 is valid!\n" ; }
729IBAN
2perl
nuziw
matI n = [ [fromEnum $ i == j | i <- [1..n]] | j <- [1..n]]
730Identity matrix
8haskell
8ln0z
null
725Integer comparison
10javascript
d59nu
package main import ( "crypto/tls" "io/ioutil" "log" "net/http" ) func main() {
731HTTPS/Client-authenticated
0go
9blmt
import urllib.request import re PLAUSIBILITY_RATIO = 2 def plausibility_check(comment, x, y): print('\n Checking plausibility of:%s'% comment) if x > PLAUSIBILITY_RATIO * y: print(' PLAUSIBLE. As we have counts of%i vs%i, a ratio of%4.1f times' % (x, y, x / y)) else: if x > y: print(' IMPLAUSIBLE. As although we have counts of%i vs%i, a ratio of%4.1f times does not make it plausible' % (x, y, x / y)) else: print(' IMPLAUSIBLE, probably contra-indicated. As we have counts of%i vs%i, a ratio of%4.1f times' % (x, y, x / y)) return x > PLAUSIBILITY_RATIO * y def simple_stats(url='http: words = urllib.request.urlopen(url).read().decode().lower().split() cie = len({word for word in words if 'cie' in word}) cei = len({word for word in words if 'cei' in word}) not_c_ie = len({word for word in words if re.search(r'(^ie|[^c]ie)', word)}) not_c_ei = len({word for word in words if re.search(r'(^ei|[^c]ei)', word)}) return cei, cie, not_c_ie, not_c_ei def print_result(cei, cie, not_c_ie, not_c_ei): if ( plausibility_check('I before E when not preceded by C', not_c_ie, not_c_ei) & plausibility_check('E before I when preceded by C', cei, cie) ): print('\nOVERALL IT IS PLAUSIBLE!') else: print('\nOVERALL IT IS IMPLAUSIBLE!') print('(To be plausible, one count must exceed another by%i times)'% PLAUSIBILITY_RATIO) print('Checking plausibility of :') print_result(*simple_stats())
728I before E except after C
3python
yh26q
null
731HTTPS/Client-authenticated
11kotlin
2auli
<?php function piece_wise($iban_all_digits) { $remainder = NULL; $slice = 9; for ($i=0; $i<strlen($iban_all_digits); $i=$i+$slice) { if ($i>0) { $slice = 7; } $part = $remainder . substr($iban_all_digits, $i, $slice); $remainder = intval($part) % 97; } return $remainder; } $iban = ; $iban = str_replace(' ', '', $iban); $iban_length = strlen($iban); $country_code = substr($iban, 0, 2); $lengths = ['GB' => 22]; if ($lengths[$country_code] != $iban_length) { exit (); } $iban = substr($iban, 4) . substr($iban, 0, 4); $iban_arr = str_split($iban, 1); $iban_all_digits = ''; foreach ($iban_arr as $key=>$value) { if (ctype_alpha($value)) { $value = ord($value) - 55; } $iban_all_digits = $iban_all_digits . $value; } if (piece_wise($iban_all_digits) === 1) { echo ; } else { echo ; }
729IBAN
12php
78brp
var i = 0 while true { println(i++) }
714Integer sequence
17swift
tgkfl
use 5.018_002; use warnings; use LWP; our $VERSION = 1.000_000; my $ua = LWP::UserAgent->new( ssl_opts => { SSL_cert_file => 'certificate.pem', SSL_key_file => 'key.pem', verify_hostname => 1, } ); my $req = HTTP::Request->new( GET => 'https://www.example.com' ); my $res = $ua->request($req); if ( $res->is_success ) { say $res->content; } else { say $res->status_line; }
731HTTPS/Client-authenticated
2perl
s98q3
int main(void) { CURL *curl; char buffer[CURL_ERROR_SIZE]; if ((curl = curl_easy_init()) != NULL) { curl_easy_setopt(curl, CURLOPT_URL, ); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, buffer); if (curl_easy_perform(curl) != CURLE_OK) { fprintf(stderr, , buffer); return EXIT_FAILURE; } curl_easy_cleanup(curl); } return EXIT_SUCCESS; }
732HTTPS/Authenticated
5c
xyqwu
words = tolower(readLines("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt")) ie.npc = sum(grepl("(?<!c)ie", words, perl = T)) ei.npc = sum(grepl("(?<!c)ei", words, perl = T)) ie.pc = sum(grepl("cie", words, fixed = T)) ei.pc = sum(grepl("cei", words, fixed = T)) p1 = ie.npc > 2 * ei.npc p2 = ei.pc > 2 * ie.pc message("(1) is ", (if (p1) "" else "not "), "plausible.") message("(2) is ", (if (p2) "" else "not "), "plausible.") message("The whole phrase is ", (if (p1 && p2) "" else "not "), "plausible.")
728I before E except after C
13r
tgmfz
fun main(args: Array<String>) { val n1 = readLine()!!.toLong() val n2 = readLine()!!.toLong() println(when { n1 < n2 -> "$n1 is less than $n2" n1 > n2 -> "$n1 is greater than $n2" n1 == n2 -> "$n1 is equal to $n2" else -> "" }) }
725Integer comparison
11kotlin
e3ia4
(clj-http.client/get "https://somedomain.com" {:basic-auth ["user" "pass"]})
732HTTPS/Authenticated
6clojure
o2i8j
public class PrintIdentityMatrix { public static void main(String[] args) { int n = 5; int[][] array = new int[n][n]; IntStream.range(0, n).forEach(i -> array[i][i] = 1); Arrays.stream(array) .map((int[] a) -> Arrays.toString(a)) .forEach(System.out::println); } }
730Identity matrix
9java
e3qa5
import httplib connection = httplib.HTTPSConnection('www.example.com',cert_file='myCert.PEM') connection.request('GET','/index.html') response = connection.getresponse() data = response.read()
731HTTPS/Client-authenticated
3python
0cosq
package main import ( "encoding/base64" "io" "log" "net/http" "strings" ) const userPass = "rosetta:code" const unauth = http.StatusUnauthorized func hw(w http.ResponseWriter, req *http.Request) { auth := req.Header.Get("Authorization") if !strings.HasPrefix(auth, "Basic ") { log.Print("Invalid authorization:", auth) http.Error(w, http.StatusText(unauth), unauth) return } up, err := base64.StdEncoding.DecodeString(auth[6:]) if err != nil { log.Print("authorization decode error:", err) http.Error(w, http.StatusText(unauth), unauth) return } if string(up) != userPass { log.Print("invalid username:password:", string(up)) http.Error(w, http.StatusText(unauth), unauth) return } io.WriteString(w, "Goodbye, World!") } func main() { http.HandleFunc("/", hw) log.Fatal(http.ListenAndServeTLS(":8080", "cert.pem", "key.pem", nil)) }
732HTTPS/Authenticated
0go
l12cw
function idMatrix(n) { return Array.apply(null, new Array(n)) .map(function (x, i, xs) { return xs.map(function (_, k) { return i === k ? 1 : 0; }) }); }
730Identity matrix
10javascript
0cisz
require 'uri' require 'net/http' uri = URI.parse('https: pem = File.read() cert = OpenSSL::X509::Certificate.new(pem) key = OpenSSL::PKey::RSA.new(pem) response = Net::HTTP.start(uri.host, uri.port, use_ssl: true, cert: cert, key: key) do |http| request = Net::HTTP::Get.new uri http.request request end
731HTTPS/Client-authenticated
14ruby
o2n8v
reqwest = {version = "0.11", features = ["native-tls", "blocking"]}
731HTTPS/Client-authenticated
15rust
ivdod
import java.io.FileInputStream import java.net.URL import java.security.KeyStore import javax.net.ssl.{HttpsURLConnection, KeyManagerFactory, SSLContext} import scala.io.BufferedSource object ClientAuthenticated extends App { val con: HttpsURLConnection = new URL("https:
731HTTPS/Client-authenticated
16scala
f4zd4
module Main (main) where import Data.Aeson (Value) import Data.Default.Class (def) import Network.HTTP.Req ( (/:) , GET(..) , NoReqBody(..) , basicAuth , https , jsonResponse , req , responseBody , runReq ) main :: IO () main = do response <- runReq def $ req GET (https "httpbin.org" /: "basic-auth" /: "someuser" /: "somepassword") NoReqBody jsonResponse (basicAuth "someuser" "somepassword") print (responseBody response :: Value)
732HTTPS/Authenticated
8haskell
1taps
null
732HTTPS/Authenticated
11kotlin
uw5vc
import re _country2length = dict( AL=28, AD=24, AT=20, AZ=28, BE=16, BH=22, BA=20, BR=29, BG=22, CR=21, HR=21, CY=28, CZ=24, DK=18, DO=28, EE=20, FO=18, FI=18, FR=27, GE=22, DE=22, GI=23, GR=27, GL=18, GT=28, HU=28, IS=26, IE=22, IL=23, IT=27, KZ=20, KW=30, LV=21, LB=28, LI=21, LT=20, LU=20, MK=19, MT=31, MR=27, MU=30, MC=27, MD=24, ME=22, NL=18, NO=15, PK=24, PS=29, PL=28, PT=25, RO=24, SM=27, SA=24, RS=22, SK=24, SI=19, ES=24, SE=24, CH=21, TN=24, TR=26, AE=23, GB=22, VG=24 ) def valid_iban(iban): iban = iban.replace(' ','').replace('\t','') if not re.match(r'^[\dA-Z]+$', iban): return False if len(iban) != _country2length[iban[:2]]: return False iban = iban[4:] + iban[:4] digits = int(''.join(str(int(ch, 36)) for ch in iban)) return digits% 97 == 1 if __name__ == '__main__': for account in [, ]: print('%s validation is:%s'% (account, valid_iban(account)))
729IBAN
3python
d53n1
local requests = require('requests') local auth = requests.HTTPBasicAuth('admin', 'admin') local resp, e = requests.get({ url = 'https://httpbin.org/basic-auth/admin/admin', auth = auth }) io.write(string.format('Status:%d', resp.status_code))
732HTTPS/Authenticated
1lua
5x4u6
use LWP::UserAgent qw(); my $ua = LWP::UserAgent->new; my $netloc = 'http://www.buddhism-dict.net/cgi-bin/xpr-dealt.pl:80'; $ua->credentials( $netloc, 'CJK-E and Buddhist Dictionaries', 'guest', '', ); my $response = $ua->get($netloc); use WWW::Mechanize qw(); my $mech = WWW::Mechanize->new; $mech->get('https://login.yahoo.com/'); $mech->submit_form(with_fields => { login => 'XXXXXX', passwd => 'YYYYYY', '.persistent' => 'y', });
732HTTPS/Authenticated
2perl
8lo0w
require 'open-uri' plausibility_ratio = 2 counter = Hash.new(0) path = 'http: rules = [['I before E when not preceded by C:', 'ie', 'ei'], ['E before I when preceded by C:', 'cei', 'cie']] open(path){|f| f.each{|line| line.scan(/ie|ei|cie|cei/){|match| counter[match] += 1 }}} overall_plausible = rules.all? do |(str, x, y)| num_x, num_y, ratio = counter[x], counter[y], counter[x] / counter[y].to_f plausibility = ratio > plausibility_ratio puts str puts plausibility end puts
728I before E except after C
14ruby
9bumz
from mechanize import Browser USER_AGENT = br = Browser() br.addheaders = [(, USER_AGENT)] br.open() br.select_form() br['email'] = br['pass'] = br['persistent'] = [] response = br.submit() print response.read()
732HTTPS/Authenticated
3python
o2i81
CURL *curl; char buffer[CURL_ERROR_SIZE]; int main(void) { if ((curl = curl_easy_init()) != NULL) { curl_easy_setopt(curl, CURLOPT_URL, ); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, buffer); if (curl_easy_perform(curl) != CURLE_OK) { fprintf(stderr, , buffer); return EXIT_FAILURE; } curl_easy_cleanup(curl); } return EXIT_SUCCESS; }
733HTTPS
5c
yhy6f
import std.math, grayscale_image; Image!Gray houghTransform(in Image!Gray im, in size_t hx=460, in size_t hy=360) pure nothrow in { assert(im !is null); assert(hx > 0 && hy > 0); assert((hy & 1) == 0, ); } body { auto result = new Image!Gray(hx, hy); result.clear(Gray.white); immutable double rMax = hypot(im.nx, im.ny); immutable double dr = rMax / (hy / 2.0); immutable double dTh = PI / hx; foreach (immutable y; 0 .. im.ny) { foreach (immutable x; 0 .. im.nx) { if (im[x, y] == Gray.white) continue; foreach (immutable iTh; 0 .. hx) { immutable double th = dTh * iTh; immutable double r = x * cos(th) + y * sin(th); immutable iry = hy / 2 - cast(int)floor(r / dr + 0.5); if (result[iTh, iry] > Gray(0)) result[iTh, iry]--; } } } return result; } void main() { (new Image!RGB) .loadPPM6() .rgb2grayImage() .houghTransform() .savePGM(); }
734Hough transform
5c
val2o
null
730Identity matrix
11kotlin
kn1h3
use std::default::Default; use std::ops::AddAssign; use itertools::Itertools; use reqwest::get; #[derive(Default, Debug)] struct Feature<T> { pub cie: T, pub xie: T, pub cei: T, pub xei: T, } impl AddAssign<Feature<bool>> for Feature<u64> { fn add_assign(&mut self, rhs: Feature<bool>) { self.cei += rhs.cei as u64; self.xei += rhs.xei as u64; self.cie += rhs.cie as u64; self.xie += rhs.xie as u64; } } fn check_feature(word: &str) -> Feature<bool> { let mut feature: Feature<bool> = Default::default(); for window in word.chars().tuple_windows::<(char, char, char)>() { match window { ('c', 'e', 'i') => { feature.cei = true } ('c', 'i', 'e') => { feature.cie = true } (not_c, 'e', 'i') if not_c!= 'c' => (feature.xei = true), (not_c, 'i', 'e') if not_c!= 'c' => (feature.xie = true), _ => {} } } feature } fn maybe_is_feature_plausible(feature_count: u64, opposing_count: u64) -> Option<bool> { if feature_count > 2 * opposing_count { Some(true) } else if opposing_count > 2 * feature_count { Some(false) } else { None } } fn print_feature_plausibility(feature_plausibility: Option<bool>, feature_name: &str) { let plausible_msg = match feature_plausibility { None => " is implausible", Some(true) => "is plausible", Some(false) => "is definitely implausible", }; println!("{} {}", feature_name, plausible_msg) } fn main() { let mut res = get(" http:
728I before E except after C
15rust
cp59z
print('Enter the first number: ') a = tonumber(io.stdin:read()) print('Enter the second number: ') b = tonumber(io.stdin:read()) if a < b then print(a .. " is less than " .. b) end if a > b then print(a .. " is greater than " .. b) end if a == b then print(a .. " is equal to " .. b) end
725Integer comparison
1lua
w6nea
require 'uri' require 'net/http' uri = URI.parse('https: response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http| request = Net::HTTP::Get.new uri request.basic_auth('username', 'password') http.request request end
732HTTPS/Authenticated
14ruby
nudit
(use '[clojure.contrib.duck-streams:only (slurp*)]) (print (slurp* "https://sourceforge.net"))
733HTTPS
6clojure
2a2l1
object I_before_E_except_after_C extends App { val testIE1 = "(^|[^c])ie".r
728I before E except after C
16scala
ver2s
extern crate reqwest; use reqwest::blocking::Client; use reqwest::header::CONNECTION; fn main() { let client = Client::new();
732HTTPS/Authenticated
15rust
d5fny
import java.net.{Authenticator, PasswordAuthentication, URL} import javax.net.ssl.HttpsURLConnection import scala.io.BufferedSource object Authenticated extends App { val con: HttpsURLConnection = new URL("https:
732HTTPS/Authenticated
16scala
zr3tr
int main() { int one = 1; printf(, (int)(CHAR_BIT * sizeof(size_t))); if (*(char *)&one) printf(); else printf(); return 0; }
735Host introspection
5c
uelv4
def valid_iban? iban len = { AL: 28, AD: 24, AT: 20, AZ: 28, BE: 16, BH: 22, BA: 20, BR: 29, BG: 22, CR: 21, HR: 21, CY: 28, CZ: 24, DK: 18, DO: 28, EE: 20, FO: 18, FI: 18, FR: 27, GE: 22, DE: 22, GI: 23, GR: 27, GL: 18, GT: 28, HU: 28, IS: 26, IE: 22, IL: 23, IT: 27, KZ: 20, KW: 30, LV: 21, LB: 28, LI: 21, LT: 20, LU: 20, MK: 19, MT: 31, MR: 27, MU: 30, MC: 27, MD: 24, ME: 22, NL: 18, NO: 15, PK: 24, PS: 29, PL: 28, PT: 25, RO: 24, SM: 27, SA: 24, RS: 22, SK: 24, SI: 19, ES: 24, SE: 24, CH: 21, TN: 24, TR: 26, AE: 23, GB: 22, VG: 24 } iban.delete! return false unless iban =~ /^[\dA-Z]+$/ cc = iban[0, 2].to_sym return false unless iban.size == len[cc] iban = iban[4..-1] + iban[0, 4] iban.gsub!(/./) { |c| c.to_i(36) } iban.to_i % 97 == 1 end p valid_iban? p valid_iban?
729IBAN
14ruby
tgyf2
package main import ( "fmt" "image" "image/color" "image/draw" "image/png" "math" "os" ) func hough(im image.Image, ntx, mry int) draw.Image { nimx := im.Bounds().Max.X mimy := im.Bounds().Max.Y him := image.NewGray(image.Rect(0, 0, ntx, mry)) draw.Draw(him, him.Bounds(), image.NewUniform(color.White), image.Point{}, draw.Src) rmax := math.Hypot(float64(nimx), float64(mimy)) dr := rmax / float64(mry/2) dth := math.Pi / float64(ntx) for jx := 0; jx < nimx; jx++ { for iy := 0; iy < mimy; iy++ { col := color.GrayModel.Convert(im.At(jx, iy)).(color.Gray) if col.Y == 255 { continue } for jtx := 0; jtx < ntx; jtx++ { th := dth * float64(jtx) r := float64(jx)*math.Cos(th) + float64(iy)*math.Sin(th) iry := mry/2 - int(math.Floor(r/dr+.5)) col = him.At(jtx, iry).(color.Gray) if col.Y > 0 { col.Y-- him.SetGray(jtx, iry, col) } } } } return him } func main() { f, err := os.Open("Pentagon.png") if err != nil { fmt.Println(err) return } pent, err := png.Decode(f) if err != nil { fmt.Println(err) return } if err = f.Close(); err != nil { fmt.Println(err) } h := hough(pent, 460, 360) if f, err = os.Create("hough.png"); err != nil { fmt.Println(err) return } if err = png.Encode(f, h); err != nil { fmt.Println(err) } if cErr := f.Close(); cErr != nil && err == nil { fmt.Println(err) } }
734Hough transform
0go
smxqa
fn main() { for iban in [ "", "x", "QQ82", "QQ82W", "GB82 TEST 1234 5698 7654 322", "gb82 WEST 1234 5698 7654 32", "GB82 WEST 1234 5698 7654 32", "GB82 TEST 1234 5698 7654 32", "GB81 WEST 1234 5698 7654 32", "SA03 8000 0000 6080 1016 7519", "CH93 0076 2011 6238 5295 7", ].iter() { println!( "'{}' is {}valid", iban, if validate_iban(iban) { "" } else { "NOT " } ); } } fn validate_iban(iban: &str) -> bool { let iso_len = [ ("AL", 28), ("AD", 24), ("AT", 20), ("AZ", 28), ("BE", 16), ("BH", 22), ("BA", 20), ("BR", 29), ("BG", 22), ("HR", 21), ("CY", 28), ("CZ", 24), ("DK", 18), ("DO", 28), ("EE", 20), ("FO", 18), ("FI", 18), ("FR", 27), ("GE", 22), ("DE", 22), ("GI", 23), ("GL", 18), ("GT", 28), ("HU", 28), ("IS", 26), ("IE", 22), ("IL", 23), ("IT", 27), ("KZ", 20), ("KW", 30), ("LV", 21), ("LB", 28), ("LI", 21), ("LT", 20), ("LU", 20), ("MK", 19), ("MT", 31), ("MR", 27), ("MU", 30), ("MC", 27), ("MD", 24), ("ME", 22), ("NL", 18), ("NO", 15), ("PK", 24), ("PS", 29), ("PL", 28), ("PT", 25), ("RO", 24), ("SM", 27), ("SA", 24), ("RS", 22), ("SK", 24), ("SI", 19), ("ES", 24), ("SE", 24), ("CH", 21), ("TN", 24), ("TR", 26), ("AE", 23), ("GB", 22), ("VG", 24), ("GR", 27), ("CR", 21), ]; let trimmed_iban = iban.chars() .filter(|&ch| ch!= ' ') .collect::<String>() .to_uppercase(); if trimmed_iban.len() < 4 { return false; } let prefix = &trimmed_iban[0..2]; if let Some(pair) = iso_len.iter().find(|&&(code, _)| code == prefix) { if pair.1!= trimmed_iban.len() { return false; } } else { return false; } let reversed_iban = format!("{}{}", &trimmed_iban[4..], &trimmed_iban[0..4]); let mut expanded_iban = String::new(); for ch in reversed_iban.chars() { expanded_iban.push_str(&if ch.is_numeric() { format!("{}", ch) } else { format!("{}", ch as u8 - 'A' as u8 + 10u8) }); } expanded_iban.bytes().fold(0, |acc, ch| { (acc * 10 + ch as u32 - '0' as u32)% 97 }) == 1 }
729IBAN
15rust
zrmto
import Control.Monad (forM_, when) import Data.Array ((!)) import Data.Array.ST (newArray, writeArray, readArray, runSTArray) import qualified Data.Foldable as F (maximum) import System.Environment (getArgs, getProgName) import Codec.Picture (DynamicImage(ImageRGB8, ImageRGBA8), Image, PixelRGB8(PixelRGB8), PixelRGBA8(PixelRGBA8), imageWidth, imageHeight, pixelAt, generateImage, readImage, pixelMap, savePngImage) import Codec.Picture.Types (extractLumaPlane, dropTransparency) dot :: Num a => (a, a) -> (a, a) -> a dot (x1, y1) (x2, y2) = x1 * x2 + y1 * y2 mag :: Floating a => (a, a) -> a mag a = sqrt $ dot a a sub :: Num a => (a, a) -> (a, a) -> (a, a) sub (x1, y1) (x2, y2) = (x1 - x2, y1 - y2) fromIntegralP :: (Integral a, Num b) => (a, a) -> (b, b) fromIntegralP (x, y) = (fromIntegral x, fromIntegral y) hough :: Image PixelRGB8 -> Int -> Int -> Image PixelRGB8 hough image thetaSize distSize = hImage where width = imageWidth image height = imageHeight image wMax = width - 1 hMax = height - 1 xCenter = wMax `div` 2 yCenter = hMax `div` 2 lumaMap = extractLumaPlane image gradient x y = let orig = pixelAt lumaMap x y x_ = pixelAt lumaMap (min (x + 1) wMax) y y_ = pixelAt lumaMap x (min (y + 1) hMax) in fromIntegralP (orig - x_, orig - y_) gradMap = [ ((x, y), gradient x y) | x <- [0 .. wMax] , y <- [0 .. hMax] ] distMax :: Double distMax = (sqrt . fromIntegral $ height ^ 2 + width ^ 2) / 2 accBin = runSTArray $ do arr <- newArray ((0, 0), (thetaSize, distSize)) 0 forM_ gradMap $ \((x, y), grad) -> do let (x_, y_) = fromIntegralP $ (xCenter, yCenter) `sub` (x, y) when (mag grad > 127) $ forM_ [0 .. thetaSize] $ \theta -> do let theta_ = fromIntegral theta * 360 / fromIntegral thetaSize / 180 * pi :: Double dist = cos theta_ * x_ + sin theta_ * y_ dist_ = truncate $ dist * fromIntegral distSize / distMax idx = (theta, dist_) when (dist_ >= 0 && dist_ < distSize) $ do old <- readArray arr idx writeArray arr idx $ old + 1 return arr maxAcc = F.maximum accBin hTransform x y = let l = 255 - truncate ((accBin ! (x, y)) / maxAcc * 255) in PixelRGB8 l l l hImage = generateImage hTransform thetaSize distSize houghIO :: FilePath -> FilePath -> Int -> Int -> IO () houghIO path outpath thetaSize distSize = do image <- readImage path case image of Left err -> putStrLn err Right (ImageRGB8 image_) -> doImage image_ Right (ImageRGBA8 image_) -> doImage $ pixelMap dropTransparency image_ _ -> putStrLn "Expecting RGB8 or RGBA8 image" where doImage image = do let houghImage = hough image thetaSize distSize savePngImage outpath $ ImageRGB8 houghImage main :: IO () main = do args <- getArgs prog <- getProgName case args of [path, outpath, thetaSize, distSize] -> houghIO path outpath (read thetaSize) (read distSize) _ -> putStrLn $ "Usage: " ++ prog ++ " <image-file> <out-file.png> <width> <height>"
734Hough transform
8haskell
9kymo
import Foundation let request = NSURLRequest(URL: NSURL(string: "http:
728I before E except after C
17swift
mkvyk
struct huffcode { int nbits; int code; }; typedef struct huffcode huffcode_t; struct huffheap { int *h; int n, s, cs; long *f; }; typedef struct huffheap heap_t; static heap_t *_heap_create(int s, long *f) { heap_t *h; h = malloc(sizeof(heap_t)); h->h = malloc(sizeof(int)*s); h->s = h->cs = s; h->n = 0; h->f = f; return h; } static void _heap_destroy(heap_t *heap) { free(heap->h); free(heap); } a[(I)] = a[(J)]; a[(J)] = t_; } while(0) static void _heap_sort(heap_t *heap) { int i=1, j=2; int *a = heap->h; while(i < heap->n) { if ( heap->f[a[i-1]] >= heap->f[a[i]] ) { i = j; j++; } else { swap_(i-1, i); i--; i = (i==0) ? j++ : i; } } } static void _heap_add(heap_t *heap, int c) { if ( (heap->n + 1) > heap->s ) { heap->h = realloc(heap->h, heap->s + heap->cs); heap->s += heap->cs; } heap->h[heap->n] = c; heap->n++; _heap_sort(heap); } static int _heap_remove(heap_t *heap) { if ( heap->n > 0 ) { heap->n--; return heap->h[heap->n]; } return -1; } huffcode_t **create_huffman_codes(long *freqs) { huffcode_t **codes; heap_t *heap; long efreqs[BYTES*2]; int preds[BYTES*2]; int i, extf=BYTES; int r1, r2; memcpy(efreqs, freqs, sizeof(long)*BYTES); memset(&efreqs[BYTES], 0, sizeof(long)*BYTES); heap = _heap_create(BYTES*2, efreqs); if ( heap == NULL ) return NULL; for(i=0; i < BYTES; i++) if ( efreqs[i] > 0 ) _heap_add(heap, i); while( heap->n > 1 ) { r1 = _heap_remove(heap); r2 = _heap_remove(heap); efreqs[extf] = efreqs[r1] + efreqs[r2]; _heap_add(heap, extf); preds[r1] = extf; preds[r2] = -extf; extf++; } r1 = _heap_remove(heap); preds[r1] = r1; _heap_destroy(heap); codes = malloc(sizeof(huffcode_t *)*BYTES); int bc, bn, ix; for(i=0; i < BYTES; i++) { bc=0; bn=0; if ( efreqs[i] == 0 ) { codes[i] = NULL; continue; } ix = i; while( abs(preds[ix]) != ix ) { bc |= ((preds[ix] >= 0) ? 1 : 0 ) << bn; ix = abs(preds[ix]); bn++; } codes[i] = malloc(sizeof(huffcode_t)); codes[i]->nbits = bn; codes[i]->code = bc; } return codes; } void free_huffman_codes(huffcode_t **c) { int i; for(i=0; i < BYTES; i++) free(c[i]); free(c); } void inttobits(int c, int n, char *s) { s[n] = 0; while(n > 0) { s[n-1] = (c%2) + '0'; c >>= 1; n--; } } const char *test = ; int main() { huffcode_t **r; int i; char strbit[MAXBITSPERCODE]; const char *p; long freqs[BYTES]; memset(freqs, 0, sizeof freqs); p = test; while(*p != '\0') freqs[*p++]++; r = create_huffman_codes(freqs); for(i=0; i < BYTES; i++) { if ( r[i] != NULL ) { inttobits(r[i]->code, r[i]->nbits, strbit); printf(, i, r[i]->code, strbit); } } free_huffman_codes(r); return 0; }
736Huffman coding
5c
gqv45
(.. java.net.InetAddress getLocalHost getHostName)
737Hostname
6clojure
gq24f
import scala.collection.immutable.SortedMap class Iban(val iban: String) {
729IBAN
16scala
yhl63
import java.awt.image.*; import java.io.File; import java.io.IOException; import javax.imageio.*; public class HoughTransform { public static ArrayData houghTransform(ArrayData inputData, int thetaAxisSize, int rAxisSize, int minContrast) { int width = inputData.width; int height = inputData.height; int maxRadius = (int)Math.ceil(Math.hypot(width, height)); int halfRAxisSize = rAxisSize >>> 1; ArrayData outputData = new ArrayData(thetaAxisSize, rAxisSize);
734Hough transform
9java
t4df9
package main import ( "io" "log" "net/http" "os" ) func main() { r, err := http.Get("https:
733HTTPS
0go
1t1p5
(println "word size: " (System/getProperty "sun.arch.data.model")) (println "endianness: " (System/getProperty "sun.cpu.endian"))
735Host introspection
6clojure
704r0
import java.awt.image.BufferedImage import java.io.File import javax.imageio.ImageIO internal class ArrayData(val dataArray: IntArray, val width: Int, val height: Int) { constructor(width: Int, height: Int) : this(IntArray(width * height), width, height) operator fun get(x: Int, y: Int) = dataArray[y * width + x] operator fun set(x: Int, y: Int, value: Int) { dataArray[y * width + x] = value } operator fun invoke(thetaAxisSize: Int, rAxisSize: Int, minContrast: Int): ArrayData { val maxRadius = Math.ceil(Math.hypot(width.toDouble(), height.toDouble())).toInt() val halfRAxisSize = rAxisSize.ushr(1) val outputData = ArrayData(thetaAxisSize, rAxisSize)
734Hough transform
11kotlin
ol08z
function identity_matrix (size) local m = {} for i = 1, size do m[i] = {} for j = 1, size do m[i][j] = i == j and 1 or 0 end end return m end function print_matrix (m) for i = 1, #m do print(table.concat(m[i], " ")) end end print_matrix(identity_matrix(5))
730Identity matrix
1lua
bdaka
my $s = "12345"; $s++;
727Increment a numerical string
2perl
bdxk4
new URL("https:
733HTTPS
7groovy
joj7o
#!/usr/bin/runhaskell import Network.HTTP.Conduit import qualified Data.ByteString.Lazy as L import Network (withSocketsDo) main = withSocketsDo $ simpleHttp "https://sourceforge.net/" >>= L.putStr
733HTTPS
8haskell
tgtf7
$s = ; $s++;
727Increment a numerical string
12php
6j23g
URL url = new URL("https:
733HTTPS
9java
8l806
(require '[clojure.pprint:refer:all]) (defn probs [s] (let [freqs (frequencies s) sum (apply + (vals freqs))] (into {} (map (fn [[k v]] [k (/ v sum)]) freqs)))) (defn init-pq [weighted-items] (let [comp (proxy [java.util.Comparator] [] (compare [a b] (compare (:priority a) (:priority b)))) pq (java.util.PriorityQueue. (count weighted-items) comp)] (doseq [[item prob] weighted-items] (.add pq {:symbol item,:priority prob })) pq)) (defn huffman-tree [pq] (while (> (.size pq) 1) (let [a (.poll pq) b (.poll pq) new-node {:priority (+ (:priority a) (:priority b)):left a:right b}] (.add pq new-node))) (.poll pq)) (defn symbol-map ([t] (symbol-map t "")) ([{:keys [symbol priority left right]:as t} code] (if symbol [{:symbol symbol:weight priority:code code}] (concat (symbol-map left (str code \0)) (symbol-map right (str code \1)))))) (defn huffman-encode [items] (-> items probs init-pq huffman-tree symbol-map)) (defn display-huffman-encode [s] (->> s huffman-encode (sort-by:weight >) print-table)) (display-huffman-encode "this is an example for huffman encoding")
736Huffman coding
6clojure
kirhs
fetch("https:
733HTTPS
10javascript
f4fdg
null
733HTTPS
11kotlin
w6wek
use strict; use warnings; use Imager; use constant pi => 3.14159265; sub hough { my($im) = shift; my($width) = shift || 460; my($height) = shift || 360; $height = 2 * int $height/2; $height = 2 * int $height/2; my($xsize, $ysize) = ($im->getwidth, $im->getheight); my $ht = Imager->new(xsize => $width, ysize => $height); my @canvas; for my $i (0..$height-1) { for my $j (0..$width-1) { $canvas[$i][$j] = 255 } } $ht->box(filled => 1, color => 'white'); my $rmax = sqrt($xsize**2 + $ysize**2); my $dr = 2 * $rmax / $height; my $dth = pi / $width; for my $x (0..$xsize-1) { for my $y (0..$ysize-1) { my $col = $im->getpixel(x => $x, y => $y); my($r,$g,$b) = $col->rgba; next if $r==255; for my $k (0..$width) { my $th = $dth*$k; my $r2 = ($x*cos($th) + $y*sin($th)); my $iry = ($height/2 + int($r2/$dr + 0.5)); $ht->setpixel(x => $k, y => $iry, color => [ ($canvas[$iry][$k]--) x 3] ); } } } return $ht; } my $img = Imager->new; $img->read(file => 'ref/pentagon.png') or die "Cannot read: ", $img->errstr; my $ht = hough($img); $ht->write(file => 'hough_transform.png');
734Hough transform
2perl
gq54e
local request = require('http.request') local headers, stream = request.new_from_uri("https://sourceforge.net/"):go() local body = stream:get_body_as_string() local status = headers:get(':status') io.write(string.format('Status:%d\nBody:%s\n', status, body)
733HTTPS
1lua
xyxwz
package main import ( "fmt" "io/ioutil" "runtime" "strconv" "strings" "unsafe" ) func main() { fmt.Println(runtime.Version(), runtime.GOOS, runtime.GOARCH)
735Host introspection
0go
09xsk
from math import hypot, pi, cos, sin from PIL import Image def hough(im, ntx=460, mry=360): pim = im.load() nimx, mimy = im.size mry = int(mry/2)*2 him = Image.new(, (ntx, mry), 255) phim = him.load() rmax = hypot(nimx, mimy) dr = rmax / (mry/2) dth = pi / ntx for jx in xrange(nimx): for iy in xrange(mimy): col = pim[jx, iy] if col == 255: continue for jtx in xrange(ntx): th = dth * jtx r = jx*cos(th) + iy*sin(th) iry = mry/2 + int(r/dr+0.5) phim[jtx, iry] -= 1 return him def test(): im = Image.open().convert() him = hough(im) him.save() if __name__ == : test()
734Hough transform
3python
rs4gq
package main import ( "fmt" "math/big" "rcu" "sort" ) var zero = new(big.Int) var one = big.NewInt(1) var two = big.NewInt(2) var three = big.NewInt(3) var four = big.NewInt(4) var five = big.NewInt(5) var six = big.NewInt(6)
738Home primes
0go
rs2gm
println "word size: ${System.getProperty('sun.arch.data.model')}" println "endianness: ${System.getProperty('sun.cpu.endian')}"
735Host introspection
7groovy
ezpal
import Data.Bits import ADNS.Endian main = do putStrLn $ "Word size: " ++ bitsize putStrLn $ "Endianness: " ++ show endian where bitsize = show $ bitSize (undefined :: Int)
735Host introspection
8haskell
cby94
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Hostname()) }
737Hostname
0go
qy1xz
println InetAddress.localHost.hostName
737Hostname
7groovy
1fjp6
import Network.BSD main = do hostName <- getHostName putStrLn hostName
737Hostname
8haskell
mhtyf
use strict; use warnings; use ntheory 'factor'; for my $m (2..20, 65) { my (@steps, @factors) = $m; push @steps, join '_', @factors while (@factors = factor $steps[-1] =~ s/_//gr) > 1; my $step = $ if ($step >= 1) { print 'HP' . $_ . "($step) = " and --$step or last for @steps } else { print "HP$m = " } print "$steps[-1]\n"; }
738Home primes
2perl
zgotb
import java.nio.ByteOrder; public class ShowByteOrder { public static void main(String[] args) {
735Host introspection
9java
zgdtq