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
var settlementCycle = 2; //T+2 | |
var tenor = tenor(“8M”); //tenor is swap period of eight months | |
var baseCurrencyHolidays = calendar.holidaysIn(swap.baseCurrency); | |
var counterCurrencyHolidays = calendar.holidaysIn(swap.baseCurrency); | |
var holidays = Set.of(ownerHolidays, counterpartyHolidays, baseCurrencyHolidays, counterCurrencyHolidays) | |
… | |
var nearSettlementDate = calculateSettlementDate(swap.tradeDate.plusDays(settlementCycle), holidays); | |
var farSettlementDate = calculateSettlementDate(nearSettlementDate.plus(tenor.toPeriod()), holidays); |
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
LocalDate settlementDate(LocalDate tradeDate) { | |
return tradeDate.plusDays(shift(tradeDate)); | |
} | |
int shift(LocalDate tradeDate) { | |
switch (tradeDate.getDayOfWeek()) { | |
case THURSDAY: | |
case FRIDAY: | |
case SATURDAY: | |
return 4; |
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
import java.time.LocalDate; | |
import java.util.UUID; | |
record Currency(String code); | |
record Money( | |
long amount, | |
Currency currency | |
); |
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
class FxSwapRecord { | |
UUID owner; | |
UUID counterparty; | |
Currency baseCurrency; | |
Currency counterCurrency; | |
long nearBaseAmount; | |
long nearCounterAmount; | |
long farBaseAmount; | |
long farCounterAmount; | |
LocalDate tradeDate; |
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
----- Esc ----- | |
Quick change directory: Esc + c | |
Quick change directory history: Esc + c and then Esc + h | |
Quick change directory previous entry: Esc + c and then Esc + p | |
Command line history: Esc + h | |
Command line previous command: Esc + p | |
View change: Esc + t (each time you do this shortcut a new directory view will appear) | |
Print current working directory in command line: Esc + a | |
Switch between background command line and MC: Ctrl + o | |
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name |
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 | |
date=`echo | openssl s_client -connect localhost:443 2>/dev/null | openssl x509 -noout -enddate | cut -d'=' -f2` | |
#date -d "$date" +%Y%m%d | |
expired=$(date -d "$date" +%s) | |
now=$(date -d 'now' +%s) | |
echo $(( (expired - now) / 86400 )) days |
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/bash | |
rsync -av --partial --rsh=ssh user@server:/opt/dumps/2015-11-09.backup . |
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/bash | |
ifconfig eth0 | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}' | |
#or | |
hostname -i |