Wednesday, March 6, 2019
Monday, February 18, 2019
running graphical applications without desktop env
- install linux w/ desktop environment
- start run level 3
- $ X &
- $ DISPLAY=:0 google-chrome
- "You can switch from the X server and the framebuffer by using CTRL+ALT+F1 and CTRL+ALT+F7"
https://superuser.com/questions/407043/is-it-possible-to-run-graphical-applications-such-as-firefox-without-installing
Tuesday, January 1, 2019
save / print pdf without margin
Why?
pdf, including ones at research site ssrn, in general have huge margin. when you wanna print 2 pages per sheet, the text become smaller with a lot of unnecessary white space for the margin
What do you need?
pdfcrop, which is available at ubuntu, but not centos7 afaik at the time of writing
How?
pdfcrop -h
pdfcrop <input.pdf> <output.pdf>
Appendix:
What if you don't have ubuntu?
if you have centos7 running on virtualbox with windows host, here's what I did:
pdf, including ones at research site ssrn, in general have huge margin. when you wanna print 2 pages per sheet, the text become smaller with a lot of unnecessary white space for the margin
What do you need?
pdfcrop, which is available at ubuntu, but not centos7 afaik at the time of writing
How?
pdfcrop -h
pdfcrop <input.pdf> <output.pdf>
Appendix:
What if you don't have ubuntu?
if you have centos7 running on virtualbox with windows host, here's what I did:
- download ubuntu 18 desktop installation iso
- Virtualbox, existing vm, storage, optical drive
- select the downloaded iso
- check Live CD/DVD box
- start VM
- choose "Try ubuntu" after it boots from disc
- Follow https://askubuntu.com/questions/378558/unable-to-locate-package-while-trying-to-install-packages-with-apt to update package download source
- Open a terminal in ubuntu
- sudo apt-get install texlive-extra-utils
- pdfcrop <input.pdf> <output.pdf>
- ubuntu map windows host's shared drive
- netstat -nr to see window host's ip address from ubuntu
- ubuntu "Files" app, which has a folder icon
- connect to Server by entering smb://<windows ip>
- drag and drop <output.pdf> to shared folder
Monday, December 17, 2018
Where is the source file of an imported module?
from PackageABC.ParentModule import ChildModule
import inspect
print(inspect.getsourcefile(ChildModule))
#which would be in one of these paths
import sys
for p in sys.path:
print(p)
import inspect
print(inspect.getsourcefile(ChildModule))
#which would be in one of these paths
import sys
for p in sys.path:
print(p)
Monday, March 27, 2017
kdb schema idea for market depth from bid ask streams
select lUnixts:last unixts, vwap:siz wavg price, desc price, siz idesc price, siz by unixts, sym from lp where side=`BID
basically, for each timetamp, sym, there's a list of prices, the corresponding list of size, liquidity provider, etc.
see http://code.kx.com/wiki/Cookbook/ProgrammingIdioms#How_do_I_extract_regular-size_vwap_series.3F for explanation
FD whitepapers:
basically, for each timetamp, sym, there's a list of prices, the corresponding list of size, liquidity provider, etc.
see http://code.kx.com/wiki/Cookbook/ProgrammingIdioms#How_do_I_extract_regular-size_vwap_series.3F for explanation
FD whitepapers:
- http://code.kx.com/qref/wp/sample_aggregation_engine_for_market_depth.pdf
- http://code.kx.com/pages/db/DB_Order_Book_a_kdb+_Intra-Day_Storage_and_Access_Methodology.pdf
Sunday, March 26, 2017
How to select the row value associated with the max / min of a column?
http://code.kx.com/wiki/Cookbook/ProgrammingIdioms#How_can_I_extract_the_time_of_the_lowest_and_highest_prices.3F
Thursday, November 3, 2016
one way to pivot table
trade table:
stock side amount
----------------------
`ibm b 100
`ibm s 200
`appl b 300
-- sql server syntax
select stock, sum(iif(side='b', amount, 0)) as b, sum(iif(side='s', amount, 0)) as s
from trade
group by stock;
stock b s
------------------
`ibm 100 200
`aapl 300 0
stock side amount
----------------------
`ibm b 100
`ibm s 200
`appl b 300
-- sql server syntax
select stock, sum(iif(side='b', amount, 0)) as b, sum(iif(side='s', amount, 0)) as s
from trade
group by stock;
stock b s
------------------
`ibm 100 200
`aapl 300 0
Subscribe to:
Posts (Atom)