in2csv file1.xls > file1.csv
in2csv -f fixed -s schema.csv data.fixed > data.csv
csvgrep -c phone_number -r "\d{3}-123-\d{4}" data.csv > matching.csv
SELECT * FROM table | |
WHERE _ROWID_ >= (abs(random()) % (SELECT max(_ROWID_) FROM table)) | |
LIMIT 1 |
# script stolen from http://goo.gl/YbQyAQ | |
# install.packages("tm") | |
# install.packages("ggplot2") | |
# install.packages("lsa") | |
# install.packages("scatterplot3d") | |
#install.packages("SnowballC") | |
#if !(require('SnowballC')) then install.packages("SnowballC") | |
library(tm) | |
library(ggplot2) |
""" | |
Specifically, the Kullback–Leibler divergence from Q to P, denoted DKL(P‖Q), is | |
a measure of the information gained when one revises one's beliefs from the | |
prior probability distribution Q to the posterior probability distribution P. In | |
other words, it is the amount of information lost when Q is used to approximate | |
P. | |
""" | |
import numpy as np | |
from scipy.stats import entropy |
minmax_scaler <- function(x, a, b) { | |
" | |
x: data. numeric vector of values to be scaled | |
a: desired minimum after scaling takes place | |
b: desired maximum after scaling takes place | |
e.g. f(c(1,2,3,4), 1, 17) | |
[1] 1.000000 6.333333 11.666667 17.000000 | |
" | |
(((b - a)*(x - min(x))) / (max(x) - min(x))) + a |
library(tidyverse) | |
airquality %>% | |
group_by(Month) %>% | |
summarise(average_temperature = mean(Temp)) %>% | |
ggplot(aes(x=Month, y=average_temperature)) + | |
geom_bar(stat='identity', position = 'dodge') + | |
geom_text(aes(label=round(average_temperature, 0)), position=position_dodge(width=0.9), vjust=-0.5) + | |
labs(x='Month', y='Average temperature', title='Average temperature per month') + | |
theme_minimal() + | |
theme(plot.background = element_blank(), |
Map | Action |
---|---|
<F1> | Causes Netrw to issue help |
<cr> | Netrw will enter the directory or read the file |
<del> | Netrw will attempt to remove the file/directory |
- | Makes Netrw go up one directory |
a | Toggles between normal display, hiding (suppress display of files matching g:netrw_list_hide) showing (display only files which match g:netrw_list_hide) |
c | Make browsing directory the current directory |
C | Setting the editing window |
d | Make a directory |
""" | |
Simple utility command line tool to list the sheet names of an Excel workbook. | |
""" | |
import argparse | |
from xlrd import open_workbook | |
def get_args(): | |
"""This function parses and return command line arguments""" | |
parser = argparse.ArgumentParser(description='List sheetnames in Excel workbook.') |
import os | |
import click | |
def read_file(filename): | |
with open(filename) as in_file: | |
for line in in_file: | |
if line.strip() != '': | |
yield line.strip() |
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
# Install kernel extra's to enable docker aufs support | |
# sudo apt-get -y install linux-image-extra-$(uname -r) | |
# Add Docker PPA and install latest version | |
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |