Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Sunday, November 1, 2020

Install without root access / for current user

 You can use conda to install mysql client!

https://stackoverflow.com/questions/36651091/how-to-install-packages-in-linux-centos-without-root-user-with-automatic-depen/52561058#52561058

Thursday, October 29, 2020

recreate / cloning conda env with limited internet access

  • https://www.anaconda.com/blog/moving-conda-environments
  • https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

Thursday, April 30, 2020

send email html content with inline image


  • preferred way:
    • script to generate html content with image encoded as base64 text
      • <img src='data:imag/png;base64,....'/>
      • base64.b64encode().decode("ascii") to get that ... string from image
    • single html file to include all the html and images, etc. 😀
    • cat that html and pipe to mutt -e "set content_type=text/html" to send the email

Tuesday, March 3, 2020

url to pdf on linux

yum install wkhtmltopdf
To manipulate the pdfs, use pdfunite / pdfseparate from
yum install poppler-utils

Saturday, December 28, 2019

centos minimal

install centos 8 minimal

install google-chrome from google repo, which should install all the X dependencies

additional language support for web page display
> yum groupinstall Fonts

To start chrome full screen
> X& DISPLAY=:0 google-chrome --window-size=1920,1080&

if sound is not already working,
> yum install alsa-utils
unmute everything with
> alsamixer
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture#Disabling_auto_mute_on_startup



Monday, February 18, 2019

running graphical applications without desktop env


  1. install linux w/ desktop environment
  2. start run level 3
  3. $ X &
  4. $ DISPLAY=:0 google-chrome
  5. "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:

  1. download ubuntu 18 desktop installation iso
  2. Virtualbox, existing vm, storage, optical drive
    1. select the downloaded iso
    2. check Live CD/DVD box
  3. start VM
  4. choose "Try ubuntu" after it boots from disc
  5. Follow https://askubuntu.com/questions/378558/unable-to-locate-package-while-trying-to-install-packages-with-apt to update package download source
  6. Open a terminal in ubuntu
    1. sudo apt-get install texlive-extra-utils
    2. pdfcrop <input.pdf> <output.pdf>
  7. ubuntu map windows host's shared drive
    1. netstat -nr to see window host's ip address from ubuntu
    2. ubuntu "Files" app, which has a folder icon
    3. connect to Server by entering smb://<windows ip>
  8. drag and drop <output.pdf> to shared folder

Friday, February 12, 2016

putty ssh X11 forwarding not working?

have you installed xorg-x11-xauth at the server?  (Thanks to http://praveen.kumar.in/2006/11/15/xorg-x11-xauth-needed-for-ssh-x-forwarding-to-work/)

how to allow remote server to access my local resource via ssh tunnel?

Sunday, January 31, 2016

How to install additional kernel to ipython / jupyter?

Assuming you already have python 3 and ipython installed with anaconda,

Create python 2.7 env
$ conda create -n py27 python=2.7

Activate the env
$ source activate py27

Install ipykernel
$ conda install notebook ipykernel

Write kernel spec
$ ipython kernelspec install-self --user
which should write to ~/.local/share/jupyter/kernels/python2

Deactivate 2.7 env
$ source deactivate

link the kernel spec to the location where ipython will read
$ cd ~/.ipython/
$ ln -s ~/.local/share/jupyter/kernels/

Confirm now that we have additional kernel
$ ipython kernelspec list

Start ipython notebook and you should now have both kernels
$ ipython notebook --no-browser

Tuesday, December 8, 2015

setup linux vm in 64-bit Windows host without installation

Download binary from lassauge.free.fr/qemu and extract

Create a 40G hard disk by running
qemu-img create hd.img 40G

Install by Linux os with
qemu-system-x86_64 \
-drive file=hd.img,index=0,media=disk,format=raw \
-L Bios -m 1024 \
-cdrom fedora-install.iso


Start your vm with ssh port forwarded with
qemu-system-x86_64 \
-drive file=hd.img,index=0,media=disk,format=raw \
-L Bios -m 1024 \
-redirect tcp:2222::22

ssh -p 2222 localhost
to get to your vm

Tuesday, July 14, 2015

Wednesday, January 28, 2015

SQL database / stdout to kdb

// using mysql as an example
// perhaps a good way to just have parsed output (say from perl) to directly go into kdb

q)(::)test:("*TH"; enlist "\t") 0:system "mysql -u root -e 'select \"string\" str, time(now()) time, 99 short from dual' "
str      time         short
---------------------------
"string" 15:55:11.000 99  
 

q)meta test
c    | t f a
-----| -----
str  | C   
time | t   
short| h