File Conversion
Math and Programming PDF Conversion - https://www.willus.com/k2pdfopt/
VisiData
Columns
Columns
Shift-C
c<colname> column search
_ increase column width
z- decrease column with
SHIFT-H/L move columns
Shift-F - Frequency
SHIFT-U/R - Undo Redo
/ - search g/ search all columns
Shift+S - Sheets sheet
Shift-J/K - Move the row down/up
e - Edit row
s, u, t - Select Unselect Toggle Selected Row
Filter
| furniture "
Pivot Tables
Shift-W
! on two columns then gF would show the frequency
Summary
Shift-i
Save
CTRL-s
GnuPlot
== Line Chart ==
- file runtime 1,2 columns to line chart
- plot "runtime" using 1:2 with lines
- plot file.csv (assuming you have two columns in this file)
- plot file.csv title "my plot" linetype 7 linecolot 0 with linepoints
- plot file.csv title "my plot" linetype 7 linecolot 0
- plot file.csv title "my plot" linetype 7 linecolot 0, sin(x) # can plot multiple plots
- set xrange [-1:13]
== X, Y Labels ==
- set xlabel "time in sec"
- set ylabel "water level meters"
== Multiple Plots ==
- plot sin(x), x, x-(x**3)/6
- plot "prices" using 1:2, "prices" using 1:3
VIM
VIM Moved to quip
VIM CheatSheet MIT - https://missing.csail.mit.edu/2020/editors/
MACRO
qa<commands>q # record marco for a
@a # replay a
Configuration file to use with vim ~/.vimrc configuration https://github.com/changemewtf/no_plugins
" .vimrc
" No need to support old vi.
set nocompatible
syntax enable
filetype plugin on
" Finding files.
set path +=**
set wildmenu
File Browsing
:find someFi<TAB> # => and it would recursivley auto complete the file and it's path.
:find ./SomeFolder/src<TAB> # => goto specific files
:find *.yaml<TAB> # => then shift tab tab
:ls # => files which were already opened recent files.
:b SomeFile.ja # => just type some of the file it would jump to it. if not unique <TAB>
Autocomplete
^n --> next autocomplete
^p --> prev autocomplete
^x^n --> auto complete from this file only.
^x^f --> Autocomplete file names.
^x^] -> Autocomplete tags only.
File Navigation
22gg goto line 22
w next word
b previous word
^v multi cursor
:PlugInstall actually install plugins in .vimrc
CTRL-] # => Jump to definition - like ctrl click IDE you must first run ctags -R . on dir
CTRL-t # => Jump back tag
g-CTRL-] # => List Jump to definitions.
GIT
git switch -C master origin/master # => new replacing git reset --hard origin/mainline
for d in $(ls); do cd $d && git diff origin/mainline > ~/tmp/2020-04-07-10-15-${PWD##*/}.diff && cd ..;done; # => Create diff for each directory with current directory name
CSVKIT
# CSVKIT
-t # => it's a tsv file
csvformat --out-tabs in.csv > out.tsv # comma to tab
csvcut -t -n in.tsv # print header column names -t means tab
csvcut -t -c col1, col2 data.csv # select subset of columns
in2csv in.xlsx | csvformat --out-tabs > out.tsv # excel to tsv
# Concat csv
csvstack -t *.tsv > all.tsv
# csvjoin
csvjoin -t -c col1 file1.tsv file2.tsv > out.csv
# csvsql
csvsql --query "select col1, ('http://url/'||col2) as url, col3 from test1 where col3 is not null" test1.tsv
csvsql --query "select col1,case when col2 not null then col2 else col3 end from mydata" mydata.csv
# Loop
for d in $(ls); do cd $d && git checkout master && cd ..; done; # => for each directory checkout master
# Base64
base64 -D < ~/tmp/in.txt > ~/tmp/out.txt # => Decode base64
# SED
sed 's#any text to replace here#replace with#g' in.csv > out.csv
# PBCOPY
cat file.csv | pbcopy # clipboard
echo `pbpaste`
# iconv
iconv -f latin1 -t utf-8 in.csv > out.csv # latin1 to utf8
# sqlite
sqlite> .mode csv (or .mode tab or .separator \t)
sqlite> .header on
sqlite> .import weight.csv weight
sqlite> .import person.csv person
sqlite> select * from person, weight where person.ID = weight.ID;
ID,sex,ID,weight
123,M,123,200
789,F,789,155
sqlite>
export to csv
.headers on
.mode csv
.output out.csv
select * from eS1100_sensor_results;
back to console
.output
save as sql db
sqlite> .save mydb.db
week of year
select strftime('%W',some_timestamp_col) from mytable limit 5;
- row_num in sqlite where has to be in another select https://www.db-fiddle.com/f/9oqXnKpBpLacdcom3LDW5K/0
# resources
https://www.mankier.com/1p/awk
csvgrep
csvsql
# tmux
enable mouse scrolling - ^b + : and enter following: setw -g mouse on
# useful command line tools
- fish
- vimium - control browser with vi commadns!
-- fish_config (run it)
- install fzf on fish for better search history
- broot
- tmux
# awk
- https://ferd.ca/awk-in-20-minutes.html
# ffmpeg
ffmpeg -i in.mov -pix_fmt rgb24 -r 10 -s 1024x768 out.gif #=> to moving gif.