This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
head -1 /dev/urandom | base64 -w0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- // How many events were created from date A to date B (possibly presenting data on a daily, weekly and monthly basis) | |
-- Replace 'week' with 'day' or 'month' | |
-- date_trunc takes: minute hour day week month quarter year | |
-- NB! TIMESTAMP '2013-09-16' == '2013-09-16 00:00:00' so BETWEEN includes only tickets sold until that date. | |
SELECT date_trunc('week', created_at) AS dt, count(*) AS total_events | |
FROM events | |
WHERE created_at BETWEEN TIMESTAMP '2013-06-16' AND TIMESTAMP '2013-09-16' | |
GROUP BY date_trunc('week', created_at) | |
-- // How many paid tickets were sold form date A to date B (presenting graphs on a day to day basis, weekly and monthly) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import inspect | |
class Argumentor: | |
def __init__(self, description=None): | |
self._parser = argparse.ArgumentParser(description=description) | |
self._subparsers = self._parser.add_subparsers() | |
def add(self, description={}): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for db in $(psql -t -X -h 192.168.132.111 -U postgres -d probedb -c 'SELECT erfstore_id FROM erfstores') ; do psql -X -h 192.168.132.111 -U postgres -d $db -f /build/trunk/dock/tree/customer/endace/src/bin/dbmgr/scripts/erfstoredb/da_breakdown_summary_sql.sql ; done | |
# Or slightly more readable: | |
export PGHOST=fin7000-4 | |
export PGDATABASE=probedb | |
export PGUSER=postgres | |
cd /ginkgo/trunk/ginkgo/tree/customer/endace/src/bin/dbmgr/scripts/erfstoredb/ | |
for db in $(psql -t -X -c 'SELECT erfstore_id FROM erfstores') erfstoredb ; do psql -X -d $db -f da_breakdown_summary_sql.sql ; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Creating the $LFS directory | |
... | |
# Create lfs user and the profile for it | |
... | |
sudo su - lfs | |
# Downloading packet source: | |
mkdir -vp $LFS/sources |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls -1 *tar* | xargs -P 8 -I{} tar xf {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# with sed: | |
sed -i '28d' ~/.ssh/known_hosts | |
# with ed: | |
ed -s ~/.ssh/known_hosts <<< $'28d\nw' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LANG=ko_KO.UTF-8 sed 's/\r$//; s/^\([^\t]*\)\t\([^\t]*\)$/\1\t\2\t/' set2.csv > set2_.csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# total storage size held by processes: | |
lsof /data | grep postgres | grep deleted | awk '{ SUM += $7} END {print SUM}' | |
# processes that hold inodes: | |
lsof /data -u postgres | grep "(deleted)" | tr -s ' ' | cut -d ' ' -f2 | sort -u | xargs ps -u -p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install.packages("RPostgreSQL") | |
# install.packages("zoo") | |
# Notes: EMA - Exponential moving average with alpha=0.05 | |
library(RPostgreSQL) | |
library(TTR) | |
drv <- dbDriver("PostgreSQL") | |
##con <- dbConnect(drv, dbname="probedb", user="postgres", host="192.168.132.111") | |
con <- dbConnect(drv, dbname="1", user="postgres", host="192.168.132.111") |