1
0
mirror of https://github.com/aquatix/dotfiles.git synced 2025-12-06 20:35:11 +01:00

Merge branch 'master' of github.com:aquatix/dotfiles

This commit is contained in:
2018-04-04 16:10:02 +02:00
17 changed files with 304 additions and 41 deletions

12
bin/clean_project Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
read -p "Close vim and stop running (Python) processes. Type 'c' to continue after doing so, any other key to abort. " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Cc]$ ]]
then
# do semi-dangerous stuff
find . -name "*.pyc" -type f -delete
find . -name "*.swp" -type f -delete
find . -name "*.swo" -type f -delete
else
echo "aborted"
fi

21
bin/fuz Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Taken from https://medium.com/adorableio/simple-note-taking-with-fzf-and-vim-2a647a39cfa
set -e
main() {
previous_file="$1"
file_to_edit=`select_file $previous_file`
if [ -n "$file_to_edit" ] ; then
"${EDITOR:-vim}" "$file_to_edit"
main "$file_to_edit"
fi
}
select_file() {
given_file="$1"
fzf --preview="cat {}" --preview-window=right:70%:wrap --query="$given_file"
}
main ""

View File

@@ -2,18 +2,13 @@
if [ -n "$1" ]; then
FIRSTFILE=$1
#echo $!
GITDIR=$(dirname ${FIRSTFILE})
#echo $GITDIR
cd $GITDIR
DATETIME=`date +%Y%m%d\ %H:%M:%S`
#echo $DATETIME
GITDIR=$(dirname "${FIRSTFILE}")
cd "$GITDIR" || exit
DATETIME=$(date +%Y%m%d\ %H:%M:%S)
#git pull
RESULT=`git commit $* -m "Autosave at $DATETIME"`
echo $RESULT
RESULT=$(git commit $* -m "Autosave at $DATETIME")
echo "$RESULT"
#zenity --info --text=$RESULT
#echo $?
#echo "git commit $* -m 'Autosave at $DATETIME'"
git push
else

33
bin/logfileinfo Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env python3
from urllib.parse import urlparse
domains = {}
privacy_domains = {}
#with open('consent_20180227_1055.log', encoding='latin1') as pf:
with open('logfile.log') as pf:
logdata = pf.readlines()
for line in logdata:
url = line.split(' ')[10]
url = url[1:-1] # Strip quotes
domain = urlparse(url).netloc
if domain not in domains:
domains[domain] = 0
domains[domain] += 1
url = line.split(' ')[6]
#print(url)
domain = urlparse(url).netloc
if domain not in privacy_domains:
privacy_domains[domain] = 0
privacy_domains[domain] += 1
print('== Referrers ======')
for key in sorted(domains, key=domains.__getitem__, reverse=True):
print('{:6} {}'.format(domains[key], key))
print()
print('== Domains ======')
for key in sorted(privacy_domains, key=privacy_domains.__getitem__, reverse=True):
print('{:6} {}'.format(privacy_domains[key], key))

View File

@@ -2,4 +2,4 @@
cd ~/mydocs/work/sanoma
git pull
#vim -c ":vsp planning_2015.todo" notes_2015.md notes_2014.md
vim -c "set nofoldenable" planning_2017.todo cs_notes.md cs_howtos.md dcp_notes.md dcp_howtos.md
vim -c "set nofoldenable" planning_2018.todo cs_notes.md cs_howtos.md dcp_notes.md dcp_howtos.md planning_2017.todo