Friday, June 21, 2019

Moving from technology to Business support.

As with any change, moving from a technology supporting role to a Business support role needs a change of mindset, and this post is intended to help you. Since I moved from Technical support to a Business facing role, I am hoping this will help you a bit when you intend to change.

I moved to a FX support role and gathered some points. Hopefully you find them useful!

Start with the basics:

-What is the company doing? Who are the customers? What is the average volume a day like?

-What does a day look like? Who are the stakeholders? How does the company resolve issues?


FX Basics:
-Spot and foward trading basics.
https://en.wikipedia.org/wiki/Foreign_exchange_spot

-What is a bid and offer? How does it matter?
https://www.investopedia.com/articles/forex/090914/understanding-spread-retail-currency-exchange-rates.asp

-What is an inverted rate (Tip: Bid> Offer)

-Settlement dates (T+1, T+2..)
https://en.wikipedia.org/wiki/Foreign_exchange_date_conventions#Calculating_spot_dates

-What is Risk?
https://admiralmarkets.com/education/articles/forex-basics/forex-risk-management

-Limit Order vs Market Order
Note that the systems can combine, based on simple if-else conditions based on correlation
https://www.investopedia.com/ask/answers/100314/whats-difference-between-market-order-and-limit-order.asp

-What is a fix protocol? What are the market subscription methods?
https://en.wikipedia.org/wiki/Financial_Information_eXchange

-Trading vs Hedging
https://www.investopedia.com/trading/hedging-beginners-guide/

-Basic excel tips
https://blog.hubspot.com/marketing/how-to-use-excel-tips
https://www.contextures.com/CreatePivotTable.html
https://www.guru99.com/excel-vlookup-tutorial.html

Understand what the data/rows represent.

Monday, April 23, 2018

BBC : Downloading the sound effects.

Background:

Shortlink: https://redd.it/8dn03t

Complete link: https://www.reddit.com/r/DataHoarder/comments/8dn03t/16000_bbc_sound_effects_wavs_now_available_online/

BBC is offering about 16000 of their sound files for download, under RemArc License.
https://github.com/bbcarchdev/Remarc/blob/master/doc/2016.09.27_RemArc_Content%20licence_Terms%20of%20Use_final.pdf

If you wish to use their files, please read their terms and conditions.

Now that is clear, I put together a powershell script to download the files. Have fun!

Import-Module BitsTransfer

$URL="http://bbcsfx.acropolis.org.uk/assets/"
$targetp="c:\tmp\BBC-Sounds\"
$csv=Import-Csv -Path c:\tmp\BBC-Sounds\BBCSoundEffects.csv
foreach ($line in $csv) {
$uri=$line.location
$fn=$line.description
$fn=$targetp+$fn
$fn=$fn+".wav"
#Write-Host $URL$uri
#Write-Host $fn
Start-BitsTransfer -Source $URL$uri -Destination $fn
}

Monday, December 28, 2015

AWS Shell

Came across the easy to use shell for AWS - https://github.com/awslabs/aws-shell

Appears pretty handy.

Friday, November 13, 2015

A simple script to verify that the DNS update has propagated (Bash/Unix)

Same premise as the Windows/powershell one, but this is for Bash / Unix.

while(true); do

for domain in `cat domains.txt`; do

echo -en $domain ":" ;

for i in dnsserver1 dnsserver2 dnsserver3 ; do echo -en $i $(dig +short NS @$i $domain | grep dns.ap | wc -l) "\t";

done;

echo "" ;
done ;
sleep 10;
clear;

done

Wednesday, November 11, 2015

A simple script to verify that the DNS update has propagated (Powershell / Windows)

Background: We updated a few name server records and removed references to AP ones. And this script simply queries your DNS and ensures that the removed one has been propagated.

domains.txt is self-explanatory - has all the (removed) domains listed, one per line.


while ($true){ foreach ($dns in get-content .\domains.txt) 
if (Resolve-DnsName -type NS $dns | findstr /i "dns.ap") { } else { Write-host "$dns no AP" } 
}

 start-sleep -s 120

 }

Tuesday, June 02, 2015

wmic: Getting process (and arguments!) in a remote server

wmic can be very convenient to obtain information about the processes running on a remote server.

I downloaded a VM from dev.modern.ie/tools/vms for testing. (It's valid only for 30 days and doesn't permit to be licensed!) and have been testing it.

