$ time ./countlargenumber.pl
500000000500000000
real 0m43.157s
user 0m43.013s
sys 0m0.019s
Executable written in C counting from 1 to 1,000,000,000:
$ time ./countlargenumber.out
500000000500000000
real 0m2.057s
user 0m2.028s
sys 0m0.002s
$ time ./countlargenumber.pl
500000000500000000
real 0m43.157s
user 0m43.013s
sys 0m0.019s
$ time ./countlargenumber.out
500000000500000000
real 0m2.057s
user 0m2.028s
sys 0m0.002s
awk -F'|' '{print $2}' ./lines.txt
md5 -s "test string"
MD5 ("test string") = 6f8db599de986fab7a21625b7916589c
echo -n test string | md5
6f8db599de986fab7a21625b7916589c
echo test string | md5
f299060e0383392ebeac64b714eca7e3
cat ./lines.txt | sed s/\|/,/g
awk '{print $0"|"}' ./input.txt > ./output.txt
/bin/sh: -c: line 0: unexpected EOF while looking for matching `]'
/bin/sh: -c: line 1: syntax error: unexpected end of file
*/10 * * * * perl -le 'sleep rand 60' && head -$[${RANDOM} % `wc -l < /Users/username/lines.txt` + 1] /Users/username/lines.txt | tail -1 | ruby /Users/username/tweet.rb
The entire command portion of the line, up to a newline or % character, will be executed by /bin/sh or by the shell specified in the SHELL variable of the cronfile. Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input.
*/10 * * * * perl -le 'sleep rand 60' && head -$[${RANDOM} \% `wc -l < /Users/username/lines.txt` + 1] /Users/username/lines.txt | tail -1 | ruby /Users/username/tweet.rb
*/10 * * * * perl -le 'sleep rand 540' && head -$[${RANDOM} \% `wc -l < /Users/username/lines.txt` + 1] /Users/username/lines.txt | tail -1 | ruby /Users/username/lines.rb
require 'json'
require 'oauth'
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
consumer = OAuth::Consumer.new(
consumer_key,
consumer_secret,
site:'https://api.twitter.com/'
)
endpoint = OAuth::AccessToken.new(consumer, access_token, access_token_secret)
# STATUS
status = STDIN.gets
# POST
response = endpoint.post('https://api.twitter.com/1.1/statuses/update.json', status: status )
result = JSON.parse(response.body)
echo $(ruby -e 'print rand') $(wc -l < "./lines.txt") | awk '{printf("%d\n", $1*$2)}'
Henry E. Baker |
Benjamin Banneker |
James Forten |
Ben Montgomery |
Norbert Rillieux |
Jan Ernst Matzeliger |
Elijah McCoy |
George Franklin Grant |
Lewis Howard Latimer |
Granville Woods |
Garrett Morgan |
George Washington Carver |
Madam C. J. Walker |
gem install oauth
require 'json'
require 'oauth'
consumer_key = '' # Your consumer key
consumer_secret = '' # Your consumer secret
access_token = '' # Your access token
access_token_secret = '' # Your access token secret
consumer = OAuth::Consumer.new(
consumer_key,
consumer_secret,
site:'https://api.twitter.com/'
)
endpoint = OAuth::AccessToken.new(consumer, access_token, access_token_secret)
# STATUS
status = ARGV[0]
# POST
response = endpoint.post('https://api.twitter.com/1.1/statuses/update.json', status: status )
result = JSON.parse(response.body)
ruby ./tweet.rb "Good morning! (おはようございます。)"
$ cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
$ cat /dev/urandom | env LC_CTYPE=C tr -dc '[:alnum:]' | fold -w 32 | head -n 1
$ cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-z0-9' | fold -w 15 | head -n 1
$ $ cat /dev/urandom | env LC_CTYPE=C tr -cd '[:lower:][:digit:]' | fold -w 15 | head -n 1
Swift |
@IBAction func addPotassiumTapped(sender : AnyObject){
let potassiumType = HKQuantityType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDietaryPotassium)
let potassiumQuantity = HKQuantity(unit: HKUnit.gramUnit(), doubleValue: 0.0055)
let potassiumSample = HKQuantitySample(type: potassiumType!, quantity: potassiumQuantity, startDate: NSDate(), endDate: NSDate())
let healthKitStore:HKHealthStore = HKHealthStore()
healthKitStore.saveObject(potassiumSample, withCompletion: { (success, error) -> Void in
if( error != nil ) {
print("Error saving Potassium sample: \(error!.localizedDescription)")
} else {
print("Potassium sample saved successfully!")
}
})
}
Swift |
@IBOutlet weak var aButton: UIButton!
@IBAction func buttonTapped(sender : AnyObject){
let healthKitStore:HKHealthStore = HKHealthStore()
let healthKitTypesToWrite = Set(
arrayLiteral: HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDietaryPotassium)! )
healthKitStore.requestAuthorizationToShareTypes(healthKitTypesToWrite, readTypes:nil){ (success, error) -> Void in
if success == false {
}
}
}
Swift |
@IBOutlet weak var aButton: UIButton!
@IBAction func buttonTapped(sender : AnyObject){
let alertController = UIAlertController(title: "My alert", message:
"This is an alert!", preferredStyle: UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.Default,handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
}
Jacqueline Goordial |
Some of the coldest and driest permafrost soils on Earth are located in the high-elevation McMurdo Dry Valleys (MDVs) of Antarctica, but little is known about the permafrost microbial communities other than that microorganisms are present in these valleys. Here, we describe the microbiology and habitable conditions of highly unique dry and ice-cemented permafrost in University Valley, one of the coldest and driest regions in the MDVs (1700 m above sea level; mean temperature −23 °C; no degree days above freezing), where the ice in permafrost originates from vapour deposition rather than liquid water. We found that culturable and total microbial biomass in University Valley was extremely low, and microbial activity under ambient conditions was undetectable. Our results contrast with reports from the lower-elevation Dry Valleys and Arctic permafrost soils where active microbial populations are found, suggesting that the combination of severe cold, aridity, oligotrophy of University Valley permafrost soils severely limit microbial activity and survival.http://www.nature.com/ismej/journal/vaop/ncurrent/full/ismej2015239a.html