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
use strict; | |
use warnings; | |
# output: | |
# foo | |
# bar | |
combine({ | |
name => "foo", | |
surname => "bar" |
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
if os.path.exists('/private/tmp/corehist.txt'): | |
with open('/private/tmp/corehist.txt', 'r') as f: | |
int_from_file = int(f.readline()) | |
if my_int != int_from_file: | |
f.seek(0) | |
f.writeline(new_int_value) | |
else: | |
with open('/private/tmp/corehist.txt', 'w+') as f: | |
f.write(42) |
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 os | |
coredir = "/etc/sv/core" | |
histfile = "/tmp/corehist.txt" | |
dirlist = os.listdir(coredir) | |
dirlist.remove("core") | |
dirlist.count | |
with open(histfile, 'w') as f: | |
value_in_file = f.readline() |
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 os | |
import fnmatch | |
import re | |
coredir = '/etc/sv/core' | |
# with fnmatch | |
cores = [file for file in os.listdir(coredir) if fnmatch.fnmatch(file, 'core.*')] | |
# with re.compile |
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 fnmatch | |
import os | |
coredir = "/Users/cwj/Dropbox/Needle/corecheck/test" | |
histfile = "/Users/cwj/Dropbox/Needle/corecheck/corehist.txt" | |
cores = [file for file in os.listdir(coredir) if fnmatch.fnmatch(file, 'core.*')] | |
if os.path.exists(histfile): | |
with open(histfile, 'w') as f: |
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
GIRUGAMESH:~ $ python -c 'import sys; print "\n".join(["%s %s" % (i, v) for i, v in enumerate(sys.path)])' |
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
function [vega] = calculate_vega(S,K,r,T,sigma,N,q,option_parity,option_type) | |
vol_change = 0.01; | |
% change constantly volatility inputs, recalculate option prices | |
price_difference = priceit_(S,K,r,T,sigma+vol_change,N,q,option_parity,option_type) ... | |
- priceit_(S,K,r,T,sigma-vol_change,N,q,option_parity,option_type); | |
% take changes in option prices and divide by twice volatility difference | |
vega = price_difference / (2 * vol_change); | |
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
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Didea.launcher.port=7532 -Didea.launcher.bin.path=/Applications/IntelliJ IDEA 10 CE.app/bin -Dfile.encoding=UTF-8 -classpath /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/deploy.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-rt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-string.jar:/ |
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
use strict; | |
use warnings; | |
use diagnostics; | |
use feature qw(say); | |
my @arr = grep { $_ % 2 == 0 } 1..10; | |
my $name = 'slim shady'; | |
bar(\@arr,$name); |
OlderNewer