Browse Source

here we go

jackyalcine 1 year ago
parent
commit
5f1cb47044
Signed by: Jacky Alciné <yo@jacky.wtf> GPG Key ID: 36CD7728BDFD66FF

+ 0
- 4
.gitignore View File

@@ -1,4 +1,3 @@
1
-home/.bash/*.d/99_*.sh
2 1
 # Created by https://www.gitignore.io/api/vim
3 2
 
4 3
 ### Vim ###
@@ -8,6 +7,3 @@ home/.bash/*.d/99_*.sh
8 7
 Session.vim
9 8
 .netrwhist
10 9
 *~
11
-
12
-home/.bashrc
13
-home/.zsh/zplug

+ 0
- 3
.gitmodules View File

@@ -1,3 +0,0 @@
1
-[submodule "home/.zsh/zplug"]
2
-	path = home/.zsh/zplug
3
-	url = https://github.com/zplug/zplug.git

+ 7
- 0
home/.zsh/local/anyenv/anyenv.plugin.zsh View File

@@ -0,0 +1,7 @@
1
+if [ ! -x anyenv ]; then
2
+  export PATH="$HOME/.anyenv/bin:$PATH"
3
+fi
4
+
5
+eval "$(anyenv init -)"
6
+
7
+export PATH="$HOME/.mix/escripts:$PATH"

+ 14
- 0
home/.zsh/local/common/common.plugin.zsh View File

@@ -0,0 +1,14 @@
1
+alias mk='make'
2
+alias _='sudo'
3
+alias irc='WEECHAT_PASSPHRASE=$(pass Applications/Weechat) weechat'
4
+alias ..='cd ..'
5
+alias ...='cd ../..'
6
+alias make-ssh-key='ssh-keygen -o -a 100 -t ed25519'
7
+alias httpserve='python -m SimpleHTTPServer'
8
+
9
+export PATH=$HOME/.local/bin:$PATH
10
+
11
+mkcd () {
12
+  mkdir -p "${1}";
13
+  cd "${1}";
14
+}

+ 5
- 0
home/.zsh/local/direnv/README.markdown View File

@@ -0,0 +1,5 @@
1
+# direnv
2
+
3
+This provides the hook needed to use with [`direnv`][1].
4
+
5
+[1]: https://github.com/direnv/direnv

+ 4
- 0
home/.zsh/local/direnv/direnv.plugin.zsh View File

@@ -0,0 +1,4 @@
1
+#!/usr/bin/env zsh
2
+
3
+# Load direnv for use.
4
+eval "$(direnv hook zsh)"

+ 1
- 0
home/.zsh/local/docker-compose/docker-compose.zsh View File

@@ -0,0 +1 @@
1
+alias dc_up="docker-compose up --build -d; docker-compose logs --tail=all --follow";

+ 3
- 0
home/.zsh/local/dokku/dokku.plugin.zsh View File

@@ -0,0 +1,3 @@
1
+#!/usr/bin/env zsh
2
+
3
+source ~/.dokku/contrib/dokku_client.sh

+ 1
- 0
home/.zsh/local/evm/evm.plugin.zsh View File

@@ -0,0 +1 @@
1
+source ~/.evm/scripts/evm

+ 9
- 0
home/.zsh/local/exenv/exenv.plugin.zsh View File

@@ -0,0 +1,9 @@
1
+function exenv_prompt_info()
2
+{
3
+  echo "$(exenv version | cut -f 1 -d ' ')"
4
+}
5
+
6
+function prompt_exenv()
7
+{
8
+  echo $(exenv_prompot_info)
9
+}

+ 1
- 0
home/.zsh/local/fzf/fzf.plugin.zsh View File

@@ -0,0 +1 @@
1
+source ~/.fzf.zsh

+ 5
- 0
home/.zsh/local/homeshick/homeshick.plugin.zsh View File

@@ -0,0 +1,5 @@
1
+#!/usr/bin/env zsh
2
+
3
+source ~/.homesick/repos/homeshick/homeshick.sh
4
+
5
+alias hsh=homeshick

+ 12
- 0
home/.zsh/local/kde/kde.plugin.zsh View File

@@ -0,0 +1,12 @@
1
+KF5=/opt/kde
2
+QTDIR=/usr
3
+CMAKE_PREFIX_PATH=$KF5:$CMAKE_PREFIX_PATH
4
+XDG_DATA_DIRS=$KF5/share:$XDG_DATA_DIRS:/usr/share
5
+XDG_CONFIG_DIRS=$KF5/etc/xdg:$XDG_CONFIG_DIRS:/etc/xdg
6
+PATH=$KF5/bin:$QTDIR/bin:$PATH
7
+QT_PLUGIN_PATH=$KF5/lib/plugins:$KF5/lib64/plugins:$KF5/lib/x86_64-linux-gnu/plugins:$QTDIR/plugins:$QT_PLUGIN_PATH
8
+QML2_IMPORT_PATH=$KF5/lib/qml:$KF5/lib64/qml:$KF5/lib/x86_64-linux-gnu/qml:$QTDIR/qml
9
+QML_IMPORT_PATH=$QML2_IMPORT_PATH
10
+KDE_SESSION_VERSION=5
11
+KDE_FULL_SESSION=true
12
+SASL_PATH=/usr/lib/sasl2:$KF5/lib/sasl2

+ 52
- 0
home/.zsh/local/keychain/keychain.plugin.zsh View File

@@ -0,0 +1,52 @@
1
+#!/usr/bin/env zsh
2
+#
3
+# This makes it easy for me to use to Keychain[1]
4
+#
5
+# [1]: https://www.funtoo.org/Keychain
6
+typeset keychain
7
+
8
+function keychain_load() {
9
+  # shellcheck disable=SC2086,SC2038,SC2154,SC2086
10
+  eval "$(keychain --quiet --attempts 3 --inherit any-once --eval --agents ssh,gpg --ignore-missing $KEYCHAIN_GPG_KEYS)";
11
+
12
+  for key in $(find $HOME/.ssh/keys -type f -name "*.pem" | xargs)
13
+  do
14
+    declare passPath=$(basename $(dirname ${key}))
15
+    declare passDir=$(basename -s .pem "${key}")
16
+
17
+    echo "[keychain] Importing SSH key '${passPath}/${passDir}'...";
18
+    pass show "ssh${KEYCHAIN_PASSWORD_PREFIX:-}/${passPath}/${passDir}" | ssh-add "${key}" 2>~/.keychain/startup_err.log >~/.keychain/startup.log
19
+  done
20
+}
21
+
22
+function keychain_source() {
23
+  . "$HOME/.keychain/$HOST-sh" 2>/dev/null
24
+  . "$HOME/.keychain/$HOST-sh-gpg" 2>/dev/null
25
+}
26
+
27
+function keychain_wipe() {
28
+  keychain --stop all --quiet --agents gpg,ssh;
29
+  if [ -f "$HOME/.keychain/$HOST-sh" ]; then
30
+    rm -rvf "$HOME/.keychain/$HOST*" && echo "[keychain] All clear on env.";
31
+  else
32
+    echo "[keychain] Nothing to wipe for ${HOST}"
33
+  fi
34
+}
35
+
36
+function () {
37
+  declare expected_keychain_path="$HOME/.keychain/${HOST}-sh"
38
+  echo "[keychain] Scanning for keys..."
39
+
40
+  if [ -e "${expected_keychain_path}" ]; then
41
+    keychain_source
42
+    ps x | grep ssh-agent | grep -q $SSH_AGENT_PID || {
43
+        echo "[keychain] Stale keychain found; resetting session..."
44
+        keychain_wipe
45
+        return
46
+    }
47
+  else
48
+    keychain_load
49
+  fi
50
+
51
+  echo "[keychain] Found active session with $(ssh-add -l | wc -l) SSH keys and $(gpg --list-secret-keys | grep 'sec' | wc -l) GPG secret keys."
52
+}

+ 1
- 0
home/.zsh/local/travis-ci/travis-ci.sh View File

@@ -0,0 +1 @@
1
+[ -f /home/ayize/.travis/travis.sh ] && source /home/ayize/.travis/travis.sh

+ 62
- 0
home/.zsh/local/twitter/twitter.plugin.zsh View File

@@ -0,0 +1,62 @@
1
+# From https://gist.github.com/brianloveswords/7534169715b5750a892cddcf54c2aa0e
2
+# Thanks.
3
+
4
+function video-url-from-tweet() {
5
+    if [ "$1" ]; then
6
+        url=$1
7
+    else
8
+        echo "Must provide a url"
9
+        return 1
10
+    fi
11
+
12
+    curl --silent $url |\
13
+        # should find the <meta> tag with content="<thumbnail url>"
14
+        (grep -m1 "tweet_video_thumb" ||\
15
+          echo "Could not find video" && return 1) |\
16
+
17
+        # from: <meta property="og:image" content="https://pbs.twimg.com/tweet_video_thumb/xxxxxxxxxx.jpg">
18
+        # to: https://pbs.twimg.com/tweet_video_thumb/xxxxxxxxxx.jpg
19
+        cut -d '"' -f 4 |\
20
+
21
+        # from: https://pbs.twimg.com/tweet_video_thumb/xxxxxxxxxx.jpg
22
+        # to: https://video.twimg.com/tweet_video/xxxxxxxxxx.mp4
23
+        sed 's/.jpg/.mp4/g' |\
24
+        sed 's/pbs.twimg.com\/tweet_video_thumb/video.twimg.com\/tweet_video/g'
25
+}
26
+
27
+function video-from-tweet() {
28
+    if [ "$1" ]; then
29
+        url=$1
30
+    else
31
+        echo "Must provide a url"
32
+        return 1
33
+    fi
34
+    curl $(video-url-from-tweet $url)
35
+}
36
+
37
+function video-to-gif() {
38
+    # derived from https://engineering.giphy.com/how-to-make-gifs-with-ffmpeg/
39
+    if [ "$2" ]; then
40
+        input=$1
41
+        output=$2
42
+    else
43
+        echo "Must provide an input file and output file"
44
+        return 1
45
+    fi
46
+
47
+    ffmpeg -i $input \
48
+           -filter_complex "[0:v] split [a][b];[a] palettegen [p];[b][p] paletteuse" \
49
+           -f gif \
50
+           $output
51
+}
52
+
53
+function gif-from-tweet() {
54
+    if [ "$2" ]; then
55
+        url=$1
56
+        output=$2
57
+    else
58
+        echo "Must provide a url and an output filename"
59
+        return 1
60
+    fi
61
+    video-from-tweet $url | video-to-gif - $output
62
+}

Loading…
Cancel
Save