A curious question came in - how to find remote processes in a windows PC using wmic? How will you get the complete arguments?

C:\>wmic /node:ie8winxp /user:IE8WINXP\Administrator /password:Passw0rd! /output:stdout process list /format:htable " > c:\temp.html
"

Note that the redirection above will be to local desktop's c:\temp.html, not remote c:\temp.html

If you wish to redirect to an internal file in the remote PC, you can simply save the command in the remote host and call it.

Sample: 

Save the below as a file, say c:\temp\1.bat

wmic process list /format:htable > c:\temp.html

Call it using :

C:\>wmic /node:ie8winxp /user:IE8WINXP\Administrator /password:Passw0rd! process call create "C:\temp\1.bat"

Examples at : http://ss64.com/nt/wmic.html

And more at: http://blogs.technet.com/b/jhoward/archive/2005/02/23/378726.aspx

Simple bash scripts (work in progress!)

Have been focussing on scripting bash programs and managed to write some scripts.

A simple script to replace softlinks with target files:



          $ for i in `find . -type l -print`; do

          mv -v $(readlink $i) $i

          done
You can, replace `` with $(). Also, include $i in quotes as well if you wish.
Source: www.shellcheck.net

Friday, May 08, 2015

Powershell v3: How to check if a PC is up for > 30 days

step 1- Check uptime. If > 30 days, then go for step 2; else exit step 2- Check if desktop is unlocked. If yes, popup saying it will be rebooted in next 24 hours. If locked, exit step 3- reboot
Is that accurate? Can be do in powershell.
$computer = "<Computer name>"
 if (Test-Connection $computer -Count 2 -Quiet) {

try {

     $user = $null

     $user = gwmi -Class win32_computersystem -ComputerName $computer | select -ExpandProperty username -ErrorAction Stop
     }
 catch { Write-Host "Not logged on"; return }
 try {
     if ((Get-Process logonui -ComputerName $computer -ErrorAction Stop) -and ($user)) {
        Write-Host "Workstation locked by $user"
         }
     }
 catch { if ($user) 
 { 
Write-Host "$user logged on" 
   $wmi = Get-WmiObject -ComputerName $computer -Query "SELECT LastBootUpTime FROM Win32_OperatingSystem"

$now = Get-Date

$boottime = $wmi.ConvertToDateTime($wmi.LastBootUpTime)

$uptime = $now - $boottime

$d =$uptime.days

$h =$uptime.hours

$m =$uptime.Minutes

$s = $uptime.Seconds
# above h/m/s are optional, but good to have!
if ($d -gt 30) { 
 Write-Host "Greather than 30 days" 
 # call shutdown tool here or do other activities

 } 
else { Write-Host "Less than 30 days" }

} }

}

 else { Write-Host "$computer Offline" }

Linux/Bash: How to report the CPU/ memory usage per user.

for user in `ps -aef | awk '{print $1}' | sort -k1 | uniq | grep -v UID`; do
procs=$(ps -u $user -o user,comm,vsz | wc -l) ;
echo -en $user " : Memory in KiB : " $(ps -u $user -o user,cmd,vsz | grep -v grep | awk 'BEGIN{s=0;} {s=s+$NF;}END{print s/1024}'); echo "" ;
echo -en $user " : CPU% : " $(ps -u $user -eo %cpu | grep -v grep | awk 'BEGIN{s=0;} {s=s+$NF;}END{print s}'); echo "" ;
done

Another method I learnt was:


ps -eo %cpu=,vsz=,user= |

awk '{ cpu[$3]+=$1; vsz[$3]+=$2 } END { for (user in cpu) printf("%-10s : Memory %10.1f KiB, CPU%%: %4.1f\n", user, vsz[user]/1024, cpu[user]); }'

OR



LC_ALL=C ps -eo %cpu=,vsz=,user= |

awk '{ cpu[$3]+=$1; vsz[$3]+=$2 } END { for (user in cpu) printf("%-10s : Memory %10.1f KiB, CPU%%: %4.1f\n", user, vsz[user]/1024, cpu[user]); }'




And finally:



ps axro "pid,%cpu,ucomm" | awk 'FNR>1' | head -n 3 | awk '{ printf "%5.1f%%,%s,%s",$2,$3,$1 }


ps axo "rss,pid,ucomm" | sort -nr | head -n3 | awk ‘{ printf "%8.0f MB,%s,%s",$1/1024,$3,$2 }