Skip to content

Instantly share code, notes, and snippets.

View Jan-Zeiseweis's full-sized avatar

Jan Zeiseweis Jan-Zeiseweis

View GitHub Profile
@Jan-Zeiseweis
Jan-Zeiseweis / mark_watched.js
Last active September 19, 2018 14:03
yt marked watched
// ==UserScript==
// @name Marked watched videos
// @namespace deKexx
// @description Mark watched videos on Youtube
// @include http://www.youtube.com/watch*
// @include https://www.youtube.com/watch*
// @connect popo.local
// @author Jan Zeiseweis
// @version 0.1
// @grant GM_xmlhttpRequest
@Jan-Zeiseweis
Jan-Zeiseweis / 00-load.py
Created October 18, 2017 12:22
Pandas create dataframe from clipboard
import pandas as pd
def clipboard_to_dataframe():
"""
Parses tables in the format:
| Col1 | Col2 |
-------------------
| 1111 | abcdefgh |
| 2222 | abcdefgj |
-------------------
@Jan-Zeiseweis
Jan-Zeiseweis / date_user_defined_functions_redshift.sql
Last active August 8, 2020 14:40
User defined python functions for date dimensions in redshift
create or replace function f_sk_date (ts timestamp )
returns integer
stable as $$
if not ts:
return None
return int(str(ts)[0:10].replace('-',''))
$$ language plpythonu;
create or replace function f_date (ts timestamp)
returns date
@Jan-Zeiseweis
Jan-Zeiseweis / unzip_rm_zip_md5_sum_rm_dups.sh
Created September 14, 2015 17:17
Unzip all zip files in a directory and remove unzipped file if a file with the same md5checksum already unzipped
#!/bin/bash
declare -A arr
for zip_file in *.zip; do
unzip -q $zip_file && rm $zip_file
file=${zip_file%.zip}
read cksm _ < <(md5sum "$file")
if ((arr[$cksm]++)); then
echo "rm $file"
rm $file
fi
@Jan-Zeiseweis
Jan-Zeiseweis / split_and_gzip.sh
Last active September 14, 2015 17:15
split and gzip bash script
#!/bin/bash -e
# usage: bash ./split_and_gzip.sh file.txt
FILE=$1
LINES_PER_FILE=10000000 #10m
$(split -l $LINES_PER_FILE -d $FILE ${FILE}.)
FILES=${FILE}.*