Skip to content

Instantly share code, notes, and snippets.

View tjirab's full-sized avatar
:shipit:

Bart Schuijt tjirab

:shipit:
  • Netherlands
View GitHub Profile
@tjirab
tjirab / docker-commands.sh
Last active July 1, 2021 20:00
Docker useful commands
# INFO
docker
docker info
# PROCESSES
docker ps -a # list processes
docker ps -l # most recent stopped container
# IMAGES
docker images # lists docker images
@tjirab
tjirab / snippets.hql
Created November 14, 2018 12:51
Apache Hive snippets
-- Current date PST
SELECT FROM_UTC_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP()),"PST");
@tjirab
tjirab / world_clock.sh
Last active November 1, 2018 19:52
Shell Tool(s)
#!/bin/sh
#
# World Clock
#
# Set up: place .sh in a folder; add alias to rc file;
# e.g. alias wt='~/sh/world_clock.sh'
#
# Access available time zones in /usr/share/zoneinfo
# To add a time zone, simply add to TIME_ZONES. For
# time zones directly in root folder, add with .,
import java.text.SimpleDateFormat
import java.util.{Calendar, Date}
/** Set date format */
val sdf = new SimpleDateFormat("yyyyMMdd")
/** Current date */
val calendar = Calendar.getInstance()
/** First day previous month */
# Parameters
FILES="file1 file2 file3 file4"
CURDATE=$(date +%Y%m%d)
SOURCE="/foo/bar/"
# Move files from eout to user dir
for FILE in $FILES; do
mv ${SOURCE}/${FILE} ${FILE}
done
@tjirab
tjirab / file-checks-and-mods.sh
Last active February 6, 2018 10:10
File checks and modifications
# Find occurance per character
sed 's/\(.\)/\1\n/g' file.txt | sort | uniq -c > char-occurance.txt
# Identify rows containing non-ASCII characters and redirecting to file
grep -P -n "[\x83-\xFF]" file.txt > file-non-ascii.txt
# Remove non-ASCII characters from file
LANG=C sed -i.bak -e 's/[\d128-\d255]//g' file.txt
# Delete header row