├── #ARCHCONFIG ├── README ├── bin │ ├── danbooru │ ├── dmenu │ ├── dtermite │ ├── dwbeditor │ ├── fat32strip │ ├── gitrup │ ├── listarchive │ ├── lnn │ ├── nicodl │ ├── nicoplay │ ├── openbooru │ ├── opendir │ ├── pacup │ ├── qtermite │ ├── relink │ ├── scrotwin │ ├── sspacman │ ├── stalonetrayd │ ├── svol │ ├── urlhandler │ └── wallhead ├── etc │ ├── X11 │ │ └── xorg.conf.d │ │ │ └── 20-nvidia.conf │ ├── asound.conf │ ├── cron.hourly │ │ └── pacman_update │ ├── fonts │ │ └── conf.d │ │ │ └── 70-no-ugly-fonts.conf │ ├── hostname │ ├── linopen.conf │ ├── locale.conf │ ├── mpd.conf │ ├── mpv │ │ └── mpv.conf │ ├── sysctl.d │ │ └── 99-sysctl.conf │ ├── systemd │ │ ├── bin │ │ │ ├── cpufreq.sh │ │ │ ├── hdparam.sh │ │ │ ├── powersave.sh │ │ │ ├── setterm.sh │ │ │ └── ssd-scheduler.sh │ │ └── system │ │ │ ├── autologin@.service │ │ │ ├── cpufreq-loli.service │ │ │ ├── hdparam-loli.service │ │ │ ├── powersave-loli.service │ │ │ ├── setterm-loli.service │ │ │ └── ssd-scheduler.service │ ├── vconsole.conf │ └── zathurarc ├── passwd │ ├── README │ ├── libpasswd-env │ └── libpasswd-sh ├── shell │ ├── LS_COLORS │ ├── README │ ├── alias │ ├── bashrc │ ├── functions │ ├── prezto │ │ └── modules │ │ │ └── prompt │ │ │ └── functions │ │ │ └── prompt_hack_setup │ ├── shellrc │ ├── zsh-syntax-highlighting-filetypes.zsh │ └── zshrc ├── toolsched │ ├── README │ ├── bin │ │ ├── cmake │ │ ├── git │ │ ├── make │ │ ├── mpd │ │ ├── mpv │ │ ├── pacman │ │ ├── rtorrent │ │ ├── steam │ │ └── wine │ ├── sched_idle │ ├── sched_iso │ ├── toolsched-env │ └── toolsched-lib ├── vim │ ├── README │ ├── bundle │ │ ├── cSyntaxPlus │ │ │ ├── README │ │ │ └── plugin │ │ │ │ └── cSyntaxPlus.vim │ │ └── colorshot │ │ │ └── colors │ │ │ └── colorshot.vim │ └── vimrc └── xcolors │ └── colorshot ├── .XCompose ├── .Xresources ├── .config ├── dwb │ ├── style.css │ └── userscripts │ │ ├── urlhandler.sh │ │ └── waai.sh ├── gtk-3.0 │ ├── gtk.css │ └── settings.ini └── termite │ └── config ├── .gtkrc-2.0 ├── .local └── share │ └── wine │ ├── handle-prefixes.sh │ ├── regs │ ├── colors.reg │ ├── disable-crash-dialog.reg │ ├── disable-strict-draw-order.reg │ ├── disable-winemenubuilder.reg │ ├── enable-always-offscreen.reg │ ├── enable-csmt.reg │ ├── enable-fakedisp.reg │ ├── enable-glsl.reg │ ├── quartz@ffxiv.reg │ └── report-vram.reg │ └── winetricks │ ├── d3dx9@ffxiv │ ├── devenum@ffxiv │ ├── ie8@ffxiv │ ├── quartz@ffxiv │ ├── winhttp@ffxiv │ ├── wininet@ffxiv │ ├── wmp10@ffxiv │ └── xact_jun2010@ffxiv ├── .newsbeuter ├── colors │ └── colorshot.theme └── config ├── .rtorrent.rc ├── .vimrc ├── .xinitrc ├── .ycm_extra_conf.py ├── .zshrc ├── README ├── bin └── ixio └── lib └── anime ├── bin ├── anime ├── hsanime ├── mkanime ├── mvanime ├── rsanime ├── tbanime └── upanime ├── envanime └── libanime /#ARCHCONFIG/README: -------------------------------------------------------------------------------- 1 | # 2 | # System configurations 3 | # 4 | 5 | All my edited system configuration files (in /) are stored here and symlinked 6 | to proper places. Package list contains packages for all packages needed for 7 | stuff in '/arch' to work. 8 | 9 | AUR and other sources are in '/arch/pkg' 10 | 11 | Packages is generated with: 12 | pacman -Q | grep -v "$(pacman -Qm)" > PACKAGES 13 | 14 | In addition I use these repositories (and pacakges): 15 | [repo-ck]: http://repo-ck.com/$arch 16 | - linux-ck-corex 17 | - nvidia-ck-corex 18 | 19 | GTK3 is needed by dwb. 20 | - GTK2 is buggy without composite extension 21 | - Composite extension causes tearing with Xv 22 | uim-mozc depends on Qt 23 | - However can be safely removed with -dd qt 24 | 25 | \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ 26 | 27 | Reminders? 28 | You should use ':set cc=80' more often. 29 | Move some tools to PKGBUILD's 30 | You have job, remember to sleep. 31 | 32 | \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ 33 | 34 | Additionally to these, I'm using the infinality patches (in /arch/pkg/pkgbuild) 35 | and custom fontconfig rule which is in '/arch/etc/fonts/conf.d'. 36 | 37 | Fonts: 38 | Terminus - Terminal 39 | DejaVu - Web browsing 40 | IPA - Japanese (high point size) 41 | Kochi - Japanese (terminal, xim) 42 | 43 | /arch/pkg/source/monsterwm: window manager 44 | Slightly modified monsterwm setup. Status and pager are seperate C programs. 45 | For more, refer to the sources itself. 46 | 47 | /arch/pkg/pkgbuild/xcmenu-git: clipboard manager 48 | meta-c: access clipboard history 49 | meta-shift-c: access clipboard url history 50 | alt-shift-c: sync XA_PRIMARY to XA_CLIPBOARD 51 | 52 | /arch/pkg/pkgbuild/linopen: xdg-open replacement 53 | Small handy xdg-open replacement. 54 | 55 | /arch/pkg/pkgbuild/scrot: patched scrot 56 | Scrot with geometry support. 57 | 58 | /arch/bin/dmenu: dmenu wrapper 59 | Sets defaults for arguments which was not passed 60 | to the wrapper. (fonts, colors) 61 | 62 | /arch/bin/dtermite: dtach for termite 63 | Run only one instance of termite with the program running dtached. If you 64 | close the termite and run dtermite with same arguments again, the session will 65 | continue where it left. 66 | 67 | /arch/bin/qtermite: quake termite 68 | Quake styled termiet console, binded to 'tilde' in monsterwm. 69 | 70 | /arch/bin/extract: archive extraction 71 | Extracts various file archives. 72 | 73 | /arch/bin/gitrup: subdirectory git puller 74 | Small script for updating 'git bundles' in pathogen for example. 75 | 76 | /arch/bin/nicoplay: stream nicovideo to mplayer 77 | Streams nicovideo to mplayer, simple as that. 78 | 79 | /arch/bin/pacup: small pacman update checker 80 | - /arch/etc/cron.hourly/pacman_update 81 | ^ dependant, more information in this file. 82 | 83 | /arch/bin/relink: relink symbolic links 84 | Relink symbolic links using regular expression. 85 | 86 | /arch/bin/scrotwin: scrot active window 87 | - /arch/pkg/pkgbuild/scrot 88 | ^ dependant, patched to support cropping 89 | Gets screenshot of active window without clicking it. 90 | 91 | /arch/bin/svol: OSSv4 && alsa volume controller 92 | Small and simple volume controller. 93 | 94 | /arch/vim: systemwide vim configuration 95 | Refer to '/arch/vim/README' for more information. 96 | 97 | /arch/shell: systemwide shell configuration 98 | Refer to '/arch/shell/README' for more information. 99 | 100 | /arch/passwd: passwd library for simple scripts 101 | Password handler for automated scripts that need authentication. Refer to 102 | '/arch/passwd/README' for more information. 103 | 104 | /arch/xcolors: systemwide xcolors for .Xresources 105 | Xcolors I like are stored here. 106 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/danbooru: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Crawl danbooru for pictures 3 | # 4 | 5 | # USAGE 6 | # ----- 7 | # danbooru [-v] [-r] [-s] [ [limit]] tags ... 8 | # -v: verbose output 9 | # -r: recrawl posts (updates json, updates location if needed) 10 | # -s: don't fork (sets DANBOORU_FORK_LIMIT to 1) 11 | # 12 | # Following are only relevant when no -r is specified: 13 | # [page/range]: page number or range to crawl in danbooru 14 | # [tags]: tags/metatags for searching 15 | # [limit]: limit results per page 16 | # 17 | # If -r is specified, you can filter recrawling to specific location as argument 18 | 19 | # -- Sun Sep 22 19:40:56 UTC 2013 20 | # Flash tag filtered by default 21 | # Possible to give page range in [page] argument (ex. 1-5) 22 | 23 | # -- Sun Apr 14 07:49:45 UTC 2013 24 | # Artist information is now provided in Danbooru API! 25 | # The caching code and crawling code for artist is now removed. 26 | # You can remove ignore.db and artist.db. 27 | 28 | # -- Fri Apr 12 18:36:21 UTC 2013 29 | # Danbooru API changed! 30 | # Still no artist information in post json... 31 | # This script is not compatible with old danbooru storage format anymore. 32 | # 33 | # More filtering options also provided. 34 | # .meta and .tags files no longer exists, instead .json file is provided! 35 | # 36 | # Also jsawk dependency is dropped for jshon dependency. 37 | 38 | # ABOUT 39 | # ----- 40 | # Uses JSON API instead of crawling HTML. 41 | # Much fool proof and allows more control. 42 | # Also it won't bloat your directory with lots of images, that slows down various file browsers. 43 | 44 | # Limit requests 45 | # Why? See: http://danbooru.donmai.us/forum/show/72300 46 | # 47 | # If you are calling this script in for loop, you should call sleep each iteration. 48 | 49 | # Directory where to store the posts 50 | DANBOORU_STORE="/mnt/storage/pictures/danbooru" 51 | 52 | # Directory structure for storing posts 53 | # Following keys can be used: 54 | # %extension: file extension (.jpg, .png, ...) 55 | # %artist: artist of the post 56 | # %rating: rating of the post (safe, questionable, explicit) 57 | # %postid: id of the post 58 | # %pool: pool id of the post 59 | # %md5: md5 of the post 60 | # 61 | # Example of default format: 62 | # /danbooru/Rib_y(uhki)/safe/dd192a8639f36f3fa38e551d0f24d73c.jpg" 63 | # 64 | # Duplicate detection breaks, if you change this after crawling 65 | # 66 | # Use -v flag to doublecheck that your filepaths looks sane 67 | # This script does no sanity checking to this 68 | DANBOORU_FORMAT="%artist/%rating/%md5.%extension" 69 | 70 | # Filename expression 71 | # Set characters which you want stripped from filename, eg, if you use fat32. 72 | DANBOORU_FILENAME_EXP='s/[][%\+\\\"\*;:\?\|<>,=]/_/g' 73 | 74 | # Rating to download 75 | # s = Only download safe posts 76 | # q = Download questionable && safe posts 77 | # e = Download explicit && questionable && safe posts 78 | DANBOORU_RATING="e" 79 | 80 | # Download only posts that are higher than this score 81 | DANBOORU_SCORE=0 82 | 83 | # Download pending posts? 84 | DANBOORU_PENDING=0 85 | 86 | # Download deleted posts? 87 | DANBOORU_DELETED=0 88 | 89 | # Download flagged posts? 90 | DANBOORU_FLAGGED=0 91 | 92 | # Download non rating locked posts? 93 | DANBOORU_NON_RATING_LOCKED=1 94 | 95 | # Download non status locked posts? 96 | DANBOORU_NON_STATUS_LOCKED=1 97 | 98 | # Download non note locked posts? 99 | DANBOORU_NON_NOTE_LOCKED=1 100 | 101 | # Download only parent posts 102 | DANBOORU_ONLY_PARENT=0 103 | 104 | # Download posts with no artist tag? 105 | DANBOORU_NO_ARTIST=0 106 | 107 | # Download only posts matching following dimensions 108 | # Leave array blank to download everything 109 | # ex. ("1680x1050" "800x600") 110 | DANBOORU_LIMIT_DIMENSIONS=() 111 | 112 | # Filter tags 113 | # Posts which match one of these tags will not be downloaded 114 | DANBOORU_TAG_FILTER=("yaoi" "tiger_&_bunny" "boys_love" "shounen-ai" "flash") 115 | 116 | # Tag match 117 | # Only posts which match one of these tags will be downloaded 118 | DANBOORU_TAG_MATCH=() 119 | 120 | # Filter pools 121 | # Posts which match one of these pools will not be downloaded 122 | # NOTE: This array takes pool ids! 123 | DANBOORU_POOL_FILTER=() 124 | 125 | # Pool match 126 | # Only posts which match one of these pools will be downloaded 127 | # NOTE: This array takes pool ids! 128 | DANBOORU_POOL_MATCH=() 129 | 130 | # Danbooru user && api key 131 | DANBOORU_USER="" 132 | DANBOORU_API_KEY="" 133 | 134 | # You can remove this if block 135 | if [[ -f "/arch/passwd/libpasswd-sh" ]]; then 136 | source "/arch/passwd/libpasswd-sh" 137 | DANBOORU_USER="$(_passwd_get_user "danbooru")" 138 | DANBOORU_API_KEY="$(_passwd_get_pass "danbooru")" 139 | fi 140 | 141 | # Curl agent 142 | DANBOORU_CURL_AGENT="Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" 143 | 144 | # Danbooru API root 145 | DANBOORU_ROOT="http://danbooru.donmai.us" 146 | 147 | # Limit the number of sub processes for download 148 | DANBOORU_FORK_LIMIT=20 149 | 150 | # Source configuration, if such exists 151 | # You can override the stuff above in this configuration file 152 | [[ -n "$DANBOORU_CONFIG" ]] || DANBOORU_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config/danbooru.conf}" 153 | [[ -f "$DANBOORU_CONFIG" ]] && source "$DANBOORU_CONFIG" 154 | 155 | # Lock file 156 | TMP_DIR="/tmp/danbooru" 157 | LOCK_FILE="$TMP_DIR/lock" 158 | 159 | # Depencies for this script 160 | # Perl is used for url encoding tags 161 | BIN_DEPS="curl jshon perl" 162 | 163 | # Arguments 164 | VERBOSE=0 165 | RECRAWL=0 166 | 167 | error_no_unlock() 168 | { 169 | echo "$@" 170 | [[ $VERBOSE -eq 1 ]] && [[ $i -gt 1 ]] && echo "" 171 | while [[ $(jobs -p | wc -l) -gt 1 ]]; do 172 | [[ $VERBOSE -eq 1 ]] && echo "[I] waiting for jobs ($(jobs -p | wc -l))" 173 | sleep 1 174 | done 175 | exit 1 176 | } 177 | 178 | error() 179 | { 180 | unlock 181 | error_no_unlock "$@" 182 | } 183 | 184 | check_deps() 185 | { 186 | hash $BIN_DEPS 187 | [[ $? -eq 0 ]] || error_no_unlock "Depencies missing! Bail out..." 188 | } 189 | 190 | # Lock 191 | lock() 192 | { 193 | [[ -d "$TMP_DIR" ]] || mkdir -p "$TMP_DIR" 194 | [[ ! -f "$LOCK_FILE" ]] || error_no_unlock "$(basename "$0") is already running!" 195 | touch "$LOCK_FILE" 196 | } 197 | 198 | # Unlock 199 | unlock() 200 | { 201 | [[ -f "$LOCK_FILE" ]] && rm "$LOCK_FILE" 202 | [[ -d "$TMP_DIR" ]] && rm -r "$TMP_DIR" 203 | } 204 | 205 | # Signal handler 206 | sigint() 207 | { 208 | # Kill all sub processes 209 | test -z "`jobs -p`" || kill -9 `jobs -p` &> /dev/null 210 | 211 | # Unlock 212 | unlock 213 | 214 | echo "$(basename "$0"): SIGINT" 215 | exit 1 216 | } 217 | 218 | # Usage 219 | usage() 220 | { 221 | for i in $@; do 222 | [[ "$i" != "-h" ]] && [[ "$i" != "--help" ]] || error_no_unlock "$(basename "$0") [-v] [-r] [-s] [ [limit]] tags ..." 223 | [[ "$i" != "-v" ]] || VERBOSE=1 224 | [[ "$i" != "-r" ]] || RECRAWL=1 225 | [[ "$i" != "-s" ]] || DANBOORU_FORK_LIMIT=1 226 | done 227 | } 228 | 229 | # Encode urls 230 | # $1 = URL 231 | urlencode() 232 | { 233 | echo -n "$@" | perl -pe's/([^-_.~A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg' 234 | } 235 | 236 | # $1 = API URL 237 | # $2 = URL Arguments (optional) 238 | get_json() 239 | { 240 | [[ -n "$2" ]] && 241 | curl -s --user-agent "$DANBOORU_CURL_AGENT" "$DANBOORU_ROOT/$1.json?$2&login=$DANBOORU_USER&api_key=$DANBOORU_API_KEY" 242 | [[ -n "$2" ]] || 243 | curl -s --user-agent "$DANBOORU_CURL_AGENT" "$DANBOORU_ROOT/$1.json?login=$DANBOORU_USER&api_key=$DANBOORU_API_KEY" 244 | } 245 | 246 | # $1 = JSON rating 247 | # Return readable rating 248 | rating_str() 249 | { 250 | [[ "$@" != "s" ]] || echo "safe" 251 | [[ "$@" != "q" ]] || echo "questionable" 252 | [[ "$@" != "e" ]] || echo "explicit" 253 | } 254 | 255 | # $1 = Post JSON 256 | # Returns target from configured format 257 | # %extension: file extension (.jpg, .png, ...) 258 | # %artist: artist of the post 259 | # %rating: rating of the post (safe, questionable, explicit) 260 | # %postid: id of the post 261 | # %pool: pool id of the post 262 | # %md5: md5 of the post 263 | target_from_format() 264 | { 265 | local JSON="$1" 266 | local ARTIST="$2" 267 | [[ -n "$JSON" ]] || return 268 | 269 | ID="$(echo "$JSON" | jshon -e "id" -u)" 270 | MD5="$(echo "$JSON" | jshon -e "md5" -u)" 271 | EXT="$(echo "$JSON" | jshon -e "file_ext" -u)" 272 | POOLS=($(echo "$JSON" | jshon -e "pool_string" -u)) 273 | POOL="$(echo "${POOLS[0]}" | sed 's/^pool://')" 274 | ARTISTS=($(echo "$JSON" | jshon -e "tag_string_artist" -u)) 275 | ARTIST="${ARTISTS[0]}" 276 | RATING="$(echo "$JSON" | jshon -e "rating" -u)" 277 | RATING="$(rating_str "$RATING")" 278 | [[ -n "$RATING" ]] || return 279 | [[ -n "$ARTIST" ]] || ARTIST="noartist" 280 | [[ -n "$POOL" ]] || POOL="nopool" 281 | 282 | # sanity artist 283 | ARTIST="${ARTIST//\\/\\\\}" 284 | ARTIST="${ARTIST////∕}" 285 | ARTIST="${ARTIST//&/\&}" 286 | 287 | TARGET="$(echo "$DANBOORU_FORMAT" |\ 288 | sed "s/%extension/$EXT/;s/%artist/$ARTIST/;s/%rating/$RATING/;s/%postid/$ID/;s/%pool/$POOL/;s/%md5/$MD5/")" 289 | TARGET=$(echo -n "$TARGET" | sed "$DANBOORU_FILENAME_EXP") # Replace illegal characters. 290 | echo "$DANBOORU_STORE/$TARGET" 291 | } 292 | 293 | # $1 = URL 294 | # $2 = Touch date 295 | # $3 = JSON 296 | # $4 = Target 297 | # Download picture 298 | store_picture() 299 | { 300 | local URL="$1" 301 | local DATE="$2" 302 | local JSON="$3" 303 | local TARGET="$4" 304 | 305 | # Temp target 306 | local BASE="$(basename "$URL")" 307 | local TEMP="$TMP_DIR/$BASE" 308 | 309 | # Download to $TEMP and move after finished to 310 | # destination to avoid partial downloads 311 | echo "==> [D] $URL" 312 | echo " => $TARGET" 313 | curl -s -o "$TEMP" "$URL" 314 | 315 | # Download failed 316 | [[ -f "$TEMP" ]] || return 317 | 318 | # Check corrupt file 319 | MD5="$(md5sum "$TEMP")" 320 | MD5="${MD5%% *}" 321 | [[ "$MD5" == "${BASE%.*}" ]] || { 322 | echo "[!] Removing corrupt: $TEMP"; 323 | rm "$TEMP"; return; 324 | } 325 | 326 | # mkdir 327 | mkdir -p "$(dirname $TARGET)" 328 | 329 | # Move to destination 330 | mv "$TEMP" "$TARGET" 331 | [[ -n "$DATE" ]] && touch -c -d "$DATE" "$TARGET" 332 | echo "$JSON" > "${TARGET%.*}.json" 333 | } 334 | 335 | # $1 = URL 336 | # $2 = Danbooru URL 337 | # $3 = Touch date 338 | # $3 = JSON 339 | # Stores the picture 340 | check_picture() 341 | { 342 | local URL="$1" 343 | local DURL="$2" 344 | local DATE="$3" 345 | local JSON="$4" 346 | 347 | [[ -n "$URL" ]] || return 348 | [[ -n "$DURL" ]] || return 349 | [[ -n "$JSON" ]] || return 350 | 351 | # Check if file already exists 352 | TARGET="$(target_from_format "$JSON")" 353 | [[ $VERBOSE -eq 0 ]] || echo ":: TARGET: $TARGET" 354 | [[ -n "$TARGET" ]] || return 355 | if [[ -f "$TARGET" ]]; then 356 | echo "[!] exist [$(basename $TARGET)]: $DURL" 357 | [[ -f "${TARGET%.*}.json" ]] || echo "$JSON" > "${TARGET%.*}.json" 358 | return 359 | fi 360 | 361 | # Download picture to disk 362 | [[ $DANBOORU_FORK_LIMIT -gt 1 ]] && store_picture "$URL" "$DATE" "$JSON" "$TARGET" & 363 | [[ $DANBOORU_FORK_LIMIT -gt 1 ]] || store_picture "$URL" "$DATE" "$JSON" "$TARGET" 364 | } 365 | 366 | # Crawl 367 | crawl() 368 | { 369 | if [[ $VERBOSE -eq 1 ]]; then 370 | echo "[F] $DANBOORU_ROOT/posts.json?$@" 371 | echo "" 372 | fi 373 | 374 | RESULT="$(get_json "posts" "$@")" 375 | [[ "$RESULT" == "403 Forbidden" ]] && error "[!!] username or API key is wrong" 376 | JSONCNT=$(echo "$RESULT" | jshon -l) 377 | [[ $JSONCNT -eq 0 ]] && error "[!!] failed to retieve posts from: $DANBOORU_ROOT/posts.json" 378 | 379 | for i in $(seq 0 $((JSONCNT-1))); do 380 | # Check if we are throttled 381 | if [[ "$RESULT" == "421 User Throttled" ]]; then 382 | echo "[!!] danbooru has throttled you" 383 | break 384 | fi 385 | 386 | # Fetch post JSON 387 | JSON="$(echo "$RESULT" | jshon -e $i 2>/dev/null)" 388 | [[ -n "$JSON" ]] || error "[!] No results.." 389 | 390 | # Parse stuff we need 391 | ID="$(echo "$JSON" | jshon -e "id" -u)" 392 | [[ -n "$ID" ]] || continue 393 | PENDING="$(echo "$JSON" | jshon -e "is_deleted" -u)" 394 | BANNED="$(echo "$JSON" | jshon -e "is_banned" -u)" 395 | DELETED="$(echo "$JSON" | jshon -e "is_deleted" -u)" 396 | FLAGGED="$(echo "$JSON" | jshon -e "is_flagged" -u)" 397 | NOTE_LOCKED="$(echo "$JSON" | jshon -e "is_note_locked" -u)" 398 | STATUS_LOCKED="$(echo "$JSON" | jshon -e "is_status_locked" -u)" 399 | RATING_LOCKED="$(echo "$JSON" | jshon -e "is_rating_locked" -u)" 400 | CREATED_AT="$(echo "$JSON" | jshon -e "created_at" -u)" 401 | RATING="$(echo "$JSON" | jshon -e "rating" -u)" 402 | SCORE="$(echo "$JSON" | jshon -e "score" -u)" 403 | WIDTH="$(echo "$JSON" | jshon -e "image_width" -u)" 404 | HEIGHT="$(echo "$JSON" | jshon -e "image_height" -u)" 405 | PARENT="$(echo "$JSON" | jshon -e "parent_id" -u)" 406 | TAGS="$(echo "$JSON" | jshon -e "tag_string" -u)" 407 | POOLS=($(echo "$JSON" | jshon -e "pool_string" -u)) 408 | MD5="$(echo "$JSON" | jshon -e "md5" -u)" 409 | EXT="$(echo "$JSON" | jshon -e "file_ext" -u)" 410 | URL="$DANBOORU_ROOT/data/$MD5.$EXT" 411 | DURL="$DANBOORU_ROOT/posts/$ID" 412 | ARTISTS=($(echo "$JSON" | jshon -e "tag_string_artist" -u)) 413 | ARTIST="${ARTISTS[0]}" 414 | 415 | # Verbose output 416 | if [[ $VERBOSE -eq 1 ]]; then 417 | echo "" 418 | echo ":: ID: $IDS[$i]" 419 | echo ":: URL: $URL" 420 | echo ":: DURL: $DURL" 421 | echo ":: EXT: $EXT" 422 | echo ":: MD5: $MD5" 423 | [[ -n "$ARTIST" ]] && echo ":: ARTIST: $ARTIST" 424 | [[ -n "$POOLS" ]] && echo ":: POOLS: ${POOLS[@]}" 425 | fi 426 | 427 | # Check artist 428 | OK=1 429 | [[ -n "$ARTIST" ]] || { [[ $DANBOORU_NO_ARTIST -eq 0 ]] && OK=0; } 430 | 431 | if [[ $OK -eq 0 ]]; then 432 | echo "[!] no artist: $DURL" 433 | continue 434 | fi 435 | 436 | # Check parent 437 | OK=1 438 | [[ "$PARENT" == "null" ]] || { [[ $DANBOORU_ONLY_PARENT -eq 1 ]] && OK=0; } 439 | 440 | if [[ $OK -eq 0 ]]; then 441 | echo "[!] block parent [$PARENT]: $DURL" 442 | continue 443 | fi 444 | 445 | # Check score 446 | OK=1 447 | [[ $SCORE -ge $DANBOORU_SCORE ]] || OK=0 448 | 449 | if [[ $OK -eq 0 ]]; then 450 | echo "[!] block score [$SCORE]: $DURL" 451 | continue 452 | fi 453 | 454 | # Check rating 455 | OK=1 456 | [[ "$RATING" == "e" ]] && { [[ "$DANBOORU_RATING" == "e" ]] || OK=0; } 457 | [[ "$RATING" == "q" ]] && { [[ "$DANBOORU_RATING" == "q" ]] || [[ "$DANBOORU_RATING" == "e" ]] || OK=0; } 458 | [[ "$RATING" == "s" ]] && OK=1 459 | 460 | if [[ $OK -eq 0 ]]; then 461 | echo "[!] block rating [$RATING]: $DURL" 462 | continue 463 | fi 464 | 465 | # Check status 466 | OK=1; STATUS="OK" 467 | [[ "$BANNED" == "true" ]] && { OK=0; STATUS="banned"; } 468 | [[ "$PENDING" == "true" ]] && { [[ $DANBOORU_PENDING -eq 1 ]] || { OK=0; STATUS="pending"; } } 469 | [[ "$FLAGGED" == "true" ]] && { [[ $DANBOORU_FLAGGED -eq 1 ]] || { OK=0; STATUS="flagged"; } } 470 | [[ "$DELETED" == "true" ]] && { [[ $DANBOORU_DELETED -eq 1 ]] || { OK=0; STATUS="deleted"; } } 471 | [[ "$NOTE_LOCKED" != "true" ]] && { [[ $DANBOORU_NON_NOTE_LOCKED -eq 1 ]] || { OK=0; STATUS="not note locked"; } } 472 | [[ "$STATUS_LOCKED" != "true" ]] && { [[ $DANBOORU_NON_STATUS_LOCKED -eq 1 ]] || { OK=0; STATUS="not status locked"; } } 473 | [[ "$RATING_LOCKED" != "true" ]] && { [[ $DANBOORU_NON_RATING_LOCKED -eq 1 ]] || { OK=0; STATUS="not rating locked"; } } 474 | 475 | if [[ $OK -eq 0 ]]; then 476 | echo "[!] block status [$STATUS]: $DURL" 477 | continue 478 | fi 479 | 480 | # Check pool 481 | OK=1; BPOOL="" 482 | for POOL in "${POOLS[@]}"; do 483 | for EPOOL in "${DANBOORU_POOL_FILTER[@]}"; do 484 | [[ "pool:$EPOOL" != "$POOL" ]] && continue 485 | OK=0; BPOOL="$EPOOL" 486 | break 487 | done 488 | [[ $OK -eq 0 ]] && break 489 | done 490 | 491 | if [[ $OK -eq 0 ]]; then 492 | echo "[!] block pool [$BPOOL]: $DURL" 493 | continue 494 | fi 495 | 496 | OK=1; 497 | for POOL in "${POOLS[@]}"; do 498 | FOUND=0 499 | for EPOOL in "${DANBOORU_POOL_MATCH[@]}"; do 500 | [[ "pool:$EPOOL" != "$POOL" ]] && { OK=0; continue; } 501 | OK=1; FOUND=1 502 | break 503 | done 504 | [[ $FOUND -eq 1 ]] && break 505 | done 506 | 507 | if [[ $OK -eq 0 ]]; then 508 | echo "[!] no pool matched: $DURL" 509 | continue 510 | fi 511 | 512 | # Check tags 513 | OK=1; BTAG="" 514 | for ETAG in "${DANBOORU_TAG_FILTER[@]}"; do 515 | echo "$TAGS" | grep -Fw "$ETAG" &> /dev/null 516 | [[ $? -eq 1 ]] && continue 517 | OK=0; BTAG="$ETAG" 518 | break 519 | done 520 | 521 | if [[ $OK -eq 0 ]]; then 522 | echo "[!] block tag [$BTAG]: $DURL" 523 | continue 524 | fi 525 | 526 | OK=1 527 | for ETAG in "${DANBOORU_TAG_MATCH[@]}"; do 528 | echo "$TAGS" | grep -Fw "$ETAG" &> /dev/null 529 | [[ $? -eq 1 ]] && { OK=0; continue; } 530 | OK=1; break 531 | done 532 | 533 | if [[ $OK -eq 0 ]]; then 534 | echo "[!] no tag matched: $DURL" 535 | continue 536 | fi 537 | 538 | # Check resolution 539 | OK=1 540 | RES="${WIDTH}x${HEIGHT}" 541 | for ERES in "${DANBOORU_LIMIT_DIMENSIONS[@]}"; do 542 | [[ "$ERES" != "$RES" ]] && { OK=0; continue; } 543 | OK=1; break 544 | done 545 | 546 | if [[ $OK -eq 0 ]]; then 547 | echo "[!] block resolution [$RES]: $DURL" 548 | continue 549 | fi 550 | 551 | # Check picture 552 | check_picture "$URL" "$DURL" "$CREATED_AT" "$JSON" 553 | 554 | # Wait for forks 555 | while [[ $(jobs -p | wc -l) -gt $DANBOORU_FORK_LIMIT ]]; do 556 | [[ $VERBOSE -eq 1 ]] && echo "[I] fork limit hit, waiting: ($(jobs -p | wc -l))" 557 | sleep 1 558 | done 559 | done 560 | } 561 | 562 | # Main 563 | main() 564 | { 565 | local RESULT= 566 | local OK=0 567 | local LIMIT=100 568 | local PAGE1=1 569 | local PAGE2=1 570 | 571 | # Parse arguments 572 | [[ "$1" =~ ^[0-9]+$ ]] && { PAGE1="$1"; PAGE2="$1"; shift 1; } 573 | [[ "$1" =~ ^[0-9-]+$ ]] && { PAGE1="${1//-*/}"; PAGE2="${1//*-/}"; shift 1; } 574 | [[ "$1" =~ ^[0-9]+$ ]] && { LIMIT="$1"; shift 1; } 575 | local PTAGS="$(urlencode "$@")" 576 | 577 | for PAGE in $(seq $PAGE1 $PAGE2); do 578 | crawl "page=$PAGE&limit=$LIMIT&tags=$PTAGS" 579 | done 580 | 581 | # Wait for subprocesses 582 | [[ $VERBOSE -eq 1 ]] && [[ $i -gt 1 ]] && echo "" 583 | while [[ $(jobs -p | wc -l) -gt 1 ]]; do 584 | [[ $VERBOSE -eq 1 ]] && echo "[I] waiting for jobs ($(jobs -p | wc -l))" 585 | sleep 1 586 | done 587 | } 588 | 589 | # $1 = Path to json file 590 | # Recrawl image using the data from JSON 591 | recrawl_picture() 592 | { 593 | local JSONF="$1" 594 | local JSON= 595 | 596 | # Find and remove bad posts 597 | ID="$(jshon -F "$JSONF" -e "id" -u)" 598 | if [[ ! -n "$ID" ]]; then 599 | echo "" 600 | echo "[!!] bad json file: $JSONF" 601 | rm "${JSONF%.*}."* 602 | return 603 | fi 604 | 605 | # Store stuff from old json 606 | OEXT="$(jshon -F "$JSONF" -e "file_ext" -u)" 607 | DURL="$DANBOORU_ROOT/posts/$ID" 608 | JSON="$(get_json "posts/$ID")" 609 | [[ -n "$JSON" ]] || return 610 | 611 | # Check if we are throttled 612 | [[ "$JSON" == "421 User Throttled" ]] && error "[!!] danbooru has throttled you" 613 | 614 | # Data we might like to recrawl 615 | ID="$(echo "$JSON" | jshon -e "id" -u)" 616 | 617 | # Failed to get ID 618 | # Fetch failed, or user throttled 619 | [[ -n "$ID" ]] || return 620 | 621 | CREATED_AT="$(echo "$JSON" | jshon -e "created_at" -u)" 622 | RATING="$(echo "$JSON" | jshon -e "rating" -u)" 623 | POOL="$(echo "$JSON" | jshon -e "pool_string" -u)" 624 | MD5="$(echo "$JSON" | jshon -e "md5" -u)" 625 | EXT="$(echo "$JSON" | jshon -e "file_ext" -u)" 626 | URL="$DANBOORU_ROOT/data/$MD5.$EXT" 627 | ARTISTS=($(echo "$JSON" | jshon -e "tag_string_artist" -u)) 628 | ARTIST="${ARTISTS[0]}" 629 | 630 | # Get target 631 | OTARGET="${JSONF%.*}.$OEXT" 632 | TARGET="$(target_from_format "$JSON")" 633 | OMD5="$(md5sum "$OTARGET")" 634 | OMD5="${OMD5%% *}" 635 | 636 | # Verbose output 637 | if [[ $VERBOSE -eq 1 ]]; then 638 | echo "" 639 | echo ":: ID: $ID" 640 | echo ":: URL: $URL" 641 | echo ":: DURL: $DURL" 642 | echo ":: JSON: $JSONF" 643 | echo ":: EXT: $EXT" 644 | echo ":: MD5: $MD5" 645 | [[ -n "$ARTIST" ]] && echo ":: ARTIST: $ARTIST" 646 | [[ -n "$POOL" ]] && echo ":: POOL: $POOL" 647 | echo ":: TARGET: $TARGET" 648 | fi 649 | 650 | # Update the json file 651 | echo "$JSON" > "$JSONF" 652 | 653 | # Handle conflicts! 654 | if [[ "$OTARGET" != "$TARGET" ]] && [[ -f "$TARGET" ]]; then 655 | # Target already exists? 656 | echo "[!] target exists: $TARGET" 657 | rm "$OTARGET" 658 | rm "${OTARGET%.*}.json" 659 | elif [[ "$OMD5" != "$MD5" ]]; then 660 | # MD5 differs 661 | echo "[!] md5 differs: $DURL" 662 | store_picture "$URL" "$CREATED_AT" "$JSON" "$TARGET" 663 | if [[ -f "$TARGET" ]] && [[ "$TARGET" != "$OTARGET" ]]; then 664 | rm "$OTARGET" 665 | rm "${OTARGET%.*}.json" 666 | fi 667 | elif [[ "$OTARGET" != "$TARGET" ]]; then 668 | # Target differs 669 | echo "==> [M] $OTARGET" 670 | echo " => $TARGET" 671 | mkdir -p "$(dirname $TARGET)" 672 | mv "$OTARGET" "$TARGET" 673 | mv "${OTARGET%.*}.json" "${TARGET%.*}.json" 674 | [[ -f "$TARGET" ]] && [[ -n "$CREATED_AT" ]] && touch -c -d "$CREATED_AT" "$TARGET" 675 | else 676 | # Update created at 677 | [[ -f "$TARGET" ]] && [[ -n "$CREATED_AT" ]] && touch -c -d "$CREATED_AT" "$TARGET" 678 | fi 679 | } 680 | 681 | # Recrawl images (updates .json and updates location if needed) 682 | recrawl() 683 | { 684 | echo "[I] recrawling from: $DANBOORU_STORE" 685 | 686 | # Filter recrawling to pattern 687 | PATTERN="*" 688 | [[ -n "$@" ]] && PATTERN="*$@*" 689 | 690 | # Test credentials before recrawling 691 | RESULT="$(get_json "posts" "page=1&limit=1")" 692 | [[ "$RESULT" == "403 Forbidden" ]] && error "[!!] username or API key is wrong" 693 | [[ "$RESULT" == "421 User Throttled" ]] && error "[!!] danbooru has throttled you" 694 | JSONCNT=$(echo "$RESULT" | jshon -l) 695 | [[ $JSONCNT -eq 0 ]] && error "[!!] failed to retieve posts from: $DANBOORU_ROOT/posts.json" 696 | 697 | # Recrawl local posts 698 | find "$DANBOORU_STORE" -path "$PATTERN" -name "*.json" | while read i; do 699 | [[ $VERBOSE -eq 0 ]] && echo "[C] $i" 700 | [[ $DANBOORU_FORK_LIMIT -gt 1 ]] && { (recrawl_picture "$i" &); sleep 1; } # Sleep, so we don't hammer servers 701 | [[ $DANBOORU_FORK_LIMIT -gt 1 ]] || recrawl_picture "$i" 702 | while [[ $(jobs -p | wc -l) -gt $DANBOORU_FORK_LIMIT ]]; do 703 | [[ $VERBOSE -eq 1 ]] && echo "[I] fork limit hit, waiting: ($(jobs -p | wc -l))" 704 | sleep 1 705 | done 706 | done 707 | 708 | # Wait for subprocesses 709 | [[ $VERBOSE -eq 1 ]] && [[ $i -gt 1 ]] && echo "" 710 | while [[ $(jobs -p | wc -l) -gt 1 ]]; do 711 | [[ $VERBOSE -eq 1 ]] && echo "[I] waiting for jobs ($(jobs -p | wc -l))" 712 | sleep 1 713 | done 714 | 715 | # Remove all empty directories 716 | echo "[I] removing all empty directories" 717 | find "$DANBOORU_STORE" -path "$PATTERN" -type d -empty -delete; 718 | } 719 | 720 | # Init 721 | check_deps 722 | usage $@ 723 | 724 | # Get rid of the recrawl argument 725 | [[ $RECRAWL -eq 0 ]] || shift 1 726 | 727 | # Get rid of the verbose argument 728 | [[ $VERBOSE -eq 0 ]] || shift 1 729 | 730 | # Create lock file 731 | lock 732 | 733 | # Trap SIGINT 734 | trap sigint SIGINT 735 | 736 | # Perform action 737 | [[ $RECRAWL -eq 0 ]] && main $@ 738 | [[ $RECRAWL -eq 1 ]] && recrawl $@ 739 | 740 | # Unlock lock file 741 | unlock 742 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/dmenu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # dmenu wrapper, assing some options 3 | # if they weren't given. 4 | # 5 | # TODO: integrate with monsterwm, 6 | # maybe make monsterwm output some of it's 7 | # settings as enviroiment variables? 8 | main() { 9 | local ARGS= 10 | local FONT= 11 | [[ "$@" != *-fn ]] && FONT="terminus 9" 12 | [[ "$@" != *-nb ]] && ARGS="$ARGS -nb #1A1A1A" 13 | [[ "$@" != *-nf ]] && ARGS="$ARGS -nf #EFEFEF" 14 | [[ "$@" != *-sb ]] && ARGS="$ARGS -sb #1A1A1A" 15 | [[ "$@" != *-sf ]] && ARGS="$ARGS -sf #F92672" 16 | [[ -n "$FONT" ]] && { 17 | /usr/bin/dmenu -fn "$FONT" $ARGS "$@"; return; 18 | } || { /usr/bin/dmenu $ARGS "$@"; return; } 19 | } 20 | main "$@" 21 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/dtermite: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # dtach a termite client 3 | # only allow one termite session by default 4 | # 5 | # needs: dtach 6 | # optional: termite 7 | 8 | [[ -n "$TERMINAL" ]] || TERMINAL="termite" 9 | 10 | # error 11 | error() { echo "$@" 1>&2; exit 1; } 12 | 13 | # check pid 14 | check_pid() { 15 | local PID="$(cat "$@")" 16 | kill -0 $PID &> /dev/null && { error "already running"; } || rm "$@" 17 | } 18 | 19 | # create new session 20 | # $1: name of session 21 | # $2: program to run 22 | # $3: socket file 23 | # $4: pid file 24 | attach() { 25 | $TERMINAL --class "$1" --name "$1" -e "dtach -A \"$3\" \"$2\"" & 26 | echo "$4" 27 | echo "$!" > "$4" 28 | } 29 | 30 | # $1: name of dtach 31 | # $2: program to run 32 | main() { 33 | local SOCKET_DIR="/tmp/dtermite" 34 | local PIDFILE="$SOCKET_DIR/$1.pid" 35 | local SOCKET="$SOCKET_DIR/$1.sck" 36 | [[ -d "$SOCKET_DIR" ]] || mkdir "$SOCKET_DIR" 37 | [[ -d "$SOCKET_DIR" ]] || error "no socket directory" 38 | 39 | # comment this line to allow multiple 40 | # termite sessions 41 | [[ -e "$PIDFILE" ]] && check_pid "$PIDFILE" 42 | attach "$1" "$2" "$SOCKET" "$PIDFILE"; 43 | } 44 | main "$1" "$2" 45 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/dwbeditor: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # workaround: 3 | # calling termite -e vim dwb_uri directly doesn't seem to work for some reason. 4 | termite -e "vim $@" 5 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/fat32strip: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Replaces illegal FAT32 characters in $@ 3 | 4 | [[ -d "$@" ]] || { echo "usage: $(basename $0) "; exit 1; } 5 | find "$@" | while read -r f; do mv -i "$f" "${f//[:;*?\"<>|()\\]/_}"; done 6 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/gitrup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Walks through all the directories 3 | # in current working directory 4 | # and runs git pull on them if 5 | # the directory is a git repository. 6 | 7 | main() { 8 | for i in *; do 9 | [[ -d "$i" ]] || continue 10 | [[ -d "$i/.git" ]] || continue 11 | pushd "$i" &> /dev/null 12 | echo "-!- Updating $(basename "$i")" 13 | git pull 14 | git submodule update --init --recursive 15 | echo "" 16 | popd &> /dev/null 17 | done 18 | } 19 | main "$@" 20 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/listarchive: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | bsdtar -t -f "$@" 3 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/lnn: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Creates symbolic links to multiple targets. 3 | 4 | usage() { 5 | echo "usage: $(basename $0) " 6 | exit 1 7 | } 8 | 9 | main() { 10 | [[ -n "$1" ]] || usage 11 | while [[ "$1" ]]; do 12 | [[ -e "$1" ]] && { 13 | file="$(basename "$1")" 14 | ln -s "$1" "${file} (link)" 15 | } 16 | shift || break 17 | done 18 | } 19 | main "$@" 20 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/nicodl: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # nicovideo-dl wrapper with auto password 3 | # 4 | # Store your credentials in: 5 | # $HOME/.passwd/nicovideo 6 | # 7 | # with format: 8 | # 9 | # 10 | # 11 | # needs: nicovideo-dl 12 | 13 | source "/arch/passwd/libpasswd-sh" 14 | err() { echo "$@" 1>&2; exit 1; } 15 | 16 | nicovideo-dl \ 17 | -u "$(_passwd_get_user "nicovideo")" \ 18 | -p "$(_passwd_get_pass "nicovideo")" $@ 19 | 20 | # vim: set ts=8 sw=3 tw=0 : 21 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/nicoplay: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Streams the nicovideo to mpv 3 | # 4 | # Store your credentials in: 5 | # $HOME/.passwd/nicovideo 6 | # 7 | # with format: 8 | # 9 | # 10 | # 11 | # needs: nicovideo-dl, mpv 12 | 13 | source "/arch/passwd/libpasswd-sh" 14 | 15 | # automatically inserts passwords to nicovideo-dl 16 | nicowrap() { 17 | nicovideo-dl \ 18 | -u "$(_passwd_get_user "nicovideo")" \ 19 | -p "$(_passwd_get_pass "nicovideo")" $@ 20 | } 21 | 22 | # error handler 23 | err() { echo "$@" 1>&2; exit 1; } 24 | 25 | # check arguments 26 | if [[ ! -n "$@" ]]; then 27 | err "usage: $(basename $0) [url]" 28 | fi 29 | 30 | # create temporary directory 31 | NICOPLAY_DIR="$(mktemp -dt "$(basename $0).XXXXXXXXXX")" 32 | 33 | # cleanup 34 | cleanup() 35 | { 36 | # remove temporary directory 37 | if [[ -d "$NICOPLAY_DIR" ]]; then 38 | rm -rf "$NICOPLAY_DIR" 39 | fi 40 | 41 | # kill all forks 42 | if [[ -z "$(jobs -p)" ]]; then 43 | kill -9 $(jobs -p) &> /dev/null 44 | fi 45 | } 46 | trap cleanup EXIT 47 | 48 | # data for loading screen 49 | LOADING=""" 50 | R0lGODlh/AF9AbMAAP///+7u7t3d3czMzLu7u6qqqpmZmYiIiHd3d2ZmZv4BAgAAAAAAAAAAAAAA 51 | AAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFCgAKACwAAAAA/AF9AQAE/xDISau9OOvNu/9gKI5k 52 | aZ5oqq5s675wLM90bd94ru987//AoHBILBqPyKRyyWw6n9CodEqtWq/YrHbL7Xq/4LB4TC6bz+i0 53 | es1uu9/wuHxOr9vv+Lx+z+/7/4CBgoOEhYaHiImKi4yNjo+QkZKTlJWWl5iZmpucnZ6foKGio6Sl 54 | pqeoqaqrrK2ur7CxsrO0tba3uLm6u7y9vr/AwcLDxMXGx8jJysvMzc7P0NHS09TV1tfY2drb3N3e 55 | 3+Dh4uPk5ebn6Onq6+zt7u/w8fLz9PX29/j5+vv8/f7/AAMKHEiwoMGDCBMqXMiwocOHECNKnEix 56 | osWLGDNq3Mixo8ePIP9DihxJsqTJkyhTqlzJsqXLlzBjypxJs6bNmzhz6tzJs6fPn0CDCh1KtKjR 57 | o0iTKl3KtKnTp1CjSp1KtarVq1izat3KtavXr2DDih1LtqzZs2jTql3Ltq3bt3Djyp1Lt67du3jz 58 | 6t3Lt6/fv4ADCx5MuLDhw4gTK17MuLHjx5AjS55MubLly5gza97MubPnz6CRBhhAekCAAKHjBCiA 59 | 4MABAwUICDid2k2BBLgRtDYwQEDtNgEQ4B6eALbv32sECB/OG7mb4MMPoHbuZnlx6m9u4y6A/Tnz 60 | 7rYT6J4Ofo1uBNzLrwmu+7j6NATOv18T//UJ8vOfsEZvgnZ+KAW4ZkD/f/7910R96ZFwGn4GKjGA 61 | awcQyGCDSAQAoXsiLEhhExASoGAAs23IBAGvGTBhBwLMdqKIRFhogAEehgBiiiyO+CKMIMwYYo1L 62 | FHBjjByMliKGPFZ4Y2wcCEAajUUysRpsBRRgmgUgltZbk04EQACUURJgJQFglkYklksMEGVssYGp 63 | ZmkrkukgAWmqGeaYbj4x45Jt1qnnnnz26eefgAYq6KCEFmoonwXqoKEEix5aQQAv5inDiwNMQKmj 64 | VEbKw6UScIrpBJCauGlzjEpKaKimwuDppxegGqScGIwGK5UDgOmbp6RNp6RvAqg5oayyAZBrka5q 65 | sOWNqwJwLLIGYCgA/7PHVtopqVuCyayzzPpIao3FYnCsl8u6N8CLXpp5I6gvSjnujdICwOmy4J7L 66 | aLqkIdsui91a8Gyz6L5o6bbKagqAj0CGuu27L7p37HQE9wuwiPlWsGWCEuyr673CahoqtgdT6+8E 67 | FgOwMQX7YrxhxBQk6+7Dp9WqLWr7WuApwkCKrGnMFahMIcr/mowrszeitq7MHUtbLQWuDp3zwycL 68 | fIHKCP9orahKp1y0BEf3K/THVpu8s9NE12wzv6FOKcG6MIO9crs0I30z2GUTqzYFx1agdNVYa7xq 69 | yT3nXXOx5FKwrtcN8lxxuv3GuK64QefNr8jasu3x3wJHe/iqiTYqcv+qmRkMtMfkaivq2LAty6nB 70 | sdnbd8CUj+45s+3i7anhnb0O+wTr/ojfvj+uDCTvkc48uduji7xsAXGfzfXaWju34POai8xmq9Nv 71 | zqCS0mZOXvSJljpdwqBq/yjnrH4AKfLEk18+DKGiDzls6wNhOrLqxw9D7uTWb38M0e/v//8ADKAA 72 | B0jAAhrwgAhMoAIXyMAGOvCBEIygBCdIwQpa8IIYzKAGN8jBDnrwgyAMoQhHSMISmvCEKEyhClfI 73 | wha68IUwjKEMZ0jDGtrwhjjMoQ53yMMe+vCHQAyiEIdIxCIa8YhITKISl8jEJjrxiVCMohSnSMUq 74 | WvGKWMyiFrfIxS5OevGLYAyjGMdIxjKa8YxoTKMa18jGNrrxjXCMoxznSMc62vGOeMyjHvfIxz76 75 | 8Y+ADKQgB0nIQhrykIhMpCIXychGOvKRkIykJCepkAgAACH5BAUKAAoALO0AngAdAB4AAAS6UMlJ 76 | JSHmXFG7n0koJogWfKgyjqUxpNKhINRhHyJiEO93IjREgVMJGHQEAbFzAOpggUFg6mkCC7AsoanJ 77 | Zrle7S0MuxHIqdsJ7RkcMuyP24CNUwASw84+AeAxe3wKfgADemeChAJ6BomECoxrdo8FdD1xhHgD 78 | BZx4cVOZnHWfAZ4Km5yXYVOlFAQFG2SskhOvF6o+AqwfF70CphQBSrq0Hr2+wwPDSsUeAscD0dLL 79 | aAIDPNLRzHxT2zARACH5BAUKAAoALO0AnwAdAB0AAAS1UMk5yUEYp40K/SCBXBmiIFvqgZ9xXLAh 80 | G2iaIAErue9BsIKCDcfiHVY6ySFFpLhcv6STc2jJpMWbTwEAzKLYz/JgkAxmYVYgYSAIFIVrmkUY 81 | CN6G+DwZCAThe1gFBWCBIYOGSQOIiUCEjTqEhZASBJaUH5aTlAKakF1dlZYDiaChCp2Wb3umpwoD 82 | o6ytrQOkdmmzs7W7OgB9Abm6u3Z3v8bAs2q7d8x+xgB7fszFv9Clx9ZJEQAh+QQFCgAKACztAJ4A 83 | HgAeAAAEuRDISUEYpBQyRP2gRRhHaSIHQgQhOBgwaaYpghTtFBRxrGk0m40V2vVWHwHBlhiCdjwD 84 | IWcxIBJNTyVjKAyok8K1WRn8vuAwNoELa6ZpimFNxGjilcDaIMlw8BUFWAgiBEiAEwJrAkqGiBVr 85 | BI1ojxIHWByGlJWXNxh/lZYokpqhEjwFAgGZphICAwEXA7CtAFqzHbVEr7O1FLhavrK0vraMqsXG 86 | jES+x8vFy6qx06bT1izMldfZyXgRACH5BAUKAAoALO0AngAeAB0AAAS+UMlJpRiEDBWq/wowFKRh 87 | ngaoKmRZoOZxEOuUtWSWxYacrjdCYQOSGVU6Wo0lQxw6FUxmaWseKgKdgGpzIpQSHZErKSDOky2G 88 | XDkjCpLBZsumoEPycV1yD+T3dhN+A3SACj8KF4SGEikJBoqFgAYJjwECmIwKB5U0mJJ7lQkEAJ8A 89 | hgOiHZ9QewWVCBKXmXsBonCyAgGtZJRnvLu8VAFOMxXBwksCBWAUyGx+ybLBAKdL0hTV2tvWgNzf 90 | jOBcEQAh+QQFCgAKACztAJ4AHgAdAAAEuRDISUEQYgwcqv+SQIxjQRToAIIi6aKwoa7TQNikdseG 91 | UXQrDU4ApAQGhV6vWBFuaBaC0sAMCQXQiVRZOWqwWa3hcCBQMM8wJUkGXjDqLrkc4sQrhHkdfJ8I 92 | yAgBb3x9EgcIBwOCRIVrCAgEgoKNE2MIP5KUEgaPBhaTmpyQn1V9j6OZlAKPCW6lcQUICQhdjQGy 93 | CQWaFAYJvq99Bb65uxLCvrS7AQfDgZoBx8iEjYeyzspSdMUXN8ARACH5BAUKAAoALO0AngAeAB4A 94 | AAS0EMhJZQgi38q7FUM4ECQ5eB4GisRYkgJKZZlYuy8RyDS4VQFXoaBL9WQS0rCwA6qaSMBgSeBc 95 | BNCodGg4TS4/7YRgKBgoYDGncOha0moK2XB+xysCumHHv1f0Xn4cc4GCcgcHVYYVZgcFi4yIhZCI 96 | B5OGApUxkEkHCAecFp6OoQAGnwhZhgQIrYqQBa2fnAGnsqpxUwkICbu4MgGVB73EvmoYrMXFj8cg 97 | bLzECEyCGFNERTIRACH5BAUKAAoALO4AngAdAB4AAASrEMhJQbi46i2x+N8gChzngaE4lhR2Ca+g 98 | zqzlboE8EDyb1TseoRSoUQTCodGI5JGWQCHUKBxMWbuC8ooreIvcjbfwDFcIXqv57N2uJQSD9k2J 99 | G9R0gGFffgf2BmB0dgZ5FoBuawUGBwctZgSNB245MoVLkY2XFFkIB4Jdkp8aAZEICQkGfRJInp6j 100 | OAanqKgHgAi4B7mgGwSztKinuLiJRLLAtMS8S017TjURACH5BAUKAAoALO0AngAeAB4AAAS2EMhJ 101 | a6g4axC671s4fZ1gXmJGBmYrpDDrwrA5DC8tBveti4Je7qcJ+oibG2GIrAgIhEFTBSWgppQqEwsY 102 | QAVXrjcK4nahA5lZG6hyCYVloFA4bHVz+sVwQBimA3QEEgMICAlhOnQFUhyHCQdIcAYFWQmXfzqT 103 | jBWPCZUwBAajoBQCngeJFqKjBqqOlwkIBXdtraOvEgGehn4FlAfBwbgpBbG9CH3CwYM0AQbIycnM 104 | uUBQlFF3FREAIfkEBQoACgAs7QCeAB4AHgAABLwQyEmrvTjrzWfoYCCKIDeSpXZ+FpuKAuq5r2DT 105 | Q5x6tjAJhAEt1WMRCgTfThLoAQIGw0G5BAyu1gMCUZ1chYTtoSsRXKGIxJhszhkSajKgDYSvu2ZC 106 | gABPyAlBNn1UO3uAEmkJBXiABBIFfUMgjUoBfQZLA40UkAkIiyWagIQAW1ugHANIhxUBpggGkhVH 107 | BUiyrmIISS2qtbYZAVoIB8QHSEhRUbV6HGHFxcnKBgMle88H0QXUVQFXtWcbEQAh+QQFCgAKACzt 108 | AJ8AHgAdAAAEuhDIOUOgOGsqhtjgFhDEcIWoFBhGYaZocMwGAaMHots3WCRAQ6+CCQATh6HKcgL8 109 | gM0hc4IIKitTI3BwxV4Ix+5EYAGAkWKVgGywpgNrmVsMJ4MRwvTaXkWkAXtwOghRUgMeEoM8Vx2I 110 | TjoHhTeHLwABCDkFjJQUBJgHizACJY4TMzOhIaMDJRkypwWSGKwkXBqvBywEH0W0JKlFLLksNb8E 111 | BcbAGgTELAXPz8ckvDfMzi3QrV1wtHEoEQA7""" 112 | 113 | # we don't use stdin because we need file for --loop inf to work 114 | base64 -d <<< "$LOADING" > "$NICOPLAY_DIR/loading.gif" 115 | mpv --really-quiet --loop inf "$NICOPLAY_DIR/loading.gif" & 116 | loading_pid=$! 117 | 118 | # grab title to make sure this video works and we don't get stuck later 119 | start=$(date +"%s") 120 | nicowrap -g "$@" || err "failed to grab title" 121 | end=$(date +"%s") 122 | diff=$(($end-$start)) 123 | 124 | # if danmaku2ass is installed, use it for subtitles 125 | if hash danmaku2ass &> /dev/null; then 126 | if nicowrap -s -c -x --comment-output="$NICOPLAY_DIR/nicovideo.xml" "$@" &> /dev/null; then 127 | danmaku2ass -o "$NICOPLAY_DIR/nicovideo.ass" -r -s 1280x720 -fs 48 -a 0.8 -l 5 "$NICOPLAY_DIR/nicovideo.xml" &> /dev/null 128 | rm -f "$NICOPLAY_DIR/nicovideo.xml" 129 | fi 130 | fi 131 | 132 | # start filling fifo with data 133 | mkfifo -m 666 "$NICOPLAY_DIR/nicovideo.fifo" 134 | nicowrap -o "$NICOPLAY_DIR/nicovideo.fifo" "$@" &> /dev/null & 135 | 136 | # we sleep with the difference of first request for instant playback 137 | sleep $diff 138 | 139 | # stop if user quit the loading screen 140 | if ! kill -0 $loading_pid &> /dev/null; then 141 | exit 0 142 | fi 143 | 144 | # kill loading screen and start playing the video 145 | kill $loading_pid &> /dev/null 146 | mpv --really-quiet "$NICOPLAY_DIR/nicovideo.fifo" 147 | 148 | # vim: set ts=8 sw=3 tw=0 : 149 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/openbooru: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # If image has .json file as well 3 | # it will look for danbooru post id from it and open in browser 4 | # 5 | # The .json files are generated by 'danbooru' script 6 | # This script can be executed from terminal, or binded to image viewer (such as sxiv) 7 | # 8 | # needs: jshon 9 | 10 | main() { 11 | [[ -f "$@" ]] || return 12 | [[ -f "${@%.*}.json" ]] || return 13 | local ID="$(jshon -F "${@%.*}.json" -e "id" -u)" 14 | [[ -n "$ID" ]] || return 15 | "$BROWSER" "http://danbooru.donmai.us/posts/$ID" 16 | } 17 | main $@ 18 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/opendir: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Directory opener called from linopen 3 | 4 | [[ -n "$TERMINAL" ]] || TERMINAL="termite" 5 | sh -c "cd \"$@\" && $TERMINAL &" 6 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/pacup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # check pacman updates 3 | # the core of this script resides in 4 | # /etc/cron.d/hourly/pacman_update 5 | # and wont work without it. 6 | 7 | _UPDATES_DB="/tmp/.pacman_updates" 8 | 9 | main() { 10 | [[ -d "$_UPDATES_DB" ]] || return 11 | pacman -Qu --dbpath "$_UPDATES_DB" $@ 12 | } 13 | main "$@" 14 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/qtermite: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Termite quake console 3 | # 4 | # needs: termite, xdotool 5 | 6 | # border width * 2 7 | BORDER=4 8 | 9 | # width && height 10 | WIDTH=$((1680-BORDER)) 11 | HEIGHT=300 12 | 13 | # offset 14 | X=0 15 | Y=0 16 | 17 | # spawn 18 | spawn() { 19 | termite --name qtermite --class qtermite --geometry $WIDTHx$HEIGHT+$X+$Y & 20 | sleep 0.5 21 | while [[ ! -n "$wid" ]]; do 22 | wid="$(xdotool search --classname qtermite | tail -1)" 23 | done 24 | xdotool windowsize $wid $WIDTH $HEIGHT 25 | xdotool windowmove $wid $X $Y 26 | xdotool windowsize $wid $WIDTH $HEIGHT 27 | xdotool windowraise $wid 28 | } 29 | 30 | # toggle 31 | toggle() { 32 | local wid="$@" 33 | local visible="$(xdotool search --onlyvisible --classname qtermite 2>/dev/null | tail -1)" 34 | [[ ! -n "$visible" ]] && { 35 | xdotool windowmap $wid 36 | xdotool windowsize $wid $WIDTH $HEIGHT 37 | xdotool windowmove $wid $X $Y 38 | xdotool windowraise $wid 39 | } || { 40 | xdotool windowunmap $wid 41 | } 42 | } 43 | 44 | # main 45 | main() { 46 | local wid="$(xdotool search --classname qtermite 2>&1 | tail -1)" 47 | [[ "$wid" == *BadWindow* ]] && exit 48 | [[ ! -n "$wid" ]] && { spawn; } || toggle "$wid" 49 | } 50 | main $@ 51 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/relink: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # relink symbolic links 3 | # 4 | # provide regual expression to modify 5 | # the current symlink path, and relink 6 | # if regular expression affected the path. 7 | # 8 | # -q to silent 'no such symbolic link warnings' 9 | 10 | usage() { 11 | echo "usage: $(basename $0) [-q] " 12 | exit 1 13 | } 14 | 15 | badregexp() { 16 | echo "^ invalid regular expression" 1>&2 17 | exit 1 18 | } 19 | 20 | main() { 21 | local quiet=0 22 | [[ -n "$1" ]] && [[ -n "$2" ]] || usage 23 | [[ "$1" == "-q" ]] && { quiet=1; shift 1; } 24 | echo -n "" | sed "$1" || badregexp 25 | local exp="$1"; shift 1 26 | while [[ -n "$1" ]]; do 27 | [[ -h "$1" ]] && { 28 | op="$(readlink "$1")" 29 | np="$(echo "$op" | sed "$exp")" 30 | [[ "$op" == "$np" ]] && { shift || break; continue; } 31 | ln -snf "$np" "$1" && echo "$1 -> $np" 32 | } || [[ -e "$1" ]] && { 33 | # skip normal files and directories 34 | foo=bar # avoid bash syntax error 35 | } || { 36 | [[ $quiet -eq 0 ]] && echo "$1: No such symbolic link" 1>&2 37 | } 38 | shift || break 39 | done 40 | } 41 | main "$@" 42 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/scrotwin: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # uses import now since it seems to work 3 | import -window $(xdotool getwindowfocus) $@ 4 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/sspacman: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # color output of -Ss 3 | 4 | [[ -n "$PACMAN" ]] || { 5 | PACMAN="pacman" 6 | } 7 | 8 | C[0]="\033[33m" # core 9 | C[1]="\033[34m" # extra 10 | C[2]="\033[32m" # community 11 | C[3]="\033[35m" # multilib 12 | C[4]="\033[31m" # other 13 | "$PACMAN" -Ss "$@" | \ 14 | sed "s/^core\//`printf "${C[0]}core\033[0m\/"`/" | \ 15 | sed "s/^extra\//`printf "${C[1]}extra\033[0m\/"`/" | \ 16 | sed "s/^community\//`printf "${C[2]}community\033[0m\/"`/" | \ 17 | sed "s/^multilib\//`printf "${C[3]}multilib\033[0m\/"`/" | \ 18 | sed "s/^\([^ ].*\)\//`printf "${C[4]}"`\1`printf "\033[0m\/"`/" 19 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/stalonetrayd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Docker wrapper 3 | # 4 | # needs: docker, xdotool 5 | 6 | # border width * 2 7 | BORDER=4 8 | 9 | # width && height 10 | WIDTH=$((1680-BORDER)) 11 | HEIGHT=32 12 | 13 | # offset 14 | X=0 15 | Y=$((1050-HEIGHT-BORDER)) 16 | 17 | # spawn 18 | spawn() { 19 | local wid= 20 | /usr/bin/stalonetray -bg "#000000" -i 28 --sticky --skip-taskbar --no-shrink & 21 | sleep 0.5 22 | while [[ ! -n "$wid" ]]; do 23 | wid="$(xdotool search --classname stalonetray | head -1)" 24 | done 25 | xdotool windowsize $wid $WIDTH $HEIGHT 26 | xdotool windowmove $wid $X $Y 27 | xdotool windowunmap $wid 28 | } 29 | 30 | # toggle 31 | toggle() { 32 | local wid="$@" 33 | local visible="$(xdotool search --onlyvisible --classname stalonetray 2>/dev/null)" 34 | [[ ! -n "$visible" ]] && { 35 | xdotool windowsize $wid $WIDTH $HEIGHT 36 | xdotool windowmap $wid 37 | xdotool windowmove $wid $X $Y 38 | xdotool windowraise $wid 39 | } || { 40 | xdotool windowunmap $wid 41 | } 42 | } 43 | 44 | # main 45 | main() { 46 | local wid="$(xdotool search --classname stalonetray 2>&1 | head -1)" 47 | [[ "$wid" == *BadWindow* ]] && exit 48 | [[ ! -n "$wid" ]] && { spawn; } || toggle "$wid" 49 | } 50 | main $@ 51 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/svol: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Volume utility 3 | # Origin from dvol, nowadays it's without dzen 4 | # Handles some volume quirks, and can be used either with ALSA or OSSv4 5 | # 6 | # needs: amixer or ossvol 7 | 8 | # customize this stuff 9 | IF="Master" # audio channel: Master|PCM 10 | MF="Master" # mute channel 11 | err() { echo "$@" 1>&2; exit 1; } 12 | 13 | # usage 14 | usage() { 15 | echo "usage: $(basename $0) [option] [argument]" 16 | echo 17 | echo "Options:" 18 | echo " -i, --increase - increase volume by \`argument'" 19 | echo " -d, --decrease - decrease volume by \`argument'" 20 | echo " -t, --toggle - toggle mute on and off" 21 | echo " -h, --help - display this" 22 | exit 23 | } 24 | 25 | # ALSA argument handling 26 | alsa_arg() 27 | { 28 | case "$1" in 29 | '-i'|'--increase') 30 | [[ -n "$2" ]] || err "No argument specified for increase." 31 | [[ -n "$(tr -d [0-9] <<<$2)" ]] && err "The argument needs to be an integer." 32 | MIXARG="${2}%+" 33 | ;; 34 | '-d'|'--decrease') 35 | [[ -n "$2" ]] || err "No argument specified for decrease." 36 | [[ -n "$(tr -d [0-9] <<<$2)" ]] && err "The argument needs to be an integer." 37 | MIXARG="${2}%-" 38 | ;; 39 | '-t'|'--toggle') 40 | MIXARG="toggle" 41 | IF="$MF" 42 | ;; 43 | ''|'-h'|'--help') 44 | usage 45 | ;; 46 | *) 47 | err "Unrecognized option \`$1', see dvol --help" 48 | ;; 49 | esac 50 | 51 | echo "$MIXARG" 52 | } 53 | 54 | # OSSv4 argument handling 55 | oss_arg() 56 | { 57 | case "$1" in 58 | '-i'|'--increase') 59 | [[ -n "$2" ]] || err "No argument specified for increase." 60 | [[ -n "$(tr -d [0-9] <<<$2)" ]] && err "The argument needs to be an integer." 61 | MIXARG="-i $2" 62 | ;; 63 | '-d'|'--decrease') 64 | [[ -n "$2" ]] && err "No argument specified for decrease." 65 | [[ -n "$(tr -d [0-9] <<<$2)" ]] && err "The argument needs to be an integer." 66 | MIXARG="-d $2" 67 | ;; 68 | '-t'|'--toggle') 69 | MIXARG="-t" 70 | ;; 71 | ''|'-h'|'--help') 72 | usage 73 | ;; 74 | *) 75 | err "Unrecognized option \`$1', see dvol --help" 76 | ;; 77 | esac 78 | 79 | echo "$MIXARG" 80 | } 81 | 82 | # OSSv4 Volume handling 83 | ossvolume() 84 | { 85 | MIXARG="$(oss_arg $@)" 86 | 87 | # OSSv4 88 | # Simple, clean and works 89 | ossvol $MIXARG &> /dev/null # | sed 's/^.* //' <- for getting volume 90 | } 91 | 92 | # ALSA Volume handling 93 | alsavolume() 94 | { 95 | MIXARG="$(alsa_arg $@)" 96 | 97 | AMIXOUT="$(amixer set "$IF" "$MIXARG" | tail -n 1)" 98 | VOL="$(cut -d '[' -f 2 <<<"$AMIXOUT" | sed 's/%.*//g')" 99 | 100 | # Stupid alsa still playing sound even that MASTER vol is 0 <_< 101 | # Go figure, other channels won't help here. 102 | # 103 | # So hack to workaround it. If OSSv4 ever takes off, switch to it. 104 | # Has currently problems with few applications while using vmix. 105 | 106 | [[ "$VOL" == "0" ]] && { 107 | # Volume == 0, mute the mute channel 108 | amixer set "$MF" "mute" &> /dev/null 109 | } || { 110 | # If we did not press mute button, unmute 111 | [[ "$MIXARG" == "toggle" ]] || amixer set "$MF" "unmute" &> /dev/null 112 | } 113 | } 114 | 115 | # Pick one! 116 | # ossvolume $@ 117 | alsavolume $@ 118 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/urlhandler: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Common url handler 3 | # termite uses this 4 | 5 | # $@ = Get domain from url 6 | domain() { 7 | echo "$@" | sed -e "s/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/" 8 | } 9 | 10 | # $@ = URL 11 | main() { 12 | case "$(domain "$@")" in 13 | *nicovideo.jp) 14 | nicoplay "$@" &> /dev/null 15 | ;; 16 | *) 17 | { 18 | read -r title 19 | read -r url 20 | } < <(youtube-dl --default-search "plznosearch:" -eg "$@") 21 | 22 | if [[ -n "$url" ]]; then 23 | mpv --really-quiet --loop=inf --title="$title" "$url" & 24 | else 25 | "$BROWSER" "$@" &> /dev/null & 26 | fi 27 | ;; 28 | esac 29 | } 30 | main "$@" 31 | -------------------------------------------------------------------------------- /#ARCHCONFIG/bin/wallhead: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Set head wallpaper, workaround broken --save in nitrogen 3 | # $1 = head 4 | # $2 = wallpaper 5 | 6 | [[ -n "$1" ]] && [[ -n "$2" ]] || { echo "usage: $(basename $0) [head] [file]"; exit 0; } 7 | [[ -f "$2" ]] || { echo "$2 doesn't exist!"; exit 1; } 8 | CFGDIR=${XDG_CONFIG_HOME-$HOME/.config} 9 | sed -i "/^\[xin_$1\]/,/^$/d" "$CFGDIR/nitrogen/bg-saved.cfg" || exit 1 10 | nitrogen --head=$1 --set-auto "$2" &> /dev/null || { nitrogen --restore; exit 1; }; 11 | echo "[xin_$1]" >> "$CFGDIR/nitrogen/bg-saved.cfg" 12 | echo "file=$2" >> "$CFGDIR/nitrogen/bg-saved.cfg" 13 | echo "mode=4" >> "$CFGDIR/nitrogen/bg-saved.cfg" 14 | echo "bgcolor=#000000" >> "$CFGDIR/nitrogen/bg-saved.cfg" 15 | echo "" >> "$CFGDIR/nitrogen/bg-saved.cfg" 16 | echo "$2 [$1]" 17 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/X11/xorg.conf.d/20-nvidia.conf: -------------------------------------------------------------------------------- 1 | Section "ServerLayout" 2 | Identifier "Layout0" 3 | Screen 0 "Screen0" 0 0 4 | Option "Xinerama" "0" 5 | EndSection 6 | 7 | Section "Device" 8 | Identifier "nVidia GeForce GTX 650" 9 | Driver "nvidia" 10 | VendorName "nVidia Corporation" 11 | BoardName "GeForce GeForce GTX 650" 12 | 13 | Option "NoLogo" "1" 14 | Option "RenderAccel" "1" 15 | Option "TripleBuffer" "0" 16 | Option "DamageEvents" "1" 17 | Option "BackingStore" "1" 18 | Option "OnDemandVBlankInterrupts" "1" 19 | Option "Coolbits" "1" 20 | Option "RegistryDwords" "OGL_MaxFramesAllowed=0x0; EnableBrightnessControl=1; PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerDefaultAC=0x1" 21 | EndSection 22 | 23 | Section "Screen" 24 | Identifier "Screen0" 25 | Device "Device0" 26 | Monitor "Monitor0" 27 | DefaultDepth 24 28 | Option "nvidiaXineramaInfoOrder" "DFP-1" 29 | Option "metamodes" "DFP-0: nvidia-auto-select +1680+0, DFP-1: nvidia-auto-select +0+0;" 30 | SubSection "Display" 31 | Depth 24 32 | EndSubSection 33 | EndSection 34 | 35 | # Enable if problems with tearing 36 | # 37 | # Section "Extensions" 38 | # Option "Composite" "Disable" 39 | # EndSection 40 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/asound.conf: -------------------------------------------------------------------------------- 1 | # ALSA 2 | # /etc/asound.conf 3 | 4 | # ipc_key - must be unique, it has no other meaning. 5 | # ipc_key_add_uid - allows multi user audio when false. 6 | # ipc_perm - sets permissions, may fix issues on multi user or tty playback. 7 | 8 | # smaller buffer/period sizes can generally reduce latency and hence give better performance, 9 | # but going too small can cause crackling or other sound issues. 10 | 11 | # Better resampling 12 | defaults.pcm.rate_converter "samplerate_best" 13 | 14 | # 44100Hz 15 | # Lossless CD quality 16 | 17 | # Sound card 18 | pcm.snd_card { 19 | type hw 20 | card 0 21 | } 22 | 23 | # Audio out 24 | pcm.aout { 25 | type dmix 26 | ipc_key 1 27 | ipc_key_add_uid false 28 | ipc_perm 0666 29 | slave { 30 | pcm "snd_card" 31 | rate 44100 32 | channels 2 33 | 34 | # Buffer settings 35 | period_time 0 36 | period_size 1024 37 | buffer_time 0 38 | buffer_size 8192 39 | } 40 | } 41 | 42 | # Audio in 43 | pcm.ain { 44 | type dsnoop 45 | ipc_key 2 46 | ipc_key_add_uid false 47 | ipc_perm 0660 48 | slave.pcm "snd_card" 49 | } 50 | 51 | # Set playback routes 52 | pcm.asymed { 53 | type asym 54 | playback.pcm "aout" 55 | capture.pcm "ain" # Input won't work with aout settings ;) 56 | } 57 | 58 | # Surround 5.1 -> Stereo 59 | pcm.!surround51 { 60 | type vdownmix 61 | slave.pcm "aout" 62 | } 63 | 64 | # Surround 4.0 -> Stereo 65 | pcm.!surround40 { 66 | type vdownmix 67 | slave.pcm "aout" 68 | } 69 | 70 | # OSS compatibility 71 | pcm.dsp0 { 72 | type plug 73 | slave.pcm "asymed" 74 | } 75 | 76 | # Default PCM 77 | pcm.!default { 78 | type plug 79 | slave.pcm "asymed" 80 | } 81 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/cron.hourly/pacman_update: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Pacman update script 3 | # 4 | # Doing -Sy to real database is dangerous. 5 | # For example, if your system were out of date 6 | # and cron job runs -Sy at background and you 7 | # were to install some package with -S now, 8 | # it could break things if some things were 9 | # dratastically changed. 10 | # 11 | # Thefore you should always run -Syu manually. 12 | # 13 | # What this script does is, that it syncs 14 | # a new temporari database to /tmp and 15 | # symlinks your local database there as well 16 | # and just runs -Sy on this temporary database. 17 | # 18 | # You can then obtain the update count from 19 | # userspace bu doing 'pacman -Qu --dbpath /tmp/.pacman_updates' 20 | 21 | _UPDATES_DB="/tmp/.pacman_updates" 22 | _LOG_FILE="$_UPDATES_DB/pacman.log" 23 | _LOCAL_DB="/var/lib/pacman/local" 24 | 25 | main() { 26 | [[ -d "$_UPDATES_DB" ]] || { 27 | mkdir -p "$_UPDATES_DB" || return 28 | ln -s "$_LOCAL_DB" "$_UPDATES_DB" || return 29 | } 30 | pacman -Sy --dbpath "$_UPDATES_DB" --logfile "$_LOG_FILE" &> /dev/null 31 | } 32 | main "$@" 33 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/fonts/conf.d/70-no-ugly-fonts.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | terminus 9 | 10 | 11 | 12 | 13 | false 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | sans-serif 22 | 23 | 24 | serif 25 | 26 | 27 | monospace 28 | 29 | 30 | sans-serif 31 | 32 | 33 | DejaVu Sans 34 | 35 | 36 | 37 | 38 | 39 | 40 | monospace 41 | 42 | 43 | DejaVu Sans Mono 44 | 45 | 46 | 47 | 48 | 49 | 50 | DejaVu Sans 51 | IPAMonaGothic 52 | HanaMinB 53 | Monapo 54 | Symbola 55 | 56 | 57 | 58 | 59 | 60 | 61 | 10 62 | 63 | 64 | DejaVu Sans 65 | 66 | 67 | false 68 | 69 | 70 | 71 | 72 | 73 | 74 | ja 75 | 76 | 77 | true 78 | 79 | 80 | 81 | 82 | zh 83 | 84 | 85 | true 86 | 87 | 88 | 89 | 90 | zh 91 | 92 | 93 | yes 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/hostname: -------------------------------------------------------------------------------- 1 | LOLI 2 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/linopen.conf: -------------------------------------------------------------------------------- 1 | # 2 | # linopen configuration 3 | # enviroiment variables can be used 4 | # 5 | 6 | # Specify your terminal emulator here 7 | # for terminal support. 8 | terminal=$TERMINAL 9 | 10 | # Specify all programs you want to 11 | # open in terminal like this: 12 | interm=vim 13 | interm=listarchive 14 | 15 | # There are 4 ways to match filetypes. 16 | # The following examples are in the order 17 | # which linopen chooses the program as well. 18 | 19 | # 1. File extension 20 | # .png:sxiv 21 | # .mp4:mplayer 22 | # .txt:vim 23 | 24 | # Workaround until mimetype fixed in libmagic 25 | .mkv:mpv 26 | .mp3:mpv->interm 27 | .ogg:mpv->interm 28 | 29 | # 2. Mime type 30 | # image/png:sxiv 31 | # video/mp4:mplayer 32 | # text/plain:vim 33 | application/pdf:zathura 34 | application/zip:listarchive 35 | application/x-tar:listarchive 36 | application/x-gtar:listarchive 37 | application/x-bzip2:listarchive 38 | application/x-gzip:listarchive 39 | application/x-lzip:listarchive 40 | application/x-lzma:listarchive 41 | application/x-lzop:listarchive 42 | application/x-xz:listarchive 43 | application/x-7z-compressed:listarchive 44 | application/x-rar:listarchive 45 | 46 | # 3. Mime category 47 | image:sxiv 48 | video:mpv 49 | audio:mpv->interm 50 | text:vim 51 | 52 | # 4. Regexp 53 | # Match some protocols by default 54 | ?'^http:\/\/':urlhandler 55 | ?'^https:\/\/':urlhandler 56 | ?'^www.':urlhandler 57 | ?'^dvd:\/\/':mpv 58 | ?'^cdda:\/\/':mpv->interm 59 | 60 | # Directory rule for directories 61 | # ideally you want to use file manager 62 | # here if you are a GUI user. 63 | directory:opendir 64 | 65 | # Default rule just echoes back whatever 66 | # was feed. If you are using DE you could 67 | # just map a file manager here and it would 68 | # integrate with your system. 69 | default:echo 70 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/locale.conf: -------------------------------------------------------------------------------- 1 | LANG="en_US.UTF-8" 2 | LC_COLLATE="C" 3 | LC_TIME="fi_FI.UTF-8" 4 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/mpd.conf: -------------------------------------------------------------------------------- 1 | # See: /usr/share/doc/mpd/mpdconf.example 2 | 3 | music_directory "/mnt/東方/music" 4 | pid_file "/run/mpd/mpd.pid" 5 | db_file "/var/lib/mpd/mpd.db" 6 | state_file "/var/lib/mpd/mpdstate" 7 | playlist_directory "/var/lib/mpd/playlists" 8 | log_file "/var/log/mpd/mpd.log" 9 | max_playlist_length "65535" 10 | max_output_buffer_size "16384" 11 | max_command_list_size "4096" 12 | user "mpd" 13 | group "mpd" 14 | # bind_to_address "127.0.0.1" 15 | # port "6600" 16 | 17 | audio_output { 18 | type "alsa" 19 | name "card0" 20 | device "default" 21 | format "44100:16:2" 22 | auto_resample "no" 23 | use_mmap "yes" 24 | } 25 | 26 | audio_output { 27 | type "httpd" 28 | name "東方MPD" 29 | encoder "vorbis" 30 | port "8000" 31 | quality "10.0" 32 | format "44100:16:2" 33 | } 34 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/mpv/mpv.conf: -------------------------------------------------------------------------------- 1 | # 2 | # mpv configuration file 3 | # 4 | 5 | # GTX 650 tears with xv (supports vsync only with 3d?) 6 | # vdpau is unstable, don't use it 7 | vo=opengl-hq 8 | 9 | # alsa (use channels 6 for 5.1 emulation) 10 | ao=alsa 11 | audio-channels=6 12 | 13 | # i like anime 14 | alang=Japanese,jpn,ja 15 | slang=English,eng,en 16 | 17 | # volume normalization 18 | af=drc 19 | 20 | # A/V sync 21 | # mc=0.2 22 | # autosync=30 23 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/sysctl.d/99-sysctl.conf: -------------------------------------------------------------------------------- 1 | # Configuration file for runtime kernel parameters. 2 | # See sysctl.conf(5) for more information. 3 | 4 | # Have the CD-ROM close when you use it, and open when you are done. 5 | #dev.cdrom.autoclose = 1 6 | #dev.cdrom.autoeject = 1 7 | 8 | # Protection from the SYN flood attack. 9 | net.ipv4.tcp_syncookies = 1 10 | 11 | # See evil packets in your logs. 12 | #net.ipv4.conf.all.log_martians = 1 13 | 14 | # Never accept redirects or source routes (these are only useful for routers). 15 | #net.ipv4.conf.all.accept_redirects = 0 16 | #net.ipv4.conf.all.accept_source_route = 0 17 | #net.ipv6.conf.all.accept_redirects = 0 18 | #net.ipv6.conf.all.accept_source_route = 0 19 | 20 | # Disable packet forwarding. 21 | net.ipv4.ip_forward = 0 22 | net.ipv6.conf.all.forwarding = 0 23 | 24 | # Tweak the port range used for outgoing connections. 25 | #net.ipv4.ip_local_port_range = 32768 61000 26 | 27 | # Tweak those values to alter disk syncing and swap behavior. 28 | vm.vfs_cache_pressure = 50 29 | #vm.laptop_mode = 0 30 | vm.swappiness = 5 31 | 32 | # The number of pages at which a process which is generating disk writes will start writing out dirty data. 33 | vm.dirty_bytes = 67108864 34 | 35 | # The number of pages at which the background kernel flusher threads will start writing out dirty data. 36 | vm.dirty_background_bytes = 4194304 37 | 38 | # Dirty writeback to 6000 centiseconds 39 | vm.dirty_writeback_centisecs = 6000 40 | 41 | # Tweak how the flow of kernel messages is throttled. 42 | #kernel.printk_ratelimit_burst = 10 43 | #kernel.printk_ratelimit = 5 44 | 45 | # Reboot 600 seconds after kernel panic or oops. 46 | #kernel.panic_on_oops = 1 47 | #kernel.panic = 600 48 | 49 | # Disable SysRq key to avoid console security issues. 50 | kernel.sysrq = 1 51 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/systemd/bin/cpufreq.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # CPU freq options 3 | 4 | # Change ondemand governor's up threshold 5 | (sleep 10 && echo -n 25 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold) & 6 | exit 0 7 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/systemd/bin/hdparam.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # hdparam settings 3 | 4 | # Make HDD's silent 5 | hdparm -M254 /dev/disk/by-label/Anime &> /dev/null 6 | hdparm -M254 /dev/disk/by-label/Storage &> /dev/null 7 | exit 0 8 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/systemd/bin/powersave.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Power saving options 3 | 4 | # USB powersave 5 | for i in /sys/bus/usb/devices/*/power; do 6 | [[ -f "$i/autosuspend" ]] || continue; 7 | echo 2 > "$i/autosuspend"; 8 | done & 9 | 10 | # PCI, i2c powersave 11 | for i in /sys/bus/{pci,i2c}/devices/*/power/control; do echo auto > $i; done & 12 | 13 | # SATA powersave 14 | for i in /sys/class/scsi_host/host*/link_power_management_policy; do echo min_power > $i; done & 15 | echo min_power > /sys/class/scsi_host/host0/link_power_management_policy & 16 | 17 | # Sound card powersave 18 | echo 1 > /sys/module/snd_hda_intel/parameters/power_save & 19 | echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller & 20 | 21 | # Disable WOL 22 | which ethtool &> /dev/null && ethtool -s eth0 wol d & 23 | 24 | exit 0 25 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/systemd/bin/setterm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # setterm options 3 | 4 | # no blanking 5 | setterm -blank 0 6 | exit 0 7 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/systemd/bin/ssd-scheduler.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Set correct scheduler for SSD disks 3 | 4 | declare -ar SSDS=( 5 | 'ata-OCZ-AGILITY3_OCZ-PEOA50X8TS772L78' 6 | ) 7 | 8 | for SSD in "${SSDS[@]}"; do 9 | BY_ID=/dev/disk/by-id/$SSD 10 | if [[ -e "$BY_ID" ]]; then 11 | DEV_NAME=`ls -l $BY_ID | awk '{ print $NF }' | sed -e 's/[/\.]//g'` 12 | SCHED=/sys/block/$DEV_NAME/queue/scheduler 13 | 14 | if [[ -w $SCHED ]]; then 15 | echo noop > $SCHED 16 | fi 17 | fi 18 | done 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/systemd/system/autologin@.service: -------------------------------------------------------------------------------- 1 | # This file is part of systemd. 2 | # 3 | # systemd is free software; you can redistribute it and/or modify it 4 | # under the terms of the GNU Lesser General Public License as published by 5 | # the Free Software Foundation; either version 2.1 of the License, or 6 | # (at your option) any later version. 7 | 8 | [Unit] 9 | Description=Getty on %I 10 | Documentation=man:agetty(8) 11 | After=systemd-user-sessions.service plymouth-quit-wait.service 12 | After=rc-local.service 13 | 14 | # If additional gettys are spawned during boot then we should make 15 | # sure that this is synchronized before getty.target, even though 16 | # getty.target didn't actually pull it in. 17 | Before=getty.target 18 | IgnoreOnIsolate=yes 19 | 20 | # On systems without virtual consoles, don't start any getty. (Note 21 | # that serial gettys are covered by serial-getty@.service, not this 22 | # unit 23 | ConditionPathExists=/dev/tty0 24 | 25 | [Service] 26 | Environment=TERM=linux 27 | # the VT is cleared by TTYVTDisallocate 28 | ExecStart=-/sbin/agetty --noclear -a loli %I 38400 29 | Type=idle 30 | Restart=always 31 | RestartSec=0 32 | UtmpIdentifier=%I 33 | TTYPath=/dev/%I 34 | TTYReset=yes 35 | TTYVHangup=yes 36 | TTYVTDisallocate=yes 37 | KillMode=process 38 | IgnoreSIGPIPE=no 39 | 40 | # Unset locale for the console getty since the console has problems 41 | # displaying some internationalized messages. 42 | Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION= 43 | 44 | # Some login implementations ignore SIGTERM, so we send SIGHUP 45 | # instead, to ensure that login terminates cleanly. 46 | KillSignal=SIGHUP 47 | 48 | [Install] 49 | Alias=getty.target.wants/getty@tty1.service 50 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/systemd/system/cpufreq-loli.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=cpufreq options 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=/arch/etc/systemd/bin/cpufreq.sh 7 | TimeoutSec=0 8 | RemainAfterExit=YES 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | 13 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/systemd/system/hdparam-loli.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=hdparam options 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=/arch/etc/systemd/bin/hdparam.sh 7 | TimeoutSec=0 8 | RemainAfterExit=YES 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | 13 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/systemd/system/powersave-loli.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=powersaving options 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=/arch/etc/systemd/bin/powersave.sh 7 | TimeoutSec=0 8 | RemainAfterExit=YES 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | 13 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/systemd/system/setterm-loli.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=setterm options 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=/arch/etc/systemd/bin/setterm.sh 7 | TimeoutSec=0 8 | RemainAfterExit=YES 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | 13 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/systemd/system/ssd-scheduler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=SSD schedulers 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=/arch/etc/systemd/bin/ssd-scheduler.sh 7 | TimeoutSec=0 8 | RemainAfterExit=YES 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | 13 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/vconsole.conf: -------------------------------------------------------------------------------- 1 | KEYMAP=fi 2 | -------------------------------------------------------------------------------- /#ARCHCONFIG/etc/zathurarc: -------------------------------------------------------------------------------- 1 | # general 2 | set font "terminus 8" 3 | set adjust-open width 4 | 5 | # colors 6 | set highlight-color "#FD971F" 7 | set highlight-active-color "#F92672" 8 | set statusbar-bg "#000000" 9 | set statusbar-fg "#F92672" 10 | set inputbar-bg "#000000" 11 | set inputbar-fg "#F92672" 12 | set tabbar-fg "#FEFEFE" 13 | set tabbar-bg "#000000" 14 | set tabbar-focus-fg "#F92672" 15 | set tabbar-focus-bg "#000000" 16 | set default-bg "#000000" 17 | set default-fg "#FEFEFE" 18 | set completion-bg "#000000" 19 | set completion-fg "#FEFEFE" 20 | set completion-highlight-bg "#000000" 21 | set completion-highlight-fg "#F92672" 22 | set completion-group-bg "#000000" 23 | -------------------------------------------------------------------------------- /#ARCHCONFIG/passwd/README: -------------------------------------------------------------------------------- 1 | # 2 | # User credentials helper 3 | # for various user scripts and programs 4 | # 5 | 6 | Default database is stored in $HOME/.passwd 7 | All credentials are in plain text. 8 | 9 | This is not meant to be used to store actual 10 | sensitive information. Just easy and unified 11 | access for automated scripts and programs 12 | that just happen to need credentials. 13 | 14 | Supported languages: 15 | - Shell 16 | 17 | To use this library, source/include the 18 | /arch/passwd/libpasswd- 19 | 20 | And then refer to the include file for further 21 | documentation. 22 | -------------------------------------------------------------------------------- /#ARCHCONFIG/passwd/libpasswd-env: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Systemwide enviroiment file for shell 3 | # 4 | 5 | # Database path for expected password files 6 | export _PASSWD_DATABASE="$HOME/.passwd" 7 | -------------------------------------------------------------------------------- /#ARCHCONFIG/passwd/libpasswd-sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # libpasswd access for shell scripts 3 | # 4 | # _passwd_get_user "" - to get user 5 | # _passwd_get_pass "" - to get password 6 | # 7 | 8 | err() { echo "$@" 1>&2; } 9 | 10 | # $@ = password file in database 11 | _passwd_get_user() { 12 | [[ -d "$_PASSWD_DATABASE" ]] || 13 | { err "libpasswd: $_PASSWD_DATABASE database doesn't exist"; return; } 14 | [[ -f "$_PASSWD_DATABASE/$@" ]] && 15 | { head -n1 "$_PASSWD_DATABASE/$@"; return; } || 16 | err "libpasswd: credentials for $@, do not exist." 17 | } 18 | 19 | # $@ = password file in database 20 | _passwd_get_pass() { 21 | [[ -d "$_PASSWD_DATABASE" ]] || 22 | { err "libpasswd: $_PASSWD_DATABASE database doesn't exist"; return; } 23 | [[ -f "$_PASSWD_DATABASE/$@" ]] && 24 | { head -n2 "$_PASSWD_DATABASE/$@" | tail -n1; return; } || 25 | err "libpasswd: credentials for $@, do not exist." 26 | } 27 | -------------------------------------------------------------------------------- /#ARCHCONFIG/shell/LS_COLORS: -------------------------------------------------------------------------------- 1 | # LS_COLORS 2 | # Maintainer: Magnus Woldrich 3 | # URL: https://github.com/trapd00r/LS_COLORS 4 | # Version: 0.230 5 | # Updated: 2012-03-21 15:17:39 6 | # 7 | # This is a collection of extension:color mappings, suitable to use as your 8 | # LS_COLORS environment variable. Most of them use the extended color map, 9 | # described in the ECMA-48 document; in other words, you'll need a terminal 10 | # with capabilities of displaying 256 colors. 11 | # 12 | # As of this writing, around 300 different filetypes/extensions is supported. 13 | # That's indeed a lot of extensions, but there's a lot more! Therefore I need 14 | # your help. 15 | # 16 | # Fork this project on github, add the extensions you are missing, and send me 17 | # a pull request. 18 | # 19 | # For files that usually ends up next to each other, like html, css and js, 20 | # try to pick colors that fit nicely together. Filetypes with multiple 21 | # possible extensions, like htm and html, should have the same color. 22 | # 23 | # To install and use this file, put something like this is your shell resource 24 | # file: 25 | # 26 | # eval $( dircolors -b $HOME/.LS_COLORS) 27 | # 28 | # where .LS_COLORS is this file. 29 | 30 | 31 | BLK 38;5;68 32 | CAPABILITY 38;5;17 33 | CHR 38;5;113;1 34 | DIR 38;5;30 35 | DOOR 38;5;127 36 | EXEC 38;5;166;1 37 | FIFO 38;5;126 38 | FILE 38;5;253 39 | LINK target 40 | MULTIHARDLINK 38;5;220;1 41 | NORMAL 38;5;254 42 | ORPHAN 48;5;196;38;5;232;1 43 | OTHER_WRITABLE 38;5;220;1 44 | SETGID 48;5;234;38;5;100;1 45 | SETUID 38;5;137 46 | SOCK 38;5;197 47 | STICKY 38;5;86;48;5;234 48 | STICKY_OTHER_WRITABLE 48;5;235;38;5;139;3 49 | 50 | 51 | # code, text, documents {{{ 52 | .BAT 38;5;108 53 | .PL 38;5;160 54 | .asm 38;5;240;1 55 | .awk 38;5;148;1 56 | .bash 38;5;173 57 | .bat 38;5;108 58 | .c 38;5;110 59 | .cfg 1 60 | .coffee 38;5;94;1 61 | .conf 1 62 | .cpp 38;5;24;1 63 | .cs 38;5;74;1 64 | .css 38;5;91 65 | .csv 38;5;78 66 | .ctp 38;5;95 67 | .diff 48;5;197;38;5;232 68 | .enc 38;5;192;3 69 | .eps 38;5;192 70 | .etx 38;5;172 71 | .ex 38;5;148;1 72 | .example 38;5;225;1 73 | .git 38;5;197 74 | .gitignore 38;5;240 75 | .go 38;5;36;1 76 | .h 38;5;81 77 | .hs 38;5;155;1 78 | .htm 38;5;125;1 79 | .html 38;5;125;1 80 | .info 38;5;101 81 | .ini 38;5;122 82 | .java 38;5;142;1 83 | .jhtm 38;5;125;1 84 | .js 38;5;42 85 | .jsm 38;5;42 86 | .jsm 38;5;42 87 | .json 38;5;199 88 | .jsp 38;5;45 89 | .lisp 38;5;204;1 90 | .log 38;5;190 91 | .lua 38;5;34;1 92 | .map 38;5;58;3 93 | .markdown 38;5;184 94 | .md 38;5;184 95 | .mf 38;5;220;3 96 | .mfasl 38;5;73 97 | .mi 38;5;124 98 | .mkd 38;5;184 99 | .mtx 38;5;36;3 100 | .nfo 38;5;220 101 | .o 38;5;240 102 | .pacnew 38;5;33 103 | .patch 48;5;197;38;5;232;1 104 | .pc 38;5;100 105 | .pfa 38;5;43 106 | .php 38;5;93 107 | .pid 38;5;160 108 | .pl 38;5;214 109 | .pm 38;5;197;1 110 | .pod 38;5;172;1 111 | .py 38;5;41 112 | .rb 38;5;192 113 | .rdf 38;5;144 114 | .rst 38;5;67 115 | .ru 38;5;142 116 | .sed 38;5;130;1 117 | .sfv 38;5;197 118 | .sh 38;5;113 119 | .signature 38;5;206 120 | .sql 38;5;222 121 | .srt 38;5;116 122 | .sty 38;5;58 123 | .sug 38;5;44 124 | .t 38;5;28;1 125 | .tcl 38;5;64;1 126 | .tdy 38;5;214 127 | .tex 38;5;172 128 | .textile 38;5;106 129 | .tfm 38;5;64 130 | .tfnt 38;5;140 131 | .theme 38;5;109 132 | .txt 38;5;192 133 | .urlview 38;5;85 134 | .vim 1 135 | .viminfo 38;5;240;1 136 | .xml 38;5;199 137 | .yml 38;5;208 138 | .zsh 38;5;173 139 | 140 | # Build stuff 141 | .1 38;5;196;1 142 | .1p 38;5;160 143 | .3p 38;5;160 144 | .am 38;5;242 145 | .in 38;5;242 146 | .old 38;5;242 147 | .out 38;5;46;1 148 | 149 | 150 | 151 | 152 | #}}} 153 | # pictures, icons {{{ 154 | .bmp 38;5;62 155 | .cdr 38;5;59 156 | .gif 38;5;72 157 | .ico 38;5;73 158 | .jpeg 38;5;66 159 | .jpg 38;5;66 160 | .JPG 38;5;66 161 | .png 38;5;68;1 162 | .svg 38;5;24;1 163 | .xpm 38;5;36 164 | #}}} 165 | # Emulator roms, emulator savegames {{{ 166 | .32x 38;5;137 167 | .A64 38;5;82 168 | .a00 38;5;11 169 | .a52 38;5;112 170 | .a64 38;5;82 171 | .a78 38;5;112 172 | .adf 38;5;35 173 | .atr 38;5;213 174 | .cdi 38;5;124 175 | .fm2 38;5;35 176 | .gb 38;5;203 177 | .gba 38;5;205 178 | .gbc 38;5;204 179 | .gel 38;5;83 180 | .gg 38;5;138 181 | .ggl 38;5;83 182 | .j64 38;5;102 183 | .nds 38;5;193 184 | .nes 38;5;160 185 | .rom 38;5;59;1 186 | .sav 38;5;220 187 | .sms 38;5;33 188 | .st 38;5;208;1 189 | #}}} 190 | # images {{{ 191 | .iso 38;5;124 192 | .nrg 38;5;124 193 | .qcow 38;5;141 194 | #}}} 195 | # video {{{ 196 | .VOB 38;5;137 197 | .IFO 38;5;240 198 | .BUP 38;5;241 199 | .MOV 38;5;42 200 | .asf 38;5;25 201 | .avi 38;5;114 202 | .flv 38;5;131 203 | .m2v 38;5;166 204 | .mkv 38;5;202 205 | .mov 38;5;42 206 | .mp4 38;5;160 207 | .mpg 38;5;38 208 | .mpeg 38;5;38 209 | .ogm 38;5;97 210 | .ogv 38;5;94 211 | .rmvb 38;5;112 212 | .sample 38;5;130;1 213 | .ts 38;5;39 214 | .vob 38;5;137 215 | .webm 38;5;109 216 | .wmv 38;5;113 217 | #}}} 218 | # music, audio {{{ 219 | .S3M 38;5;71;1 220 | .aac 38;5;137 221 | .cue 38;5;112 222 | .dat 38;5;165 223 | .dts 38;5;100;1 224 | .fcm 38;5;41 225 | .flac 38;5;166;1 226 | .m3u 38;5;172 227 | .m4 38;5;196;3 228 | .m4a 38;5;137;1 229 | .mid 38;5;102 230 | .midi 38;5;102 231 | .mod 38;5;72 232 | .mp3 38;5;191 233 | .oga 38;5;95 234 | .ogg 38;5;96 235 | .s3m 38;5;71;1 236 | .sid 38;5;69;1 237 | .spl 38;5;173 238 | .wv 38;5;149 239 | .wvc 38;5;149 240 | #}}} 241 | # fonts {{{ 242 | .afm 38;5;58 243 | .pfb 38;5;58 244 | .pfm 38;5;58 245 | .ttf 48;5;1 246 | .pcf 38;5;65 247 | .psf 38;5;64 248 | #}}} 249 | # backups, undo files, tempfiles {{{ 250 | .bak 38;5;41;1 251 | .bin 38;5;249 252 | .swo 38;5;236 253 | .swp 38;5;241 254 | .tmp 38;5;244 255 | .un~ 38;5;240 256 | .zcompdump 38;5;240 257 | .zwc 38;5;240 258 | #}}} 259 | # databases {{{ 260 | .db 38;5;60 261 | .dump 38;5;119 262 | .sqlite 38;5;60 263 | .typelib 38;5;60 264 | 265 | #}}} 266 | # (compressed) archives {{{ 267 | .7z 38;5;40 268 | .a 38;5;46 269 | .arj 38;5;41 270 | .bz2 38;5;44 271 | .ipk 38;5;117 272 | .jad 38;5;50 273 | .jar 38;5;51 274 | .part 38;5;240;1 275 | .r00 38;5;235 276 | .r01 38;5;235 277 | .r02 38;5;235 278 | .r03 38;5;236 279 | .r04 38;5;237 280 | .r05 38;5;238 281 | .r06 38;5;239 282 | .r07 38;5;240 283 | .r08 38;5;241 284 | .r09 38;5;242 285 | .r10 38;5;243 286 | .r100 38;5;244 287 | .r101 38;5;240 288 | .r102 38;5;241 289 | .r103 38;5;242 290 | .r104 38;5;243 291 | .r105 38;5;244 292 | .r106 38;5;245 293 | .r107 38;5;246 294 | .r108 38;5;247 295 | .r109 38;5;248 296 | .r11 38;5;244 297 | .r110 38;5;249 298 | .r111 38;5;250 299 | .r112 38;5;251 300 | .r113 38;5;252 301 | .r114 38;5;253 302 | .r115 38;5;254 303 | .r116 38;5;255 304 | .r12 38;5;245 305 | .r13 38;5;246 306 | .r14 38;5;247 307 | .r15 38;5;248 308 | .r16 38;5;249 309 | .r17 38;5;250 310 | .r18 38;5;251 311 | .r19 38;5;252 312 | .r20 38;5;253 313 | .r21 38;5;254 314 | .r22 38;5;255 315 | .r25 38;5;255 316 | .r26 38;5;254 317 | .r27 38;5;253 318 | .r28 38;5;252 319 | .r29 38;5;251 320 | .r30 38;5;250 321 | .r31 38;5;249 322 | .r32 38;5;248 323 | .r33 38;5;247 324 | .r34 38;5;246 325 | .r35 38;5;245 326 | .r36 38;5;244 327 | .r37 38;5;243 328 | .r38 38;5;242 329 | .r39 38;5;241 330 | .r40 38;5;240 331 | .r41 38;5;239 332 | .r42 38;5;238 333 | .r43 38;5;237 334 | .r44 38;5;236 335 | .r45 38;5;235 336 | .r46 38;5;235 337 | .r47 38;5;235 338 | .r48 38;5;235 339 | .r49 38;5;235 340 | .r50 38;5;236 341 | .r51 38;5;237 342 | .r52 38;5;238 343 | .r53 38;5;239 344 | .r54 38;5;240 345 | .r55 38;5;241 346 | .r56 38;5;242 347 | .r57 38;5;243 348 | .r58 38;5;244 349 | .r59 38;5;245 350 | .r60 38;5;246 351 | .r61 38;5;247 352 | .r62 38;5;248 353 | .r63 38;5;249 354 | .r64 38;5;250 355 | .r65 38;5;251 356 | .r66 38;5;252 357 | .r67 38;5;253 358 | .r68 38;5;254 359 | .r69 38;5;255 360 | .r69 38;5;255 361 | .r70 38;5;254 362 | .r71 38;5;253 363 | .r72 38;5;252 364 | .r73 38;5;251 365 | .r74 38;5;250 366 | .r75 38;5;249 367 | .r76 38;5;248 368 | .r77 38;5;247 369 | .r78 38;5;246 370 | .r79 38;5;245 371 | .r80 38;5;244 372 | .r81 38;5;243 373 | .r82 38;5;242 374 | .r83 38;5;241 375 | .r84 38;5;240 376 | .r85 38;5;239 377 | .r86 38;5;238 378 | .r87 38;5;237 379 | .r88 38;5;236 380 | .r89 38;5;235 381 | .r90 38;5;235 382 | .r91 38;5;235 383 | .r92 38;5;236 384 | .r93 38;5;237 385 | .r94 38;5;238 386 | .r95 38;5;239 387 | .r96 38;5;240 388 | .r97 38;5;241 389 | .r98 38;5;242 390 | .r99 38;5;243 391 | .rar 38;5;106;1 392 | .tar 38;5;118 393 | .tar.gz 38;5;34 394 | .tgz 38;5;35;1 395 | .xz 38;5;118 396 | .zip 38;5;41 397 | #}}} 398 | # really compressed archives, but mostly used for documents, comics (and {{{ 399 | # documentation on MS Windows) 400 | .pdf 38;5;203 401 | .djvu 38;5;141 402 | .cbr 38;5;140 403 | .cbz 38;5;140 404 | .chm 38;5;144 405 | #}}} 406 | # open document formats {{{ 407 | .odt 38;5;111 408 | .ods 38;5;112 409 | .odp 38;5;166 410 | .odb 38;5;161 411 | #}}} 412 | # /etc/hosts.{deny,allow} {{{ 413 | .allow 38;5;112 414 | .deny 38;5;196 415 | #}}} 416 | # other {{{ 417 | .SKIP 38;5;244 418 | .def 38;5;136 419 | .directory 38;5;83 420 | .err 38;5;160;1 421 | .error 38;5;160;1 422 | .pi 38;5;126 423 | .properties 38;5;197;1 424 | .torrent 38;5;58 425 | .gp3 38;5;114 426 | .gp4 38;5;115 427 | .tg 38;5;99 428 | #}}} 429 | 430 | TERM Eterm 431 | TERM ansi 432 | TERM color-xterm 433 | TERM con132x25 434 | TERM con132x30 435 | TERM con132x43 436 | TERM con132x60 437 | TERM con80x25 438 | TERM con80x28 439 | TERM con80x30 440 | TERM con80x43 441 | TERM con80x50 442 | TERM con80x60 443 | TERM cons25 444 | TERM console 445 | TERM cygwin 446 | TERM dtterm 447 | TERM eterm-color 448 | TERM gnome 449 | TERM gnome-256color 450 | TERM jfbterm 451 | TERM konsole 452 | TERM kterm 453 | TERM linux 454 | TERM linux-c 455 | TERM mach-color 456 | TERM mlterm 457 | TERM putty 458 | TERM rxvt 459 | TERM rxvt-256color 460 | TERM rxvt-cygwin 461 | TERM rxvt-cygwin-native 462 | TERM rxvt-unicode 463 | TERM rxvt-unicode-256color 464 | TERM rxvt-unicode256 465 | TERM screen 466 | TERM screen-256color 467 | TERM screen-256color-bce 468 | TERM screen-bce 469 | TERM screen-w 470 | TERM screen.rxvt 471 | TERM screen.linux 472 | TERM terminator 473 | TERM vt100 474 | TERM xterm 475 | TERM xterm-16color 476 | TERM xterm-256color 477 | TERM xterm-88color 478 | TERM xterm-color 479 | TERM xterm-debian 480 | TERM xterm-termite 481 | 482 | # vim: set ft=dircolors fdm=marker et sw=2: 483 | -------------------------------------------------------------------------------- /#ARCHCONFIG/shell/README: -------------------------------------------------------------------------------- 1 | # 2 | # Systemwide shell configuration 3 | # (including zsh and bash) 4 | # 5 | 6 | Include /arch/zsh/zshrc from your .zshrc 7 | Include /arch/zsh/bashrc from your .bashrc 8 | 9 | Portable shell configuration is in /arch/zsh/shellrc, 10 | this is included by bashrc and zshrc automatically. 11 | -------------------------------------------------------------------------------- /#ARCHCONFIG/shell/alias: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Systemwide shell aliases 3 | # 4 | 5 | # coreutils aliases 6 | alias ls='ls++ --potsf' 7 | alias dir='dir -h --color=auto' 8 | alias vdir='vdir -h --color=auto' 9 | alias grep='grep --color=auto' 10 | alias fgrep='fgrep --color=auto' 11 | alias egrep='egrep --color=auto' 12 | alias du='du -sh' 13 | alias df='df -h' 14 | 15 | # interactive coreutils 16 | alias cp='cp -v' 17 | alias mv='mv -v' 18 | alias rm='rm -v' 19 | alias ln='ln -v' 20 | 21 | # less with ansi escapes 22 | alias less='less -R' 23 | 24 | # quick vim less alias 25 | local VLESS="$(find /usr/share/vim -name 'less.sh')" 26 | [[ -n "$VLESS" ]] && alias vl="$VLESS" 27 | 28 | # bell alias 29 | alias bell='echo \\007\\c' 30 | 31 | # mpd client aliases 32 | alias lm='lolimpd' 33 | alias m='lolimpdnu' 34 | alias lmr='sort -R /tmp/lolimpdnu.cache | head -n1 | sed "s/.*\t//" | xargs lolimpd play' 35 | 36 | # neat git log 37 | alias sgl='git log --decorate --pretty=oneline --abbrev-commit --graph' 38 | 39 | # vidir alias 40 | alias vd='vidir' 41 | 42 | # view image in clipboard 43 | alias cim='xcmenu -b image/png > /tmp/clipboard.png && { sxiv /tmp/clipboard.png; rm /tmp/clipboard.png; }' 44 | 45 | # get extrenal ip 46 | alias extip='curl -s http://icanhazip.com' 47 | 48 | # vim support 49 | alias :w='echo this is a shell, not vim.' 50 | alias :wq=:w 51 | alias :q='exit' 52 | 53 | # pacmatic wrapper 54 | alias pacman='pacmatic' 55 | alias q='/usr/bin/pacman -Q' 56 | alias r='sudo pacmatic -Rsn' 57 | alias s='sudo pacmatic -S' 58 | alias ssp='sspacman' 59 | alias u='sudo pacmatic -Syu' 60 | 61 | # systemd wrapper 62 | alias -- s+='sudo systemctl start' 63 | alias -- s-='sudo systemctl stop' 64 | alias sr='sudo systemctl restart' 65 | alias se='sudo systemctl enable' 66 | alias sd='sudo systemctl disable' 67 | alias st='systemctl status' 68 | 69 | # shortcuts 70 | alias -- +='sudo' 71 | alias -- -='less' 72 | alias \?='egrep' 73 | alias z\?='zegrep' 74 | alias ~='sed' 75 | alias @='cat' 76 | alias z@='zcat' 77 | -------------------------------------------------------------------------------- /#ARCHCONFIG/shell/bashrc: -------------------------------------------------------------------------------- 1 | # 2 | # Systemwide bashrc 3 | # 4 | 5 | # source global shell file 6 | # (tests for interactive shell) 7 | source "/arch/shell/shellrc" 8 | 9 | # source functions and aliases 10 | source "/arch/shell/functions" 11 | source "/arch/shell/alias" 12 | 13 | # bash settings 14 | shopt -s cdspell 15 | shopt -s checkwinsize 16 | shopt -s cmdhist 17 | shopt -s dirspell 18 | shopt -s histappend 19 | shopt -s hostcomplete 20 | shopt -s no_empty_cmd_completion 21 | shopt -s nocaseglob 22 | -------------------------------------------------------------------------------- /#ARCHCONFIG/shell/functions: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Systemwide shell functions 3 | # 4 | 5 | ######################### 6 | ## Colorized man pages ## 7 | ######################### 8 | man() { 9 | env \ 10 | LESS_TERMCAP_mb=$(printf "\e[1;31m") \ 11 | LESS_TERMCAP_md=$(printf "\e[1;31m") \ 12 | LESS_TERMCAP_me=$(printf "\e[0m") \ 13 | LESS_TERMCAP_se=$(printf "\e[0m") \ 14 | LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ 15 | LESS_TERMCAP_ue=$(printf "\e[0m") \ 16 | LESS_TERMCAP_us=$(printf "\e[1;32m") \ 17 | man "$@" 18 | } 19 | 20 | ##################################### 21 | ## Take screenshot of main monitor ## 22 | ##################################### 23 | shot() { 24 | local mon=$@ 25 | local file="$HOME/shot-$(date +'%H:%M-%d-%m-%Y').png" 26 | [[ -n "$mon" ]] || mon=0 27 | ffcast -x $mon % scrot -g %wx%h+%x+%y "$file" 28 | } 29 | 30 | ################### 31 | ## Capture video ## 32 | ################### 33 | capture() { 34 | ffcast -w ffmpeg -f alsa -ac 2 -i hw:0,2 -f x11grab -s %s -i %D+%c -acodec pcm_s16le -vcodec huffyuv $@ 35 | } 36 | 37 | ############################################## 38 | ## Colored Find ## 39 | ## NOTE: Searches current tree recrusively. ## 40 | ############################################## 41 | f() { 42 | find . -iregex ".*$@.*" -printf '%P\0' | xargs -r0 ls --color=auto -1d 43 | } 44 | 45 | ################ 46 | ## Smarter CD ## 47 | ################ 48 | goto() { 49 | [[ -d "$1" ]] && { cd "$1"; } || cd "$(dirname "$1")"; 50 | } 51 | 52 | #################### 53 | ## Copy && Follow ## 54 | #################### 55 | cpf() { 56 | cp "$@" && goto "$_"; 57 | } 58 | 59 | #################### 60 | ## Move && Follow ## 61 | #################### 62 | mvf() { 63 | mv "$@" && goto "$_"; 64 | } 65 | 66 | ##################### 67 | ## mkdir && follow ## 68 | ##################### 69 | mkcdr() { 70 | mkdir -vp "$@" && cd "$_"; 71 | } 72 | 73 | ######################## 74 | ## Print window class ## 75 | ######################## 76 | xclass() 77 | { 78 | xprop |awk ' 79 | /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print} 80 | /^WM_NAME/{sub(/.* =/, "title:"); print}' 81 | } 82 | 83 | ################################################################### 84 | ## Valgrind wrapper, use valgrind.supp for suppressions if found ## 85 | ################################################################### 86 | memleak() 87 | { 88 | [[ -f valgrind.supp ]] && { 89 | valgrind --suppressions=valgrind.supp "$@"; } || valgrind "$@" 90 | } 91 | 92 | ######################## 93 | ## Create tar archive ## 94 | ######################## 95 | mktar() { 96 | tar cvf "${1%%/}.tar" "${1%%/}/"; 97 | } 98 | 99 | ########################### 100 | ## Create tar.gz archive ## 101 | ########################### 102 | mktgz() { 103 | tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; 104 | } 105 | 106 | ############################ 107 | ## Create tar.bz2 archive ## 108 | ############################ 109 | mktbz() { 110 | tar cvjf "${1%%/}.tar.bz2" "${1%%/}/"; 111 | } 112 | 113 | ##################################################### 114 | ## Remux MKV to use only 1 audio && subtible track ## 115 | ##################################################### 116 | remux() { 117 | [[ -n "$1" ]] && [[ -n "$2" ]] && [[ -n "$3" ]] && [[ -n "$4" ]] || { 118 | echo "usage : remux [output] [input] [audio track to keep] [subtible track to keep]" 119 | return 120 | } 121 | mkvmerge -o "$1" -d 1 --audio-tracks "$3" --subtitle-tracks "$4" "$2" 122 | } 123 | 124 | ##################################################################### 125 | ## Same as earlier, expect you can batch whole directory with this ## 126 | ##################################################################### 127 | bremux() { 128 | local FILTER="*.mkv" 129 | [[ -n "$1" ]] && [[ -n "$2" ]] || { 130 | echo "usage : bremux [audio track] [subtible track] [filter]" 131 | return 132 | } 133 | [[ -n "$3" ]] && FILTER="$3" 134 | for i in $FILTER; do 135 | remux "[REMUX]$i" "$i" "$1" "$2" 136 | done 137 | } 138 | 139 | ############################################################ 140 | ## Print MKV info, use this to find out the track numbers ## 141 | ############################################################ 142 | mkv() { 143 | [[ -n "$@" ]] || { 144 | echo "usage : mkv [file]" 145 | return 146 | } 147 | mkvmerge -i "$@" 148 | } 149 | 150 | ################################## 151 | ## Compress && Strip elf binary ## 152 | ################################## 153 | elfcompress() { 154 | [[ -n "$@" ]] || { 155 | echo "usage : elfcompress [binary]" 156 | return 157 | } 158 | 159 | cp "$@" /tmp/compress.temp 160 | strip -s -R .comment -R .gnu.version /tmp/compress.temp 161 | 162 | 7z a -tGZip -mx=9 /tmp/compress.gz /tmp/compress.temp 163 | echo 'a=/tmp/I;tail -n+2 $0|zcat>$a;chmod +x $a;$a;rm $a;exit' >> /tmp/unpack.header 164 | 165 | cat /tmp/unpack.header /tmp/compress.gz > "$@.packed" 166 | chmod +x "$@.packed" 167 | 168 | rm /tmp/compress.temp 169 | rm /tmp/compress.gz 170 | rm /tmp/unpack.header 171 | } 172 | 173 | ###################################### 174 | ## Open file inside git tree on vim ## 175 | ###################################### 176 | vimo() { 177 | local match= 178 | local gtdir= 179 | local cwd=$PWD 180 | git ls-files &>/dev/null || return # test if git 181 | gtdir="$(git rev-parse --show-toplevel )" 182 | [[ "$cwd" != "$gtdir" ]] && pushd "$gtdir" &> /dev/null # git root 183 | [[ -n "$@" ]] && { match="$(git ls-files | grep "$@")"; } || 184 | match="$(git ls-files)" 185 | [[ $(echo "$match" | wc -l) -gt 1 ]] && match="$(echo "$match" | bemenu -i -l 20 -p "vim")" 186 | match="$gtdir/$match" # convert to absolute 187 | [[ "$cwd" != "$gtdir" ]] && popd &> /dev/null # go back 188 | [[ -f "$match" ]] || return 189 | vim "$match" 190 | } 191 | 192 | ########################################## 193 | ## Open file inside git tree on linopen ## 194 | ########################################## 195 | openo() { 196 | local match= 197 | local gtdir= 198 | local cwd=$PWD 199 | git ls-files &>/dev/null || return # test if git 200 | gtdir="$(git rev-parse --show-toplevel )" 201 | [[ "$cwd" != "$gtdir" ]] && pushd "$gtdir" &> /dev/null # git root 202 | [[ -n "$@" ]] && { match="$(git ls-files | grep "$@")"; } || 203 | match="$(git ls-files)" 204 | [[ $(echo "$match" | wc -l) -gt 1 ]] && match="$(echo "$match" | bemenu -i -l 20 -p "linopen")" 205 | match="$gtdir/$match" # convert to absolute 206 | [[ "$cwd" != "$gtdir" ]] && popd &> /dev/null # go back 207 | [[ -f "$match" ]] || return 208 | open "$match" 209 | } 210 | 211 | ####################### 212 | ## Setup github repo ## 213 | ####################### 214 | mkgit() { 215 | local GITHUB="Cloudef" 216 | local dir="$1" 217 | local gitname="$2" 218 | 219 | # check dir 220 | [[ -n "$dir" ]] || { 221 | echo "usage: mkgit [name]" 222 | return 223 | } 224 | 225 | # use dir name if, no gitname specified 226 | [[ -n "$gitname" ]] || gitname="$dir" 227 | [[ -d "$dir" ]] || mkdir "$dir" 228 | 229 | # bail out, if already git repo 230 | [[ -d "$dir/.git" ]] && { 231 | echo "already a git repo: $dir" 232 | return 233 | } 234 | 235 | cd "$dir" 236 | git init || return 237 | touch README; git add README 238 | git commit -a -m 'inital setup - automated' 239 | git remote add origin "git@github.com:$GITHUB/$gitname.git" 240 | git push -u origin master 241 | } 242 | 243 | #################################### 244 | ## Getting undefined references? ## 245 | ## Grep your libs for symbols ## 246 | #################################### 247 | greplib() { 248 | [[ -n "$1" ]] || { 249 | echo "usage : greplib [symbol] (lookup path)" 250 | return 251 | } 252 | 253 | if [[ -n "$2" ]]; then 254 | nm -a -o "$2/*.so" 2> /dev/null | grep "$1" 255 | nm -a -o "$2/*.a" 2> /dev/null | grep "$1" 256 | else 257 | nm -a -o "/usr/lib/*.so" 2> /dev/null | grep "$1" 258 | nm -a -o "/usr/lib/*.a" 2> /dev/null | grep "$1" 259 | fi 260 | } 261 | 262 | ############################## 263 | ## Encode GLC captured file ## 264 | ############################## 265 | glc-encode() { 266 | [[ -n "$1" ]] && [[ -n "$2" ]] && [[ -n "$3" ]] && [[ -n "$4" ]] || { 267 | echo "Usage : glc-encode [input] [audio bitrate] [video bitrate] [output]" 268 | return 269 | } 270 | 271 | [[ "$2" == "0" ]] || glc-play "$1" -o - -a 1 | ffmpeg -i pipe: -ab $2 /tmp/audio.mp4 272 | [[ -f /tmp/audio.mp4 ]] && { 273 | glc-play "$1" -o - -y 1 | ffmpeg -i pipe: -i /tmp/audio.mp4 -acodec copy -b $3 "$4" 274 | rm /tmp/audio.mp4 275 | } || { 276 | glc-play "$1" -o - -y 1 | ffmpeg -i pipe: -b $3 "$4" 277 | } 278 | } 279 | 280 | ############################# 281 | ## Japanese text to speech ## 282 | ############################# 283 | say() { 284 | local URL="$(echo "$@" | perl -MURI::Escape -ne 'chomp;print uri_escape($_)')" 285 | mpv -really-quiet "http://translate.google.com/translate_tts?ie=UTF-8&tl=JA&q=$URL" &> /dev/null 286 | } 287 | 288 | saydl() { 289 | local URL="$(echo "$@" | perl -MURI::Escape -ne 'chomp;print uri_escape($_)')" 290 | wget --user-agent="Mozilla/5.0" "http://translate.google.com/translate_tts?ie=UTF-8&tl=JA&q=$URL" -O "$@.mp3" 291 | } 292 | 293 | ###################################### 294 | ## Crappy google translate [JA->EN] ## 295 | ###################################### 296 | translate() { 297 | local URL="$(echo "$@" | perl -MURI::Escape -ne 'chomp;print uri_escape($_)')" 298 | curl -s -A "Mozilla" "http://translate.google.com/translate_a/t?client=t&ie=UTF-8&text=$URL&sl=ja&tl=en" | awk -F'"' '{print $2}' 299 | } 300 | 301 | ##################################### 302 | ## List unneeded header inclusions ## 303 | ## -r argument to remove ## 304 | ##################################### 305 | dehdr() { 306 | CFLAGS="-Werror -Wfatal-errors" deheader "$@" | sed -n 's/.*: *remove *\(.*\) *from *\(.*\)/\2: \1/p' 307 | } 308 | 309 | ####################### 310 | ## GCC Scratchpad :) ## 311 | ####################### 312 | gcx() { 313 | local includes='#include \n#include \n#include \n#include ' 314 | if [[ -n "$@" ]]; then 315 | (echo -e "$includes"; echo "void main(){$@}") | gcc -std=c99 -xc -o /tmp/gcx - && { /tmp/gcx; rm -f /tmp/gcx; } 316 | else 317 | $EDITOR "/tmp/gcx2.c" 318 | [[ -f "/tmp/gcx2.c" ]] || return 319 | (echo -e "$includes"; echo -n "void main(){") > "/tmp/gcx1.c" 320 | (cat "/tmp/gcx1.c" "/tmp/gcx2.c"; echo "}") > "/tmp/gcx.c" 321 | gcc -std=c99 -lm -xc -o /tmp/gcx - < "/tmp/gcx.c" && { /tmp/gcx; rm -f /tmp/gcx; } 322 | rm -f "/tmp/gcx.c" "/tmp/gcx1.c" "/tmp/gcx2.c" &> /dev/null 323 | fi 324 | } 325 | 326 | ############################ 327 | ## Check for needed .so's ## 328 | ############################ 329 | soneeded() { 330 | readelf -d $1 | awk '/NEEDED/ {gsub(/[\[\]]/, "", $5); print $5}' 331 | } 332 | -------------------------------------------------------------------------------- /#ARCHCONFIG/shell/prezto/modules/prompt/functions/prompt_hack_setup: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | # Modified sorin's theme 3 | # 4 | 5 | # Load dependencies 6 | pmodload 'helper' 7 | 8 | function prompt_hack_precmd { 9 | setopt LOCAL_OPTIONS 10 | unsetopt XTRACE KSH_ARRAYS 11 | 12 | if (( $+functions[git-info] )); then 13 | git-info 14 | fi 15 | 16 | [[ ! -n "$PROMPT_TITLE" ]] && { 17 | _HCK_CUSTOM="" 18 | } || { 19 | _HCK_CUSTOM="%F{blue}$PROMPT_TITLE "; 20 | } 21 | 22 | [[ "$TERM" == "linux" ]] || [[ -n "$PROMPT_TITLE" ]] || \ 23 | echo -ne "\033]0;${PWD}\007" 24 | 25 | echo "" 26 | echo "─┬╼ \e[0;33m.$(whoami)\e[0;37m//\e[0;32m$(uname -n) :: \e[0;36m${PWD}" 27 | PROMPT=" └╼%f${git_info:+${(e)git_info[prompt]}} ${_HCK_CUSTOM}%(!.%B%F{red}#%f%b.%B%F{green}]%f%b) " 28 | } 29 | 30 | function prompt_hack_setup { 31 | setopt LOCAL_OPTIONS 32 | unsetopt XTRACE KSH_ARRAYS 33 | prompt_opts=(cr percent subst) 34 | 35 | autoload -Uz add-zsh-hook 36 | add-zsh-hook precmd prompt_hack_precmd 37 | 38 | zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b' 39 | zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %F{red}F%f' 40 | zstyle ':prezto:module:editor:info:keymap:alternate' format ' %F{yellow}<%f%B%F{red}<%f%b%F{red}<%f ' 41 | zstyle ':prezto:module:git:info:action' format ':%%B%F{yellow}%s%f%%b' 42 | zstyle ':prezto:module:git:info:added' format ' %%B%F{green}+%f%%b' 43 | zstyle ':prezto:module:git:info:ahead' format ' %%B%F{yellow}A%f%%b' 44 | zstyle ':prezto:module:git:info:behind' format ' %%B%F{yellow}B%f%%b' 45 | zstyle ':prezto:module:git:info:branch' format ':%F{red}%b%f' 46 | zstyle ':prezto:module:git:info:commit' format ':%F{green}%.7c%f' 47 | zstyle ':prezto:module:git:info:deleted' format ' %%B%F{red}X%f%%b' 48 | zstyle ':prezto:module:git:info:modified' format ' %%B%F{red}変%f%%b' 49 | zstyle ':prezto:module:git:info:position' format ':%F{green}%p%f' 50 | zstyle ':prezto:module:git:info:renamed' format ' %%B%F{magenta}R%f%%b' 51 | zstyle ':prezto:module:git:info:stashed' format ' %%B%F{cyan}*%f%%b' 52 | zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{yellow}合%f%%b' 53 | zstyle ':prezto:module:git:info:untracked' format ' %%B%F{white}僥%f%%b' 54 | zstyle ':prezto:module:git:info:keys' format \ 55 | 'prompt' ' %F{cyan}git%f$(coalesce "%b" "%p" "%c")%s' \ 56 | 'rprompt' '%F{green}%A%B%S%a%d%m%r%U%u' 57 | 58 | RPROMPT='${editor_info[keymap]}${editor_info[overwrite]}%(?:: %f)${VIM:+" %B%F{green}V%f%b"}%F{green}${git_info[rprompt]}%(?, %F{green}─, %F{yellow}%?%F{red} ─)%f' 59 | SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' 60 | } 61 | 62 | prompt_hack_setup "$@" 63 | 64 | -------------------------------------------------------------------------------- /#ARCHCONFIG/shell/shellrc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # bash and zsh complicant rc source 3 | 4 | ################################ 5 | ## Test for interactive shell ## 6 | ################################ 7 | [[ "$-" == *i* ]] || return 8 | 9 | ######################### 10 | ## SSH complicant mode ## 11 | ######################### 12 | [[ -n "$SSH_TTY" ]] && export TERM="linux" 13 | 14 | ########################### 15 | ## Enviroiment Variables ## 16 | ########################### 17 | 18 | # Default programs 19 | export EDITOR="vim" 20 | export BROWSER="chromium" 21 | export TERMINAL="termite" 22 | 23 | # SDL 24 | export SDL_AUDIODRIVER="alsa" 25 | export SDL_VIDEO_FULLSCREEN_HEAD=1 26 | 27 | # JAVA 28 | export _JAVA_AWT_WM_NONREPARENTING=1 29 | 30 | # GTK 31 | export GDK_USE_XFT=1 32 | 33 | # Check if everything is broken 34 | [[ -z "$LANG" ]] && eval "$(locale)" 35 | 36 | # Set XDG variables 37 | [[ -n "$XDG_CACHE_HOME" ]] || export XDG_CACHE_HOME="$HOME/.cache" 38 | [[ -n "$XDG_CONFIG_HOME" ]] || export XDG_CONFIG_HOME="$HOME/.config" 39 | [[ -n "$XDG_DATA_HOME" ]] || export XDG_DATA_HOME="$HOME/.local/share" 40 | 41 | # Global override path 42 | # ($HOME/bin && /arch/bin) 43 | [[ "$PATH" == *$HOME/bin* ]] && [[ "$PATH" == */arch/bin* ]] || 44 | export PATH="$HOME/bin:/arch/bin:$PATH" 45 | 46 | # Ccache 47 | [[ "$PATH" == */usr/lib/ccache/bin* ]] || 48 | export PATH="/usr/lib/ccache/bin:$PATH" 49 | 50 | # Make ccache use compilers from this path 51 | export CCACHE_PATH="/usr/bin" 52 | export CCACHE_DIR="/arch/ccache" 53 | 54 | # Source passwd enviroiment 55 | source "/arch/passwd/libpasswd-env" 56 | 57 | # Source toolsched enviroiment 58 | source "/arch/toolsched/toolsched-env" 59 | 60 | # LS_COLORS 61 | # https://github.com/trapd00r/LS_COLORS 62 | eval $(dircolors -b "/arch/shell/LS_COLORS") 63 | 64 | # Welcome text 65 | echo "Welcome to lolified Arch Linux" 66 | echo "\ts - pacman -S" 67 | echo "\tssp - pacman -Ss" 68 | echo "\tq - pacman -Q" 69 | echo "\tr - pacman -Rsn" 70 | echo "\tu - pacman -Syu" 71 | echo "\t+ - sudo" 72 | echo "\t- - less" 73 | echo "\t@ - cat" 74 | echo "\t? - grep" 75 | echo "\t~ - sed" 76 | echo "\nYou are running intelligent clipboard daemon" 77 | echo "which is integrated with dmenu and monsterwm." 78 | echo "All your XA_CLIPBOARD (ctrl-c) clips are synced" 79 | echo "with XA_PRIMARY (shift-ins) automatically." 80 | echo "\tmeta-c\t\t- access clipboard history" 81 | echo "\tmeta-shift-c\t- access url history from clipboard" 82 | echo "\talt-shift-c\t- synchorize XA_PRIMARY to XA_CLIPBOARD" 83 | echo "\nDo 'less /arch/README' to remind what you have done to me." 84 | echo "\nAll modified system wide configurations," 85 | echo "AUR packages and other related reside in /arch\n" 86 | 87 | ######################################### 88 | # Change prompt name # 89 | # NOTE: prezto themes need to # 90 | # be modified to work with PROMPT_TITLE # 91 | ######################################### 92 | function tname() { 93 | echo -ne "\033]0;${@:-$PWD}\007"; 94 | PROMPT_TITLE=${@:-""} 95 | } 96 | 97 | # If root, set default prompt title 98 | [[ "$(whoami)" == "root" ]] && \ 99 | export PROMPT_TITLE="root" 100 | -------------------------------------------------------------------------------- /#ARCHCONFIG/shell/zsh-syntax-highlighting-filetypes.zsh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | # Name: zsh-syntax-highlighting-filetypes 3 | # Author: Magnus Woldrich 4 | # Update: 2011-06-20 23:26:38 5 | # 6 | # This is based on nicoulaj's zsh-syntax-highlighting project [0]. I've 7 | # taken the initial version of his script and added highlighting for 8 | # filetypes and a few other things. The filetype highlighting rules are 9 | # taken from my LS_COLORS [1] project. 10 | # 11 | # This will only work in terminals capable of displaying 256 colors. 12 | # 13 | # [0]: https://github.com/nicoulaj/zsh-syntax-highlighting 14 | # [1]: https://github.com/trapd00r/LS_COLORS 15 | 16 | 17 | # Core highlighting update system 18 | 19 | # Array used by highlighters to declare overridable styles. 20 | typeset -gA ZSH_HIGHLIGHT_STYLES 21 | 22 | # An `object' implemented by below 3 arrays' elements could be called a 23 | # `highlighter', registered by `_zsh_highlight_add-highlighter`. In 24 | # other words, these arrays are indexed and tied by their own 25 | # functionality. If they have been arranged inconsistently, things goes 26 | # wrong. Please see `_zsh_highlight-zle-buffer` and `_zsh_highlight_add- 27 | # highlighter`. 28 | 29 | 30 | # Actual recolorize functions to be called. 31 | typeset -a zsh_highlight_functions; zsh_highlight_functions=() 32 | 33 | # Predicate functions whether its recolorize function should be called or not. 34 | typeset -a zsh_highlight_predicates; zsh_highlight_predicates=() 35 | 36 | # Highlight storages for each recolorize functions. 37 | typeset -a zsh_highlight_caches; zsh_highlight_caches=() 38 | 39 | _zsh_highlight-zle-buffer() { 40 | if (( PENDING )); then 41 | return 42 | fi 43 | 44 | local ret=$? 45 | { 46 | local -a funinds 47 | local -i rh_size=$#region_highlight 48 | for i in {1..${#zsh_highlight_functions}}; do 49 | local pred=${zsh_highlight_predicates[i]} 50 | local cache_place=${zsh_highlight_caches[i]} 51 | if _zsh_highlight-zle-buffer-p "$rh_size" "$pred"; then 52 | if ((${#${(P)cache_place}} > 0)); then 53 | region_highlight=(${region_highlight:#(${(P~j.|.)cache_place})}) 54 | local -a empty; empty=(); : ${(PA)cache_place::=$empty} 55 | fi 56 | funinds+=$i 57 | fi 58 | done 59 | for i in $funinds; do 60 | local func=${zsh_highlight_functions[i]} 61 | local cache_place=${zsh_highlight_caches[i]} 62 | local -a rh; rh=($region_highlight) 63 | { 64 | "$func" 65 | } always { 66 | : ${(PA)cache_place::=${region_highlight:#(${(~j.|.)rh})}} 67 | } 68 | done 69 | } always { 70 | ZSH_PRIOR_CURSOR=$CURSOR 71 | ZSH_PRIOR_HIGHLIGHTED_BUFFER=$BUFFER 72 | return $ret 73 | } 74 | } 75 | 76 | # Whether supplied highlight_predicate satisfies or not. 77 | _zsh_highlight-zle-buffer-p() { 78 | local region_highlight_size="$1" highlight_predicate="$2" 79 | # If any highlightings are not taken into account, asume it is needed. 80 | # This holds for some up/down-history commands, for example. 81 | ((region_highlight_size == 0)) || "$highlight_predicate" 82 | } 83 | 84 | # Whether the command line buffer is modified or not. 85 | _zsh_highlight_buffer-modified-p() { 86 | [[ ${ZSH_PRIOR_HIGHLIGHTED_BUFFER:-} != $BUFFER ]] 87 | } 88 | 89 | # Whether the cursor is moved or not. 90 | _zsh_highlight_cursor-moved-p() { 91 | ((ZSH_PRIOR_CURSOR != $CURSOR)) 92 | } 93 | 94 | # Register an highlighter. 95 | _zsh_highlight_add-highlighter() { 96 | zsh_highlight_functions+="$1" 97 | zsh_highlight_predicates+="${2-${1}-p}" 98 | zsh_highlight_caches+="${3-${1//-/_}}" 99 | } 100 | 101 | 102 | # Main highlighter 103 | 104 | ZSH_HIGHLIGHT_STYLES+=( 105 | default 'fg=248' 106 | unknown-token 'fg=196,bold,bg=234' 107 | reserved-word 'fg=197,bold' 108 | alias 'fg=197,bold' 109 | builtin 'fg=107,bold' 110 | function 'fg=85,bold' 111 | command 'fg=166,bold' 112 | hashed-command 'fg=70' 113 | path 'fg=30' 114 | globbing 'fg=170,bold' 115 | history-expansion 'fg=blue' 116 | single-hyphen-option 'fg=244' 117 | double-hyphen-option 'fg=244' 118 | back-quoted-argument 'fg=220,bold' 119 | single-quoted-argument 'fg=137' 120 | double-quoted-argument 'fg=137' 121 | dollar-double-quoted-argument 'fg=148' 122 | back-double-quoted-argument 'fg=172,bold' 123 | assign 'fg=240,bold' 124 | ) 125 | 126 | mkstyle () { 127 | local lastlast 128 | local last 129 | 130 | while [ "$#" -gt 0 ]; do 131 | cur=$1 132 | shift 133 | 134 | if [ "$last" = 5 ]; then 135 | if [ "$lastlast" = 38 ]; then 136 | style+=( "fg=$cur" ) 137 | lastlast= 138 | last= 139 | continue 140 | elif [ "$lastlast" = 48 ]; then 141 | style+=( "bg=$cur" ) 142 | lastlast= 143 | last= 144 | continue 145 | fi 146 | fi 147 | 148 | lastlast=$last 149 | last=$cur 150 | done 151 | 152 | case "$last" in 153 | 00|0) style+=( "none" ) ;; 154 | 01|1) style+=( "bold" ) ;; 155 | 04|4) style+=( "underscore" ) ;; 156 | 05|5) style+=( "blink" ) ;; 157 | 07|7) style+=( "reverse" ) ;; 158 | 08|8) style+=( "concealed" ) ;; 159 | esac 160 | } 161 | 162 | function { 163 | local coloring ext rawstyle 164 | local -a style 165 | 166 | for coloring in ${(s.:.)LS_COLORS}; do 167 | ext=${coloring%%\=*} 168 | rawstyle=${coloring##*\=} 169 | style=() 170 | 171 | mkstyle ${(s.;.)rawstyle} 172 | style=${(j.,.)style} 173 | 174 | ZSH_HIGHLIGHT_STYLES+=( 175 | "$ext" "$style" 176 | ) 177 | done 178 | } 179 | 180 | # Tokens that are always immediately followed by a command. 181 | ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS=( 182 | '|' '||' ';' '&' '&&' 'noglob' 'nocorrect' 'builtin' 183 | ) 184 | 185 | # Check if the argument is variable assignment 186 | _zsh_highlight_check-assign() { 187 | setopt localoptions extended_glob 188 | [[ ${(Q)arg} == [[:alpha:]_]([[:alnum:]_])#=* ]] 189 | } 190 | 191 | # Check if the argument is a path. 192 | _zsh_highlight_check-path() { 193 | [[ -z ${(Q)arg} ]] && return 1 194 | [[ -e ${(Q)arg} ]] && return 0 195 | [[ ! -e ${(Q)arg:h} ]] && return 1 196 | [[ ${#BUFFER} == $end_pos && -n $(print ${(Q)arg}*(N)) ]] && return 0 197 | return 1 198 | } 199 | 200 | # Highlight special chars inside double-quoted strings 201 | _zsh_highlight_highlight_string() { 202 | setopt localoptions noksharrays 203 | local i j k style 204 | # Starting quote is at 1, so start parsing at offset 2 in the string. 205 | for (( i = 2 ; i < end_pos - start_pos ; i += 1 )) ; do 206 | (( j = i + start_pos - 1 )) 207 | (( k = j + 1 )) 208 | case "$arg[$i]" in 209 | '$') style=$ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument];; 210 | '%') style=$ZSH_HIGHLIGHT_STYLES[globbing];; 211 | '^') style=$ZSH_HIGHLIGHT_STYLES[globbing];; 212 | "\\") style=$ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument] 213 | (( k += 1 )) # Color following char too. 214 | (( i += 1 )) # Skip parsing the escaped char. 215 | ;; 216 | *) continue;; 217 | esac 218 | region_highlight+=("$j $k $style") 219 | done 220 | } 221 | 222 | # Core syntax highlighting. 223 | _zsh_main-highlight() { 224 | setopt localoptions extendedglob bareglobqual 225 | local start_pos=0 end_pos highlight_glob=true new_expression=true arg style 226 | region_highlight=() 227 | 228 | for arg in ${(z)BUFFER}; do 229 | local substr_color=0 230 | 231 | style= 232 | 233 | [[ $start_pos -eq 0 && $arg = 'noglob' ]] && highlight_glob=false 234 | 235 | ((start_pos+=${#BUFFER[$start_pos+1,-1]}-${#${BUFFER[$start_pos+1,-1]##[[:space:]]#}})) 236 | ((end_pos=$start_pos+${#arg})) 237 | 238 | if $new_expression; then 239 | new_expression=false 240 | 241 | res=$(LC_ALL=C builtin type -w $arg 2>/dev/null) 242 | case $res in 243 | *': reserved') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];; 244 | *': alias') style=$ZSH_HIGHLIGHT_STYLES[alias] 245 | local aliased_command="${"$(alias $arg)"#*=}" 246 | [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$aliased_command"} && -z ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$arg"} ]] && ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS+=($arg) 247 | ;; 248 | *': builtin') style=$ZSH_HIGHLIGHT_STYLES[builtin];; 249 | *': function') style=$ZSH_HIGHLIGHT_STYLES[function];; 250 | *': command') style=$ZSH_HIGHLIGHT_STYLES[command];; 251 | *': hashed') style=$ZSH_HIGHLIGHT_STYLES[hashed-command];; 252 | *) if _zsh_highlight_check-assign; then 253 | style=$ZSH_HIGHLIGHT_STYLES[assign] 254 | new_expression=true 255 | elif _zsh_highlight_check-path; then 256 | style=$ZSH_HIGHLIGHT_STYLES[path] 257 | elif [[ $arg[0,1] = $histchars[0,1] ]]; then 258 | style=$ZSH_HIGHLIGHT_STYLES[history-expansion] 259 | else 260 | style=$ZSH_HIGHLIGHT_STYLES[unknown-token] 261 | fi 262 | ;; 263 | esac 264 | else 265 | for key in ${(k)ZSH_HIGHLIGHT_STYLES}; do 266 | case $key in 267 | "*."*) ;; 268 | *) continue ;; 269 | esac 270 | case $arg in 271 | *.$key[3,-1]) style=$ZSH_HIGHLIGHT_STYLES[$key] ;; 272 | esac 273 | [ -n "$style" ] && break 274 | done 275 | if [ -z "$style" ]; then 276 | case $arg in 277 | '--'*) style=$ZSH_HIGHLIGHT_STYLES[double-hyphen-option];; 278 | '-'*) style=$ZSH_HIGHLIGHT_STYLES[single-hyphen-option];; 279 | "'"*"'") style=$ZSH_HIGHLIGHT_STYLES[single-quoted-argument];; 280 | '"'*'"') style=$ZSH_HIGHLIGHT_STYLES[double-quoted-argument] 281 | region_highlight+=("$start_pos $end_pos $style") 282 | _zsh_highlight_highlight_string 283 | substr_color=1 284 | ;; 285 | '`'*'`') style=$ZSH_HIGHLIGHT_STYLES[back-quoted-argument];; 286 | *"*"*) $highlight_glob && style=$ZSH_HIGHLIGHT_STYLES[globbing] || 287 | style=$ZSH_HIGHLIGHT_STYLES[default];; 288 | *) if _zsh_highlight_check-path; then 289 | style=$ZSH_HIGHLIGHT_STYLES[path] 290 | elif [[ $arg[0,1] = $histchars[0,1] ]]; then 291 | style=$ZSH_HIGHLIGHT_STYLES[history-expansion] 292 | else 293 | style=$ZSH_HIGHLIGHT_STYLES[default] 294 | fi 295 | ;; 296 | esac 297 | fi 298 | fi 299 | [[ $substr_color = 0 ]] && 300 | region_highlight+=("$start_pos $end_pos $style") 301 | [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$arg"} ]] && new_expression=true 302 | start_pos=$end_pos 303 | done 304 | } 305 | 306 | 307 | # Setup functions 308 | 309 | # Intercept specified ZLE events to have highlighting triggered. 310 | _zsh_highlight_bind-events() { 311 | 312 | # Resolve event names what have to be bound to. 313 | zmodload zsh/zleparameter 2>/dev/null || { 314 | echo 'zsh-syntax-highlighting:zmodload error. exiting.' >&2 315 | return -1 316 | } 317 | local -a events; : ${(A)events::=${@:#(_*|orig-*|.run-help|.which-command)}} 318 | 319 | # Bind the events to _zsh_highlight-zle-buffer. 320 | local clean_event 321 | for event in $events; do 322 | if [[ "$widgets[$event]" == completion:* ]]; then 323 | eval "zle -C orig-$event ${${${widgets[$event]}#*:}/:/ } ; $event() { builtin zle orig-$event && _zsh_highlight-zle-buffer } ; zle -N $event" 324 | else 325 | case $event in 326 | accept-and-menu-complete) 327 | eval "$event() { builtin zle .$event && _zsh_highlight-zle-buffer } ; zle -N $event" 328 | ;; 329 | .*) 330 | # Remove the leading dot in the event name 331 | clean_event=$event[2,${#event}] 332 | case ${widgets[$clean_event]-} in 333 | (completion|user):*) 334 | ;; 335 | *) 336 | eval "$clean_event() { builtin zle $event && _zsh_highlight-zle-buffer } ; zle -N $clean_event" 337 | ;; 338 | esac 339 | ;; 340 | *) 341 | ;; 342 | esac 343 | fi 344 | done 345 | } 346 | 347 | # Load highlighters from specified directory if it exists. 348 | _zsh_highlight_load-highlighters() { 349 | [[ -d $1 ]] && for highlighter_def ($1/*.zsh) . $highlighter_def 350 | } 351 | 352 | 353 | # Setup 354 | 355 | # Bind highlighting to all known events. 356 | _zsh_highlight_bind-events "${(@f)"$(zle -la)"}" 357 | 358 | # Register the main highlighter. 359 | _zsh_highlight_add-highlighter _zsh_main-highlight _zsh_highlight_buffer-modified-p 360 | 361 | # Load additional highlighters if available. 362 | _zsh_highlight_load-highlighters "${${(%):-%N}:h}/highlighters" 363 | -------------------------------------------------------------------------------- /#ARCHCONFIG/shell/zshrc: -------------------------------------------------------------------------------- 1 | # 2 | # Systemwide zshrc 3 | # 4 | 5 | # source global shell file 6 | # (tests for interactive shell) 7 | source "/arch/shell/shellrc" 8 | 9 | # execute in background 10 | { 11 | # compile the completion dump to increase startup speed. 12 | dump_file="$HOME/.zcompdump" 13 | if [[ "$dump_file" -nt "${dump_file}.zwc" || ! -s "${dump_file}.zwc" ]]; then 14 | zcompile "$dump_file" 15 | fi 16 | } &! 17 | 18 | # prezto 19 | export PREZTO="/arch/shell/prezto" 20 | 21 | # temporary files 22 | if [[ ! -d "$TMPDIR" ]]; then 23 | export TMPDIR="/tmp/$USER" 24 | mkdir -p -m 700 "$TMPDIR" 25 | fi 26 | 27 | TMPPREFIX="${TMPDIR%/}/zsh" 28 | if [[ ! -d "$TMPPREFIX" ]]; then 29 | mkdir -p "$TMPPREFIX" 30 | fi 31 | 32 | # other enviroiment crap 33 | typeset -gU cdpath fpath mailpath manpath path 34 | typeset -gUT INFOPATH infopath 35 | 36 | # GNU info 37 | infopath=( 38 | /usr/local/share/info 39 | /usr/share/info 40 | $infopath 41 | ) 42 | 43 | # man 44 | manpath=( 45 | /usr/local/share/man 46 | /usr/share/man 47 | $manpath 48 | ) 49 | 50 | # add paths from /etc/manpaths.d as well 51 | for path_file in /etc/manpaths.d/*(.N); do 52 | manpath+=($(<$path_file)) 53 | done 54 | unset path_file 55 | 56 | # ssh-agent forwarding 57 | zstyle ':prezto:plugins:ssh' forwarding 'on' 58 | 59 | # Set the key mapping style to 'emacs' or 'vi'. 60 | zstyle ':prezto:module:editor' keymap 'vi' 61 | 62 | # Auto convert .... to ../.. 63 | zstyle ':prezto:module:editor' dot-expansion 'no' 64 | 65 | # Set case-sensitivity for completion, history lookup, etc. 66 | zstyle ':prezto:*:*' case-sensitive 'no' 67 | 68 | # Color output (auto set to 'no' on dumb terminals). 69 | zstyle ':prezto:*:*' color 'yes' 70 | 71 | # Use trapd00r's LS_COLORS, so disable prezto one 72 | zstyle ':prezto:module:utility:ls' color 'no' 73 | 74 | # don't show $PWD in ../ 75 | zstyle ':completion:*' ignore-parents 'pwd' 76 | 77 | # ignore commands I don't have 78 | zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec))' 79 | 80 | # Load zsh modules 81 | zstyle ':prezto:load' 'zfunction' 'zargs' 'zmv' 82 | 83 | # Syntax hilight 84 | zstyle ':prezto:module:syntax-highlighting' highlighters \ 85 | 'main' \ 86 | 'brackets' \ 87 | 'pattern' \ 88 | 'root' 89 | 90 | [[ -d "$ZDOTDIR/.zprezto" ]] && { 91 | 92 | # Set the prezto modules to load (browse modules). 93 | # The order matters. 94 | zstyle ':prezto:load' pmodule \ 95 | 'environment' \ 96 | 'terminal' \ 97 | 'editor' \ 98 | 'history' \ 99 | 'directory' \ 100 | 'archive' \ 101 | 'command-not-found' \ 102 | 'spectrum' \ 103 | 'utility' \ 104 | 'completion' \ 105 | 'ssh' \ 106 | 'git' \ 107 | 'prompt' 108 | 109 | } # load if OK 110 | 111 | # set prompt 112 | zstyle ':prezto:module:prompt' theme 'hack' 113 | 114 | # launch 115 | source "$PREZTO/init.zsh" 116 | 117 | [[ -d "$ZDOTDIR/.zprezto" ]] && { 118 | 119 | # link completitions 120 | compdef pacmatic=pacman 121 | 122 | } # link if OK 123 | 124 | # gets defined from utility module, but we don't want this 125 | unfunction make 126 | 127 | # load zcalc 128 | autoload -U zcalc 129 | alias zcalc='noglob zcalc' 130 | 131 | # source nicer highlights 132 | source "/arch/shell/zsh-syntax-highlighting-filetypes.zsh" 133 | 134 | # source functions and aliases 135 | source "/arch/shell/functions" 136 | source "/arch/shell/alias" 137 | 138 | # zsh options 139 | unsetopt correct # I can't see why people like this 140 | # stop typing wrong silly people 141 | bindkey '\e' send-break # Cancel completion with ESC 142 | bindkey "^A" beginning-of-line # CTRL+A 143 | bindkey "\e[5~" beginning-of-history # PageUp 144 | bindkey "\e[6~" end-of-history # PageDown 145 | bindkey "\e[2~" quoted-insert # Ins 146 | bindkey "\e[3~" delete-char # Del 147 | bindkey "\e[5C" forward-word 148 | bindkey "\eOc" emacs-forward-word 149 | bindkey "\e[5D" backward-word 150 | bindkey "\eOd" emacs-backward-word 151 | bindkey "\e\e[C" forward-word 152 | bindkey "\e\e[D" backward-word 153 | bindkey "\e[Z" reverse-menu-complete # Shift+Tab 154 | bindkey "\e[7~" beginning-of-line # Home 155 | bindkey "\e[8~" end-of-line # End 156 | bindkey "\eOH" beginning-of-line 157 | bindkey "\eOF" end-of-line 158 | bindkey "^I" menu-complete # Why press tab twice? 159 | bindkey "^Z" undo # Undo 160 | bindkey '^R' history-incremental-search-backward 161 | 162 | # Interactive sanity 163 | [[ ! -n "$ZDOTDIR" ]] && { 164 | echo "" 165 | echo "* \$ZDOTDIR isnt exported" 166 | echo "* Export \$ZDOTDIR point to your directory that will" 167 | echo "* contain symlinked .zprezto directory for module loading" 168 | echo "" 169 | } || { 170 | [[ ! -d "$ZDOTDIR/.zprezto" ]] && { 171 | echo "" 172 | echo "* You forgot to symlink \"$PREZTO\" to \"$ZDOTDIR/.zprezto\"" 173 | echo "" 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/README: -------------------------------------------------------------------------------- 1 | source /arch/toolsched/toolsched-env 2 | needs schedtool 3 | 4 | /arch/toolsched/toolsched-lib 5 | provides helpful functions 6 | 7 | /arch/toolsched/sched_ 8 | premade template files you can just ln -s 9 | 10 | # Set current process scheduler parameters 11 | toolsched_ 12 | 13 | # Launch binary with the current script's name 14 | toolsched_launch [binary arguments] 15 | -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/bin/cmake: -------------------------------------------------------------------------------- 1 | ../sched_idle -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/bin/git: -------------------------------------------------------------------------------- 1 | ../sched_idle -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/bin/make: -------------------------------------------------------------------------------- 1 | ../sched_idle -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/bin/mpd: -------------------------------------------------------------------------------- 1 | ../sched_iso -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/bin/mpv: -------------------------------------------------------------------------------- 1 | ../sched_iso -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/bin/pacman: -------------------------------------------------------------------------------- 1 | ../sched_idle -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/bin/rtorrent: -------------------------------------------------------------------------------- 1 | ../sched_idle -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/bin/steam: -------------------------------------------------------------------------------- 1 | ../sched_iso -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/bin/wine: -------------------------------------------------------------------------------- 1 | ../sched_iso -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/sched_idle: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # SCHED_IDLE template 3 | source "/arch/toolsched/toolsched-lib" 4 | 5 | toolsched_idle 6 | toolsched_launch "$@" 7 | -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/sched_iso: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # SCHED_ISO template 3 | source "/arch/toolsched/toolsched-lib" 4 | 5 | toolsched_iso 6 | toolsched_launch "$@" 7 | -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/toolsched-env: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # toolsched enviroiment file 3 | 4 | [[ "$PATH" == */arch/toolsched/bin* ]] || { 5 | which schedtool &> /dev/null && 6 | which ionice &> /dev/null && { 7 | export PATH="/arch/toolsched/bin:$PATH" 8 | } || echo "WARN: schedtool or ionice not found, skipping toolsched enviroiment." 9 | } 10 | -------------------------------------------------------------------------------- /#ARCHCONFIG/toolsched/toolsched-lib: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # toolsched library file 3 | 4 | schedtool="$(which --skip-alias --skip-functions schedtool 2>&1)" 5 | ionice="$(which --skip-alias --skip-functions ionice 2>&1)" 6 | 7 | # Launch process 8 | toolsched_launch() 9 | { 10 | local cmd="$(basename $0)" 11 | local command= 12 | for i in $(which --skip-alias --skip-functions -a "$cmd" 2>&1); do 13 | if [[ "$i" != "$0" ]]; then 14 | command="$i" 15 | break 16 | fi 17 | done 18 | 19 | if [[ ! -n "$command" ]]; then 20 | echo "$cmd: command not found [$command, $0]" 21 | exit 1 22 | fi 23 | 24 | exec "$command" "$@" 25 | exit $? 26 | } 27 | 28 | # Set current process to idle 29 | toolsched_idle() 30 | { 31 | # SCHED_IDLEPRIO 32 | $schedtool -D $$ >/dev/null 2>&1 33 | 34 | # IDLE 35 | $ionice -c3 -p$$ >/dev/null 2>&1 36 | } 37 | 38 | # Set current process to iso 39 | toolsched_iso() 40 | { 41 | # SCHED_ISO 42 | $schedtool -I $$ >/dev/null 2>&1 43 | 44 | # BEST-EFFORT 45 | $ionice -c2 -n0 -p$$ >/dev/null 2>&1 46 | } 47 | 48 | # Set current process to batch 49 | toolsched_batch() 50 | { 51 | # SCHED_BATCH 52 | $schedtool -B $$ >/dev/null 2>&1 53 | } 54 | -------------------------------------------------------------------------------- /#ARCHCONFIG/vim/README: -------------------------------------------------------------------------------- 1 | # 2 | # Systemwide vim configuration 3 | # 4 | 5 | Put systemwide pathogen bundles to bundle. 6 | Install: source "/arch/vim/vimrc" in your .vimrc 7 | -------------------------------------------------------------------------------- /#ARCHCONFIG/vim/bundle/cSyntaxPlus/README: -------------------------------------------------------------------------------- 1 | Some additional hilight for C language. 2 | Based on cSyntaxAfter. 3 | 4 | How to use? 5 | au BufNewFile,BufRead *.{c,h} call CSyntaxPlus() 6 | -------------------------------------------------------------------------------- /#ARCHCONFIG/vim/bundle/cSyntaxPlus/plugin/cSyntaxPlus.vim: -------------------------------------------------------------------------------- 1 | function! CSyntaxPlus() 2 | syn keyword Boolean nullptr TRUE FALSE 3 | syn keyword Statement namespace stderr stdin stdout new this delete 4 | 5 | syn match _Block "[{}]" 6 | syn match _IfBlock "[()]" 7 | syn match _Bracket "[\[\]]" 8 | syn match _Operator display "[-+&|<>=!*\/~.,;:%&^?]" contains=cComment,cCommentL 9 | syn match _Pointer display "\w\+\s*->" contains=_Operator 10 | syn match _Struct display "\w\+\s*[.]" contains=_Operator 11 | syn match _Func display "\w\+\s*(" contains=_IfBlock 12 | 13 | hi link _Operator Operator 14 | hi link _Bracket Constant 15 | hi link _Func Function 16 | hi link _IfBlock String 17 | hi link _Pointer Type 18 | hi link _Struct _Pointer 19 | hi link _Block Constant 20 | endfunction 21 | -------------------------------------------------------------------------------- /#ARCHCONFIG/vim/bundle/colorshot/colors/colorshot.vim: -------------------------------------------------------------------------------- 1 | " Author: Jari Vetoniemi (Cloudef) 2 | " Description: Colorshceme modified from slate 3 | " Usage: This colorscheme is meant only for use with vim in a terminal 4 | 5 | " .Xresources for urxvt/xterm 6 | " 7 | " *foreground: #CACACA 8 | " *background: #121212 9 | 10 | " !black 11 | " *color0: #1C1C1C 12 | " *color8: #4d4d4d 13 | " !red 14 | " *color1: #D81860 15 | " *color9: #F00060 16 | " !green 17 | " *color2: #B7CE42 18 | " *color10: #BDE077 19 | " !yellow 20 | " *color3: #FEA63C 21 | " *color11: #FFE863 22 | " !blue 23 | " *color4: #66AABB 24 | " *color12: #AACCBB 25 | " !magenta 26 | " *color5: #B7416E 27 | " *color13: #BB4466 28 | " !cyan 29 | " *color6: #5E7175 30 | " *color14: #A3BABF 31 | " !white 32 | " *color7: #DDEEDD 33 | " *color15: #6C887A 34 | " 35 | " Termite configuration 36 | " 37 | " foreground = #CACACA 38 | " foreground_bold = #ffffff 39 | " background = #121212 40 | " color0 = #1C1C1C 41 | " color1 = #D81860 42 | " color2 = #B7CE42 43 | " color3 = #FEA63C 44 | " color4 = #66AABB 45 | " color5 = #B7416E 46 | " color6 = #5E7175 47 | " color7 = #DDEEDD 48 | " color8 = #4D4D4D 49 | " color9 = #F00060 50 | " color10 = #BDE077 51 | " color11 = #FFE863 52 | " color12 = #AACCBB 53 | " color13 = #BB4466 54 | " color14 = #A3BABF 55 | " color15 = #6C887A 56 | 57 | hi clear 58 | if exists('syntax_on') 59 | syntax reset 60 | endif 61 | set bg=dark 62 | let colors_name = 'colorshot' 63 | 64 | " General colors 65 | hi NonText cterm=NONE ctermfg=blue ctermbg=NONE 66 | hi LineNr cterm=NONE ctermfg=darkgray ctermbg=NONE 67 | hi VertSplit cterm=NONE ctermfg=lightgray ctermbg=black 68 | hi Visual cterm=NONE ctermfg=NONE ctermbg=8 69 | hi Title cterm=NONE ctermfg=magenta ctermbg=NONE 70 | hi WildMenu cterm=NONE ctermfg=black ctermbg=lightgray 71 | hi ErrorMsg cterm=NONE ctermfg=red ctermbg=black 72 | hi WarningMsg cterm=NONE ctermfg=3 ctermbg=black 73 | hi ModeMsg cterm=NONE ctermfg=lightgray ctermbg=black 74 | 75 | if version >= 700 " Vim 7 specific colors 76 | hi CursorLine cterm=NONE ctermfg=NONE ctermbg=black 77 | hi MatchParen cterm=NONE ctermfg=red ctermbg=black 78 | hi! link CursorColumn CursorLine 79 | endif 80 | 81 | " Completion menu 82 | hi Pmenu cterm=NONE ctermfg=white ctermbg=black 83 | hi PmenuSel cterm=NONE ctermfg=lightgray ctermbg=black 84 | 85 | " Tabs 86 | hi TabLine cterm=NONE ctermfg=255 ctermbg=238 87 | hi TabLineSel cterm=NONE ctermfg=17 ctermbg=190 88 | hi TabLineFill cterm=NONE ctermfg=NONE ctermbg=NONE 89 | 90 | " Syntax highlighting 91 | hi Comment cterm=NONE ctermfg=darkblue ctermbg=NONE 92 | hi String cterm=NONE ctermfg=darkgreen ctermbg=NONE 93 | hi Keyword cterm=NONE ctermfg=darkmagenta ctermbg=NONE 94 | hi PreProc cterm=NONE ctermfg=magenta ctermbg=NONE 95 | hi Todo cterm=underline ctermfg=red ctermbg=NONE 96 | hi Constant cterm=NONE ctermfg=red ctermbg=NONE 97 | hi Identifier cterm=NONE ctermfg=magenta ctermbg=NONE 98 | hi Type cterm=NONE ctermfg=yellow ctermbg=NONE 99 | hi Statement cterm=NONE ctermfg=magenta ctermbg=NONE 100 | hi Special cterm=NONE ctermfg=green ctermbg=NONE 101 | hi Delimiter cterm=NONE ctermfg=magenta ctermbg=NONE 102 | hi Function cterm=NONE ctermfg=3 ctermbg=NONE 103 | 104 | hi link Number Constant 105 | hi! link StatusLine VertSplit 106 | hi! link StatusLineNC VertSplit 107 | hi! link Question Special 108 | hi! link MoreMsg Special 109 | hi! link Folded Normal 110 | 111 | hi link Operator Delimiter 112 | hi link PmenuSel PmenuThumb 113 | hi link Error ErrorMsg 114 | hi link Conditional Keyword 115 | hi link Character String 116 | hi link Boolean Constant 117 | hi link Float Number 118 | hi link Repeat Statement 119 | hi link Label Statement 120 | hi link Exception Statement 121 | hi link Include PreProc 122 | hi link Define PreProc 123 | hi link Macro PreProc 124 | hi link PreCondit PreProc 125 | hi link StorageClass Type 126 | hi link Structure Type 127 | hi link Typedef Type 128 | hi link Tag Special 129 | hi link SpecialChar Special 130 | hi link SpecialComment Special 131 | hi link Debug Special 132 | hi link cTodo Todo 133 | 134 | " Diff 135 | 136 | hi! link DiffAdd TabLineSel 137 | hi! link DiffDelete TabLine 138 | hi! link DiffChange Pmenu 139 | hi! link DiffText PmenuSel 140 | 141 | " Syntastic 142 | hi link SyntasticErrorSign ErrorMsg 143 | hi link SyntasticWarningSign WarningMsg 144 | hi SignColumn cterm=NONE ctermfg=NONE ctermbg=NONE 145 | hi SyntasticErrorLine cterm=NONE ctermfg=NONE ctermbg=black 146 | hi SyntasticWarningLine cterm=NONE ctermfg=NONE ctermbg=black 147 | 148 | " Ruby 149 | hi link rubyClass Keyword 150 | hi link rubyModule Keyword 151 | hi link rubyKeyword Keyword 152 | hi link rubyOperator Operator 153 | hi link rubyIdentifier Identifier 154 | hi link rubyInstanceVariable Identifier 155 | hi link rubyGlobalVariable Identifier 156 | hi link rubyClassVariable Identifier 157 | hi link rubyConstant Type 158 | 159 | " HTML/XML 160 | hi link xmlTag HTML 161 | hi link xmlTagName HTML 162 | hi link xmlEndTag HTML 163 | hi link htmlTag HTML 164 | hi link htmlTagName HTML 165 | hi link htmlSpecialTagName HTML 166 | hi link htmlEndTag HTML 167 | hi link HTML NonText 168 | 169 | " JavaScript 170 | hi link javaScriptNumber Number 171 | 172 | " Objc 173 | hi link objcDirective Type 174 | hi objcMethodName cterm=NONE ctermfg=darkyellow ctermbg=NONE 175 | 176 | " CSS 177 | hi link cssBraces Normal 178 | hi link cssTagName NonText 179 | hi link StorageClass Special 180 | hi link cssClassName Special 181 | hi link cssIdentifier Identifier 182 | hi link cssColor Type 183 | hi link cssValueInteger Type 184 | hi link cssValueNumber Type 185 | hi link cssValueLength Type 186 | hi cssPseudoClassId cterm=NONE ctermfg=darkyellow ctermbg=NONE 187 | 188 | " Spell checking 189 | hi SpellBad cterm=underline ctermfg=red ctermbg=NONE 190 | hi SpellCap cterm=underline ctermfg=3 ctermbg=NONE 191 | hi SpellRare cterm=underline ctermfg=3 ctermbg=NONE 192 | hi SpellLocal cterm=underline ctermfg=3 ctermbg=NONE 193 | 194 | " vim: set ts=8 sw=4 tw=78 : 195 | -------------------------------------------------------------------------------- /#ARCHCONFIG/vim/vimrc: -------------------------------------------------------------------------------- 1 | " 2 | " Systemwide vimrc 3 | " source this in your local .vimrc 4 | " 5 | 6 | set nocompatible " non Vi compatible 7 | 8 | " {{{ Pathogen plugin 9 | source /arch/vim/pathogen.vim 10 | call pathogen#infect("/arch/vim/bundle") 11 | call pathogen#infect() 12 | call pathogen#helptags() 13 | " }}} 14 | " {{{ Misc 15 | " system stuff 16 | if $TERM != "linux" " if we are not in TTY 17 | set t_Co=256 " set 256 colors \o/ 18 | endif 19 | 20 | " gvim (i don't use this but whatever) 21 | if has('gui_running') 22 | set guioptions-=T " remove the toolbar 23 | set guioptions-=m " remove the menubar 24 | set guioptions-=r " remove the scrollbar 25 | endif 26 | " }}} 27 | " {{{ Vim's own settings 28 | colorscheme colorshot " modified slate theme 29 | set completeopt-=preview " disable scratch buffer 30 | set cursorline " enable cursor highlight 31 | set showcmd " show command information 32 | set noshowmode " we use airline 33 | set foldmethod=marker " allow marking folds 34 | set showmatch " hilight search pattern 35 | set incsearch " incremental search 36 | set scrolloff=1 " 1 line offset from top-bottom 37 | set sidescrolloff=5 " 5 character offset from left-right 38 | set nowrap " don't wrap lines 39 | set virtualedit=all " enable virtualedit (visual block) 40 | set expandtab " spaces not tabs 41 | set softtabstop=3 " indents 42 | set shiftwidth=3 " more indents 43 | set number " show line numbers 44 | set noswapfile " no swap files 45 | set updatecount=0 " we don't use swap files 46 | set wildmenu " enable wildmenu 47 | set wildmode=longest:full,full " wildmenu mode 48 | set ignorecase " ignore case in search 49 | set smartcase " if uppercase letter, don't ignore 50 | set undolevels=1000 " undo levels 51 | set lazyredraw " don't redraw while executing macros 52 | set noerrorbells " no bells plz 53 | set showtabline=2 " show tabs always 54 | set backspace=indent,eol,start " backspace behaviour (indent -> eol -> start) 55 | set cmdheight=2 " avoid hit enter to continue 56 | set modeline " use modelines 57 | set noruler " use powerline instead to show stats 58 | set laststatus=2 " show the status always 59 | set suffixes=.bak,~,.swp,.o,.log " lower prioritory for tab completition 60 | set backup " backups are awesome 61 | set backupdir=$HOME/.vim/backup " set backup directory 62 | set ttimeout " key combination timeout 63 | set ttimeoutlen=50 " lower statusline timeout 64 | set autoindent " indent to last identation 65 | 66 | " this stuff is common sense 67 | filetype on 68 | filetype plugin on 69 | filetype plugin indent on 70 | 71 | " C syntax checking options 72 | let c_gnu = 1 73 | let c_space_errors = 1 74 | let c_no_tab_space_error = 1 75 | syntax on 76 | 77 | " file encoding order 78 | set fileencodings=ucs-bom,utf-8,sjis,default 79 | 80 | " vim history file 81 | set viminfo=%100,'100,/100,h,\"500,:100,n~/.viminfo 82 | 83 | " man page integration 84 | source $VIMRUNTIME/ftplugin/man.vim 85 | nmap K :Man 86 | " }}} 87 | " {{{ Mutt settings 88 | autocmd BufNewFile,BufRead /tmp/mutt-* set filetype=mail 89 | au FileType mail set tw=64 autoindent expandtab formatoptions=tcqn 90 | au FileType mail set list listchars=tab:»·,trail:· 91 | au FileType mail set comments=nb:> 92 | au FileType mail vmap D dO[...]^[ 93 | au FileType mail silent normal /--\s*$^MO^[gg/^$^Mj 94 | " }}} 95 | " {{{ Plugins and their settings 96 | 97 | " {{{ CSyntaxPlus plugin 98 | au BufNewFile,BufRead *.{c,h} call CSyntaxPlus() 99 | " }}} 100 | " {{{ Largefile plugin 101 | let g:LargeFile = 10 " 10 mb file is large 102 | " }}} 103 | " {{{ Indent guides plugin 104 | let g:indent_guides_auto_colors=0 " no auto colors 105 | let g:indent_guides_start_level=2 " start level 2 106 | let g:indent_guides_guide_size=2 " size is 2 for guide 107 | hi IndentGuidesOdd ctermbg=234 " odd color 108 | hi IndentGuidesEven ctermbg=235 " even color 109 | autocmd BufEnter * IndentGuidesEnable 110 | map :IndentGuidesToggle 111 | " }}} 112 | " {{{ GLSL plugin 113 | au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl 114 | " }}} 115 | " {{{ YouCompleteMe 116 | let g:ycm_confirm_extra_conf = 0 " don't ask for confirmation 117 | let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' " Bear (https://github.com/rizsotto/Bear) powered 118 | " }}} 119 | " {{{ ListToggle 120 | let g:lt_location_list_toggle_map = '' 121 | let g:lt_quickfix_list_toggle_map = '' 122 | let g:lt_height = 5 123 | " }}} 124 | " {{{ Syntastic 125 | let g:syntastic_error_symbol = '✘' 126 | let g:syntastic_warning_symbol = '⚠' 127 | let g:syntastic_style_error_symbol = '✘' 128 | let g:syntastic_style_warning_symbol = '⚠' 129 | let g:syntastic_enable_highlighting = 0 130 | let g:syntastic_check_on_wq = 0 131 | let g:syntastic_check_on_open = 1 132 | let g:syntastic_auto_loc_list = 2 133 | let g:syntastic_always_populate_loc_list = 1 134 | let g:syntastic_python_checkers = ['pylint'] 135 | let g:syntastic_full_redraws = 0 136 | " }}} 137 | " {{{ Airline 138 | let g:airline#extensions#tabline#enabled = 0 " disabled cause doesn't scroll like vim tab bar does 139 | let g:airline#extensions#tabline#show_buffers = 0 " show only tabs like vim tabline 140 | 141 | if !exists('g:airline_symbols') 142 | let g:airline_symbols = {} 143 | endif 144 | 145 | " unicode symbols 146 | let g:airline#extensions#tabline#left_sep = '▶' 147 | let g:airline#extensions#tabline#right_sep = '◀' 148 | let g:airline_left_sep = '»' 149 | let g:airline_left_sep = '▶' 150 | let g:airline_right_sep = '«' 151 | let g:airline_right_sep = '◀' 152 | let g:airline_symbols.linenr = '¶' 153 | let g:airline_symbols.branch = '⎇' 154 | let g:airline_symbols.paste = 'Þ' 155 | let g:airline_symbols.whitespace = 'Ξ' 156 | " }}} 157 | " {{{ DoxygenToolkit 158 | let g:DoxygenToolkit_authorName="Jari Vetoniemi" 159 | " }}} 160 | 161 | " }}} 162 | " {{{ Keybindings 163 | " Force C-s && C-q to reach terminal 164 | silent !stty -ixon &> /dev/null 165 | 166 | " C-e = cycle tabs, similar to C-w for panes 167 | nmap :tabnext 168 | nmap :tabprev 169 | imap a 170 | imap a 171 | 172 | " toggle paste mode (set pastetoggle doesn't refresh) 173 | map :set invpaste 174 | 175 | " C-c = copy to XA_CLIPBOARD using xcmenu 176 | xnoremap "zy:call system('xcmenu -ci', @z) 177 | 178 | " toggle folds with space 179 | nnoremap za 180 | 181 | " {{{ Bemenu functions 182 | function! Chomp(str) 183 | return escape(substitute(a:str, '\n$', '', ''), '\\/.*$^~[]#') 184 | endfunction 185 | 186 | function! BemenuOpen(cmd) 187 | let gtdir = Chomp(system("git rev-parse --show-toplevel 2>/dev/null")) 188 | if (empty(gtdir)) 189 | return 190 | endif 191 | let fname = Chomp(system("pushd ".gtdir." &>/dev/null; git ls-files 2>/dev/null | bemenu -i -l 20 -p ".a:cmd."; popd &>/dev/null")) 192 | let match = gtdir."/". fname 193 | " this seems to cause vim to fix input in clever way after exiting curses program 194 | silent ! 195 | silent redraw! 196 | echo match 197 | if empty(fname) 198 | return 199 | endif 200 | execute a:cmd." ".match 201 | endfunction 202 | " }}} 203 | " use ctrl-t to open file in a new tab 204 | " use ctrl-f to open file in current buffer 205 | map :call BemenuOpen("tabe") 206 | map :call BemenuOpen("edit") 207 | map :call BemenuOpen("split") 208 | " }}} 209 | " {{{ Aliases 210 | " {{{ Tab change functions 211 | function SetTab(var1) 212 | let level=a:var1 213 | execute "set softtabstop=".level 214 | execute "set shiftwidth=".level 215 | :IndentGuidesToggle 216 | :IndentGuidesToggle 217 | endfunction 218 | " }}} 219 | " allow saving of files as sudo when I forgot to start vim using sudo. 220 | cmap w!! w !sudo tee > /dev/null % 221 | 222 | " change tab settings 223 | nnoremap :8t :call SetTab(8) 224 | nnoremap :4t :call SetTab(4) 225 | nnoremap :3t :call SetTab(3) 226 | nnoremap :2t :call SetTab(2) 227 | 228 | " strip non ascii characters from file 229 | nnoremap :strip :%s/[128-25501-31]//g 230 | 231 | "{{{ Modeline append function 232 | " use substitute() instead of printf() to handle '%%s' modeline in LaTeX 233 | " files. 234 | function! AppendModeline() 235 | let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d :", 236 | \ &tabstop, &shiftwidth, &textwidth) 237 | let l:modeline = substitute(&commentstring, "%s", l:modeline, "") 238 | call append(line("$"), "") 239 | call append(line("$"), l:modeline) 240 | endfunction 241 | " }}} 242 | " append modeline after last line in buffer. 243 | nnoremap :ml :call AppendModeline() 244 | " }}} 245 | 246 | " 247 | " some really useful autostart stuff below 248 | " 249 | " {{{Autocheck file changes 250 | set autoread 251 | augroup checktime 252 | au! 253 | if !has("gui_running") 254 | autocmd BufEnter * silent! checktime 255 | autocmd CursorHold * silent! checktime 256 | autocmd CursorHoldI * silent! checktime 257 | autocmd CursorMoved * silent! checktime 258 | autocmd CursorMovedI * silent! checktime 259 | endif 260 | augroup END 261 | " }}} 262 | " {{{ Keep folds closed on insert mode 263 | autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif 264 | autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif 265 | " }}} 266 | " {{{ Automatically cd into the directory that the file is in 267 | autocmd BufEnter * execute "chdir ".escape(expand("%:p:h"), ' \\/.*$^~[]#') 268 | " }}} 269 | " {{{ Remove any trailing whitespace that is in the file 270 | autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif 271 | " }}} 272 | " {{{ Restore cursor position to where it was before on file open 273 | augroup JumpCursorOnEdit 274 | au! 275 | autocmd BufReadPost * 276 | \ if expand(":p:h") !=? $TEMP | 277 | \ if line("'\"") > 1 && line("'\"") <= line("$") | 278 | \ let JumpCursorOnEdit_foo = line("'\"") | 279 | \ let b:doopenfold = 1 | 280 | \ if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo - 1)) | 281 | \ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 | 282 | \ let b:doopenfold = 2 | 283 | \ endif | 284 | \ exe JumpCursorOnEdit_foo | 285 | \ endif | 286 | \ endif 287 | " Need to postpone using "zv" until after reading the modelines. 288 | autocmd BufWinEnter * 289 | \ if exists("b:doopenfold") | 290 | \ exe "normal zv" | 291 | \ if(b:doopenfold > 1) | 292 | \ exe "+".1 | 293 | \ endif | 294 | \ unlet b:doopenfold | 295 | \ endif 296 | augroup END 297 | " }}} 298 | " {{{Simple custom tabline 299 | function SimpleTabLine() 300 | let s = '' 301 | for i in range(tabpagenr('$')) 302 | " select the highlighting 303 | if i + 1 == tabpagenr() 304 | let s .= '%#TabLineSel#' 305 | else 306 | let s .= '%#TabLine#' 307 | endif 308 | 309 | " set the tab page number (for mouse clicks) 310 | let s .= '%' . (i + 1) . 'T' 311 | let s .= ' %{SimpleTabLabel(' . (i + 1) . ')} ' 312 | endfor 313 | 314 | " after the last tab fill with TabLineFill and reset tab page nr 315 | let s .= '%#TabLineFill#%T' 316 | return s 317 | endfunction 318 | 319 | function SimpleTabLabel(n) 320 | let label = '' 321 | let buflist = tabpagebuflist(a:n) 322 | 323 | for bufnr in buflist 324 | if getbufvar(bufnr, "&modified") 325 | let label = '+' 326 | break 327 | endif 328 | endfor 329 | 330 | let winnr = tabpagewinnr(a:n) 331 | let fn = bufname(buflist[winnr - 1]) 332 | let lastSlash = strridx(fn, '/') 333 | return label . strpart(fn, lastSlash + 1, strlen(fn)) 334 | endfunction 335 | set tabline=%!SimpleTabLine() 336 | " }}} 337 | 338 | " vim: set ts=8 sw=3 tw=78 : 339 | -------------------------------------------------------------------------------- /#ARCHCONFIG/xcolors/colorshot: -------------------------------------------------------------------------------- 1 | *foreground: #CACACA 2 | *background: #121212 3 | 4 | !black 5 | *color0: #1C1C1C 6 | *color8: #4D4D4D 7 | !red 8 | *color1: #D81860 9 | *color9: #F00060 10 | !green 11 | *color2: #B7CE42 12 | *color10: #BDE077 13 | !yellow 14 | *color3: #FEA63C 15 | *color11: #FFE863 16 | !blue 17 | *color4: #66AABB 18 | *color12: #AACCBB 19 | !magenta 20 | *color5: #B7416E 21 | *color13: #BB4466 22 | !cyan 23 | *color6: #5E7175 24 | *color14: #A3BABF 25 | !white 26 | *color7: #DDEEDD 27 | *color15: #6C887A 28 | -------------------------------------------------------------------------------- /.XCompose: -------------------------------------------------------------------------------- 1 | : "…" U2026 # HORIZONTAL ELLIPSIS 2 | : "•" U2022 # BULLET 3 | : "←" leftarrow # LEFTWARDS ARROW 4 | : "↑" uparrow # UPWARDS ARROW 5 | : "→" rightarrow # RIGHTWARDS ARROW 6 | : "↓" downarrow # DOWNWARDS ARROW 7 | : "↔" U2194 # LEFT RIGHT ARROW (kragen's) 8 | : "↔" U2194 # LEFT RIGHT ARROW (kragen's) 9 | : "↕" U2195 # UP DOWN ARROW (kragen's) 10 | : "☯" U262F # YIN YANG 11 | -------------------------------------------------------------------------------- /.Xresources: -------------------------------------------------------------------------------- 1 | ! 2 | ! .Xresources 3 | ! 4 | 5 | ! Color scheme 6 | #include "/arch/xcolors/colorshot" 7 | 8 | ! XFT 9 | Xft.autohint:1 10 | Xft.lcdfilter:lcddefault 11 | Xft.hintstyle:hintslight 12 | Xft.hinting:1 13 | Xft.antialias:1 14 | Xft.dpi:96 15 | Xft.rgba:rgb 16 | -------------------------------------------------------------------------------- /.config/dwb/style.css: -------------------------------------------------------------------------------- 1 | input, button, textarea { 2 | background-color: #FFF; 3 | border: 1px solid #1C1C1C; 4 | color: #2A2A2A; 5 | padding: 2px; 6 | margin: 2px; 7 | outline: none; 8 | display: inline-block; 9 | } 10 | 11 | /* dark theme friendly select components */ 12 | select { 13 | position: relative; 14 | -webkit-appearance: button; 15 | -webkit-box-sizing: border-box; 16 | -moz-box-sizing: border-box; 17 | box-sizing: border-box; 18 | display: inline-block; 19 | vertical-align: middle; 20 | padding: 0.3em 0.6em; 21 | background: white; 22 | border: 1px solid #aaaaaa; 23 | border-radius: 0.3em; 24 | box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4); 25 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 26 | font-weight: normal; 27 | overflow: hidden; 28 | text-shadow: 0 1px 0 white; 29 | -webkit-transition: box-shadow 200ms, border-color 200ms; 30 | -moz-transition: box-shadow 200ms, border-color 200ms; 31 | transition: box-shadow 200ms, border-color 200ms; 32 | white-space: nowrap; 33 | color: #000 !important; 34 | } 35 | 36 | select:disabled, select:disabled:hover { 37 | color: #cccccc !important; 38 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important; 39 | } 40 | 41 | select:not([size]):focus { 42 | outline: none; 43 | border-color: #66ccff; 44 | box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 4px #66ccff; 45 | } 46 | 47 | select:not([size]):hover { 48 | box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 0 3px #ffff88; 49 | } 50 | 51 | select:not([size]) { 52 | border-color: #ececec; 53 | background-color: #ececec; 54 | background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, white), color-stop(100%, #ececec)); 55 | background-image: -webkit-linear-gradient(top, white, #ececec); 56 | background-image: -moz-linear-gradient(top, white, #ececec); 57 | background-image: -ms-linear-gradient(top, white, #ececec); 58 | background-image: -o-linear-gradient(top, white, #ececec); 59 | background-image: linear-gradient(top, white, #ececec); 60 | } 61 | 62 | select:not([size]).focus { 63 | border-color: #66ccff; 64 | } 65 | 66 | @media all and (-webkit-min-device-pixel-ratio: 0) { 67 | .us-form select:not([size]) { 68 | padding-right: 30px; 69 | } 70 | 71 | select:not([size]) { 72 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAWCAYAAADafVyIAAAAzElEQVRIDWP8//8/Ay0BE8zws2fPgmyium1wC2AWUZsetYBgiI4GEcEgYiGoAqqgq6trGZAZia4emFGXlZeXR6OLw/hEx8G/f/+ygYY9hWkE0UD+IyCVhSyGzibagoqKiveMjIyJIHNBhgAN/wekYoGu/wji4wJEWwAyoKysbDfQ4ClQw7qAhh/CZTBMnOg4gGl4+fJluYSEhNC9e/fqYGJ4aaCLQN5lOHPmDJACAzAfyKIKTVIQ4XUpDslRC3AEDEJ46AcRIyg50hIAANnugKRDswA6AAAAAElFTkSuQmCC"), -webkit-gradient(linear, left top, left bottom, color-stop(0%, white), color-stop(100%, #ededed)); 73 | background-image: url("data:image/svg+xml;utf8,select-arrow"), -webkit-linear-gradient(-90deg, white 0%, #ededed 100%); 74 | background-repeat: no-repeat, repeat; 75 | background-position: 100% 50%, 0 0; 76 | } 77 | 78 | select:not([size]):focus { 79 | box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 4px #66ccff; 80 | } 81 | 82 | select:not([size]):hover { 83 | border-color: #c8c8c8; 84 | box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 0 3px #ffff88; 85 | } 86 | } 87 | 88 | select[size] { 89 | -webkit-appearance: none; 90 | -webkit-box-sizing: content-box; 91 | -moz-box-sizing: content-box; 92 | box-sizing: content-box; 93 | display: inline-block; 94 | height: auto; 95 | margin: 2px; 96 | padding: 0.3em 0 0.3em 0.4em; 97 | border: 1px solid #c4c0c0; 98 | border-radius: 2px; 99 | box-shadow: 0px 3px 2px #eeeeee inset; 100 | font-family: "Lucida Grande", helvetica, arial, sans-serif; 101 | font-size: 0.85em !important; 102 | -webkit-transition: box-shadow 200ms, border-color 200ms; 103 | -moz-transition: box-shadow 200ms, border-color 200ms; 104 | -ms-transition: box-shadow 200ms, border-color 200ms; 105 | transition: box-shadow 200ms, border-color 200ms; 106 | vertical-align: middle; 107 | overflow: scroll; 108 | } 109 | 110 | select[size]:focus { 111 | outline: none; 112 | color: #333333; 113 | border-color: #66ccff; 114 | box-shadow: 1px 3px 2px #eeeeee inset, 0 0 4px #66ccff; 115 | } 116 | 117 | select[size]:focus:hover { 118 | outline: none; 119 | color: #333333; 120 | border-color: #66ccff; 121 | box-shadow: 1px 3px 2px #eeeeee inset, 0 0 4px #66ccff; 122 | } 123 | 124 | select[size]:hover { 125 | border-color: #c4c0c0; 126 | box-shadow: 1px 3px 2px #eeeeee inset, 0 0 0 2px #ffff88; 127 | } 128 | 129 | /** nyaa yellow fix */ 130 | .remake { background-color: #FF9E9E !important; } 131 | -------------------------------------------------------------------------------- /.config/dwb/userscripts/urlhandler.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # dwb: Control y 3 | urlhandler "$DWB_URI" 4 | -------------------------------------------------------------------------------- /.config/dwb/userscripts/waai.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # dwb: Control w 3 | url="$(curl -s "http://api.waa.ai/?url=$(echo $DWB_URI | perl -MURI::Escape -lne 'print uri_escape($_)')")" 4 | echo "$url" | xcmenu -ci 5 | -------------------------------------------------------------------------------- /.config/gtk-3.0/gtk.css: -------------------------------------------------------------------------------- 1 | * { 2 | -GtkRange-slider-width: 0; 3 | -GtkRange-stepper-size: 0; 4 | } 5 | -------------------------------------------------------------------------------- /.config/gtk-3.0/settings.ini: -------------------------------------------------------------------------------- 1 | [Settings] 2 | gtk-application-prefer-dark-theme = true 3 | gtk-theme-name = Boje-Red 4 | gtk-font-name = terminus 8 5 | gtk-auto-mnemonics = 1 6 | gtk-button-images = 0 7 | gtk-menu-images = 0 8 | gtk-recent-files-limit = 100 9 | -------------------------------------------------------------------------------- /.config/termite/config: -------------------------------------------------------------------------------- 1 | [options] 2 | resize_grip = false 3 | scroll_on_output = false 4 | scroll_on_keystroke = true 5 | audible_bell = false 6 | visible_bell = false 7 | mouse_autohide = true 8 | allow_bold = true 9 | dynamic_title = true 10 | urgent_on_bell = true 11 | clickable_url = true 12 | font = terminus 9 13 | scrollback_lines = 8192 14 | search_wrap = true 15 | browser = chromium 16 | 17 | # "system", "on" or "off" 18 | cursor_blink = off 19 | 20 | # "block", "underline" or "ibeam" 21 | cursor_shape = block 22 | 23 | # word characters used for word selection 24 | # (default if unset: all graphic non-punctuation/space characters) 25 | # word_chars = -A-Za-z0-9,./?%&#:_=+@~ 26 | 27 | [colors] 28 | foreground = #CACACA 29 | foreground_bold = #ffffff 30 | # foreground_dim = #888888 31 | background = #121212 32 | # cursor = #dcdccc 33 | 34 | # if unset, will reverse foreground and background 35 | # highlight = #2f2f2f 36 | 37 | # colors from color0 to color254 can be set 38 | color0 = #1C1C1C 39 | color1 = #D81860 40 | color2 = #B7CE42 41 | color3 = #FEA63C 42 | color4 = #66AABB 43 | color5 = #B7416E 44 | color6 = #5E7175 45 | color7 = #DDEEDD 46 | color8 = #4D4D4D 47 | color9 = #F00060 48 | color10 = #BDE077 49 | color11 = #FFE863 50 | color12 = #AACCBB 51 | color13 = #BB4466 52 | color14 = #A3BABF 53 | color15 = #6C887A 54 | 55 | [hints] 56 | border = #F92672 57 | border_width = 2.0 58 | roundness = 0.0 59 | 60 | # vim: set filetype=dosini : 61 | -------------------------------------------------------------------------------- /.gtkrc-2.0: -------------------------------------------------------------------------------- 1 | gtk-theme-name = "Boje-Red" 2 | gtk-font-name = "terminus 8" 3 | gtk-auto-mnemonics = 1 4 | -------------------------------------------------------------------------------- /.local/share/wine/handle-prefixes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Handle prefixes 3 | # -- Applies registry fixes automatically 4 | # from regs directory 5 | 6 | DEFAULT_LC_ALL="$LC_ALL" 7 | ROOTDIR="${XDG_DATA_HOME:-$HOME/.local/share}/wine" 8 | MYDOCS="$ROOTDIR/mydocs" 9 | 10 | setupenv() 11 | { 12 | export LC_ALL="$DEFAULT_LC_ALL" 13 | [[ -f "$WINEPREFIX/LANG" ]] && { 14 | export LC_ALL="$(cat "$WINEPREFIX/LANG")" 15 | } 16 | } 17 | 18 | rmdevice() 19 | { 20 | echo -e "\t- Removing dos device: $(basename "$p")" 21 | rm "$p" 22 | } 23 | 24 | manage_prefix() 25 | { 26 | baseprefix="$(basename "$WINEPREFIX")" 27 | echo ":: Managing: $baseprefix" 28 | setupenv 29 | 30 | # Init && Update prefix 31 | wineboot -u 2> /dev/null 32 | 33 | # Apply winetricks 34 | for w in "$ROOTDIR/winetricks/"*; do 35 | [[ "$w" == *@* ]] && [[ "$w" != *@"$baseprefix" ]] && continue 36 | rw="$(echo "$w" | sed "s/@$baseprefix//")" 37 | echo -e "\t+ Winetricks: $(basename "$rw")" 38 | winetricks "$(basename "$rw")" 2> /dev/null 39 | done 40 | 41 | # Apply registry fixes 42 | for r in "$ROOTDIR/regs/"*; do 43 | [[ "$r" == *@* ]] && [[ "$r" != *@"$baseprefix".reg ]] && continue 44 | echo -e "\t+ Applying: $(basename "$r")" 45 | regedit "$r" 2> /dev/null 46 | done 47 | 48 | # Remove paths to / 49 | # FIXME: needs more work 50 | # since wine looks up fonts, etc from Z: 51 | [[ 1 -eq 0 ]] && { 52 | for p in "$WINEPREFIX/dosdevices/"*; do 53 | [[ "$(readlink "$p")" == "/" ]] && rmdevice "$p" 54 | done 55 | } 56 | 57 | # Create /mnt/storage symlink to D: 58 | echo -e "\t+ Symlinking D: to /mnt/storage" 59 | [[ -L "$WINEPREFIX/dosdevices/d:" ]] && rm "$WINEPREFIX/dosdevices/d:" 60 | ln -s "/mnt/storage" "$WINEPREFIX/dosdevices/d:" 61 | 62 | # Create /mnt/東方 symlink to E: 63 | echo -e "\t+ Symlinking E: to /mnt/東方" 64 | [[ -L "$WINEPREFIX/dosdevices/e:" ]] && rm "$WINEPREFIX/dosdevices/e:" 65 | ln -s "/mnt/東方" "$WINEPREFIX/dosdevices/e:" 66 | 67 | # Copy fonts to prefix 68 | for f in "$ROOTDIR/fonts/"*; do 69 | echo -e "\t+ Copying font: $(basename "$f")" 70 | cp "$f" "$WINEPREFIX/drive_c/windows/Fonts/" 71 | done 72 | 73 | # Remove symlinks from user directory 74 | for f in "$WINEPREFIX/drive_c/users/$(whoami)/"*; do 75 | [[ -L "$f" ]] && [[ -d "$f" ]] && { 76 | echo -e "\t+ Removing symlink $(basename "$f")" 77 | rm "$f"; mkdir "$f"; 78 | } 79 | done 80 | 81 | # Symlink mydocs 82 | [[ -d "$WINEPREFIX/drive_c/users/$(whoami)/My Documents" ]] && { 83 | echo -e "\t+ Symlinking \"My Documents\" to \"$MYDOCS\"" 84 | rm -r "$WINEPREFIX/drive_c/users/$(whoami)/My Documents" 85 | ln -s "$MYDOCS" "$WINEPREFIX/drive_c/users/$(whoami)/My Documents" 86 | } 87 | 88 | # End 89 | echo "" 90 | } 91 | 92 | call_if_exists() 93 | { 94 | [[ -d "$WINEPREFIX" ]] || { 95 | echo "No such prefix: $(basename "$WINEPREFIX")" 96 | return 97 | } 98 | 99 | # run 100 | setupenv 101 | exec "$@" 102 | } 103 | 104 | main() 105 | { 106 | [[ -n "$1" ]] && { 107 | local prefix="$1" 108 | shift 1 109 | [[ -n "$@" ]] && { 110 | WINEPREFIX="$ROOTDIR/prefixes/$prefix" \ 111 | call_if_exists "$@" 112 | return 113 | } || { 114 | echo "Did not provide command for prefix" 115 | } 116 | return 117 | } 118 | 119 | # Manage each prefix 120 | for p in "$ROOTDIR/prefixes/"*; do 121 | WINEPREFIX="$p" manage_prefix 122 | done 123 | } 124 | main "$@" 125 | -------------------------------------------------------------------------------- /.local/share/wine/regs/colors.reg: -------------------------------------------------------------------------------- 1 | REGEDIT4 2 | [HKEY_USERS\S-1-5-21-0-0-0-1000\Control Panel] 3 | [HKEY_USERS\S-1-5-21-0-0-0-1000\Control Panel\Colors] 4 | "ActiveBorder"="32 32 32" 5 | "ActiveTitle"="109 38 43" 6 | "AppWorkSpace"="69 69 69" 7 | "ButtonAlternateFace"="32 32 32" 8 | "ButtonDkShadow"="0 0 0" 9 | "ButtonFace"="32 32 32" 10 | "ButtonHilight"="41 41 41" 11 | "ButtonLight"="32 32 32" 12 | "ButtonShadow"="22 22 22" 13 | "ButtonText"="221 221 221" 14 | "GradientActiveTitle"="241 33 46" 15 | "GradientInactiveTitle"="69 69 69" 16 | "GrayText"="112 112 112" 17 | "Hilight"="177 34 43" 18 | "HilightText"="187 187 187" 19 | "HotTrackingColor"="41 41 41" 20 | "InactiveBorder"="32 32 32" 21 | "InactiveTitle"="22 22 22" 22 | "InactiveTitleText"="255 255 255" 23 | "InfoText"="187 187 187" 24 | "InfoWindow"="32 32 32" 25 | "Menu"="41 41 41" 26 | "MenuBar"="32 32 32" 27 | "MenuHilight"="177 34 43" 28 | "MenuText"="187 187 187" 29 | "Scrollbar"="32 32 32" 30 | "TitleText"="255 255 255" 31 | "Window"="69 69 69" 32 | "WindowFrame"="175 36 44" 33 | "WindowText"="204 204 204" 34 | -------------------------------------------------------------------------------- /.local/share/wine/regs/disable-crash-dialog.reg: -------------------------------------------------------------------------------- 1 | [HKEY_CURRENT_USER\Software\Wine\WineDbg] 2 | "ShowCrashDialog"="dword:00000000" 3 | -------------------------------------------------------------------------------- /.local/share/wine/regs/disable-strict-draw-order.reg: -------------------------------------------------------------------------------- 1 | [HKEY_CURRENT_USER\Software\Wine\Direct3D] 2 | "StrictDrawOrdering"="disabled" 3 | -------------------------------------------------------------------------------- /.local/share/wine/regs/disable-winemenubuilder.reg: -------------------------------------------------------------------------------- 1 | [HKEY_CURRENT_USER\Software\Wine\DllOverrides] 2 | "winemenubuilder.exe"="" 3 | -------------------------------------------------------------------------------- /.local/share/wine/regs/enable-always-offscreen.reg: -------------------------------------------------------------------------------- 1 | [HKEY_CURRENT_USER\Software\Wine\Direct3D] 2 | "AlwaysOffscreen"="enabled" 3 | -------------------------------------------------------------------------------- /.local/share/wine/regs/enable-csmt.reg: -------------------------------------------------------------------------------- 1 | [HKEY_CURRENT_USER\Software\Wine\Direct3D] 2 | "CSMT"="enabled" 3 | -------------------------------------------------------------------------------- /.local/share/wine/regs/enable-fakedisp.reg: -------------------------------------------------------------------------------- 1 | [HKEY_CURRENT_USER\Software\Wine\X11 Driver] 2 | "UseXRandR"="N" 3 | "UseXVidMode"="N" 4 | "FakeDispResolution"="1680x1050;1024x768;800x600;640x480" 5 | -------------------------------------------------------------------------------- /.local/share/wine/regs/enable-glsl.reg: -------------------------------------------------------------------------------- 1 | [HKEY_CURRENT_USER\Software\Wine\Direct3D] 2 | "UseGLSL"="enabled" 3 | -------------------------------------------------------------------------------- /.local/share/wine/regs/quartz@ffxiv.reg: -------------------------------------------------------------------------------- 1 | [HKEY_CLASSES_ROOT\CLSID\{7D8AA343-6E63-4663-BE90-6B80F66540A3}] 2 | @="VMR ImageSync" 3 | 4 | [HKEY_CLASSES_ROOT\CLSID\{7D8AA343-6E63-4663-BE90-6B80F66540A3}\InprocServer32] 5 | @="C:\\WINDOWS\\system32\\quartz.dll" 6 | "ThreadingModel"="Both" 7 | 8 | [HKEY_CLASSES_ROOT\CLSID\{99D54F63-1A69-41AE-AA4D-C976EB3F0713}] 9 | @="VMR Allocator Presenter" 10 | 11 | [HKEY_CLASSES_ROOT\CLSID\{99D54F63-1A69-41AE-AA4D-C976EB3F0713}\InprocServer32] 12 | @="C:\\WINDOWS\\system32\\quartz.dll" 13 | "ThreadingModel"="Both" 14 | -------------------------------------------------------------------------------- /.local/share/wine/regs/report-vram.reg: -------------------------------------------------------------------------------- 1 | [HKEY_CURRENT_USER\Software\Wine\Direct3D] 2 | "VideoMemorySize"="1024" 3 | -------------------------------------------------------------------------------- /.local/share/wine/winetricks/d3dx9@ffxiv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cloudef/dotfiles-ng/93b70bb1cdb5d876b9fb9cf2f87befbb004d37b1/.local/share/wine/winetricks/d3dx9@ffxiv -------------------------------------------------------------------------------- /.local/share/wine/winetricks/devenum@ffxiv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cloudef/dotfiles-ng/93b70bb1cdb5d876b9fb9cf2f87befbb004d37b1/.local/share/wine/winetricks/devenum@ffxiv -------------------------------------------------------------------------------- /.local/share/wine/winetricks/ie8@ffxiv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cloudef/dotfiles-ng/93b70bb1cdb5d876b9fb9cf2f87befbb004d37b1/.local/share/wine/winetricks/ie8@ffxiv -------------------------------------------------------------------------------- /.local/share/wine/winetricks/quartz@ffxiv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cloudef/dotfiles-ng/93b70bb1cdb5d876b9fb9cf2f87befbb004d37b1/.local/share/wine/winetricks/quartz@ffxiv -------------------------------------------------------------------------------- /.local/share/wine/winetricks/winhttp@ffxiv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cloudef/dotfiles-ng/93b70bb1cdb5d876b9fb9cf2f87befbb004d37b1/.local/share/wine/winetricks/winhttp@ffxiv -------------------------------------------------------------------------------- /.local/share/wine/winetricks/wininet@ffxiv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cloudef/dotfiles-ng/93b70bb1cdb5d876b9fb9cf2f87befbb004d37b1/.local/share/wine/winetricks/wininet@ffxiv -------------------------------------------------------------------------------- /.local/share/wine/winetricks/wmp10@ffxiv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cloudef/dotfiles-ng/93b70bb1cdb5d876b9fb9cf2f87befbb004d37b1/.local/share/wine/winetricks/wmp10@ffxiv -------------------------------------------------------------------------------- /.local/share/wine/winetricks/xact_jun2010@ffxiv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cloudef/dotfiles-ng/93b70bb1cdb5d876b9fb9cf2f87befbb004d37b1/.local/share/wine/winetricks/xact_jun2010@ffxiv -------------------------------------------------------------------------------- /.newsbeuter/colors/colorshot.theme: -------------------------------------------------------------------------------- 1 | #highlight feedlist "^.* N .*$" color15 default bold 2 | #highlight articlelist "^.* N .*$" color15 default bold 3 | highlight article "^Feed: .*$" color3 default 4 | highlight article "^Title: .*$" color13 default bold 5 | highlight article "^Author: .*$" color5 default 6 | highlight article "^Link: .*$" color6 default 7 | highlight article "^Date: .*$" color4 default 8 | color listnormal_unread red default bold 9 | color listnormal color7 default 10 | color listfocus red default 11 | color listfocus_unread default red bold 12 | color info color7 black 13 | color article color246 default 14 | 15 | # vim: ft=conf 16 | -------------------------------------------------------------------------------- /.newsbeuter/config: -------------------------------------------------------------------------------- 1 | include ~/.newsbeuter/colors/colorshot.theme 2 | browser newsbeuter-open 3 | auto-reload yes 4 | reload-time 15 5 | reload-threads 2 6 | refresh-on-startup yes 7 | feedlist-title-format " Feeds" 8 | -------------------------------------------------------------------------------- /.rtorrent.rc: -------------------------------------------------------------------------------- 1 | # default download directory and session settings 2 | directory = /mnt/storage 3 | session = /home/loli/.rtorrent 4 | 5 | # up|down 6 | download_rate = 0 7 | upload_rate = 500 8 | 9 | # peer limits 10 | min_peers = 10 11 | max_peers = 550 12 | min_peers_seed = 10 13 | max_peers_seed = 550 14 | 15 | # ram limits 16 | max_memory_usage = 1800M 17 | network.xmlrpc.size_limit = 2M 18 | 19 | # sort views by creation date 20 | view.sort_new = main,less=d.creation_date= 21 | view.sort_current = main,less=d.creation_date= 22 | 23 | # close torrents when disk space below 2,5G 24 | schedule = low_diskspace,5,60,close_low_diskspace=2500M 25 | 26 | # auto torrent directories 27 | schedule = anime_torrent,10,10,"load.start=/mnt/anime/torrent/*.torrent,d.directory.set=/mnt/anime/seed" 28 | schedule = anime_torrent2,10,10,"load.start=/mnt/storage/anime/torrent/*.torrent,d.directory.set=/mnt/storage/anime/seed" 29 | schedule = anime_torrent3,10,10,"load.start=/mnt/東方/anime/torrent/*.torrent,d.directory.set=/mnt/東方/anime/seed" 30 | schedule = anime_torrent4,10,10,"load.start=/mnt/storage2/anime/torrent/*.torrent,d.directory.set=/mnt/storage2/anime/seed" 31 | schedule = anime_torrent5,10,10,"load.start=/mnt/anime2/torrent/*.torrent,d.directory.set=/mnt/anime2/seed" 32 | schedule = storage_torrent,10,10,"load.start=/mnt/storage/torrent/*.torrent,d.directory.set=/mnt/storage" 33 | schedule = storage_torrent2,10,10,"load.start=/mnt/東方/torrent/*.torrent,d.directory.set=/mnt/東方" 34 | 35 | # 36 | # Other settings below 37 | # 38 | 39 | # general network 40 | max_uploads = 84 41 | port_range = 49165-49165 42 | port_random = no 43 | 44 | # general protocol 45 | dht = auto 46 | dht_port = 6882 47 | protocol.pex.set = yes 48 | trackers.use_udp.set = yes 49 | 50 | # general other 51 | encryption = allow_incoming,try_outgoing,enable_retry 52 | check_hash = no 53 | 54 | # Preallocate files; reduces defragmentation on filesystems. 55 | system.file.allocate.set = yes 56 | 57 | # pyroscope settings 58 | method.insert = pyro.extended, value|const, 1 59 | 60 | # auto-collapse views 61 | schedule = bind_collapse,0,0,"ui.bind_key=download_list,c,view.collapsed.toggle=" 62 | view.collapsed.toggle=main 63 | view.collapsed.toggle=name 64 | view.collapsed.toggle=active 65 | view.collapsed.toggle=started 66 | view.collapsed.toggle=stopped 67 | view.collapsed.toggle=complete 68 | view.collapsed.toggle=incomplete 69 | view.collapsed.toggle=hashing 70 | view.collapsed.toggle=seeding 71 | view.collapsed.toggle=leeching 72 | view.collapsed.toggle=rtcontrol 73 | 74 | # network graph 75 | schedule = network_history_sampling,1,32, network.history.sample= 76 | method.insert = network.history.auto_scale.toggle, simple|private, "branch=network.history.auto_scale=,\"network.history.auto_scale.set=0\",\"network.history.auto_scale.set=1\"" 77 | method.insert = network.history.auto_scale.ui_toggle, simple|private, "network.history.auto_scale.toggle= ;network.history.refresh=" 78 | branch=pyro.extended=,"schedule = bind_auto_scale,0,0,\"ui.bind_key=download_list,=,network.history.auto_scale.ui_toggle=\"" 79 | 80 | # VIEW: Use rtcontrol filter (^X s=KEYWORD, ^X t=TRACKER, ^X f="FILTER") 81 | method.insert = s,simple,"execute_nothrow=rtcontrol,--detach,-qV,\"$cat=*,$argument.0=,*\"" 82 | method.insert = t,simple,"execute_nothrow=rtcontrol,--detach,-qV,\"$cat=\\\"alias=\\\",$argument.0=\"" 83 | method.insert = f,simple,"execute_nothrow=rtcontrol,--detach,-qV,$argument.0=" 84 | 85 | # Colors 86 | ui.color.alarm.set="" 87 | ui.color.focus.set="red" 88 | ui.color.footer.set="red" 89 | ui.color.incomplete.set="yellow" 90 | ui.color.info.set="red" 91 | ui.color.label.set="white" 92 | ui.color.leeching.set="yellow" 93 | ui.color.queued.set="magenta" 94 | ui.color.seeding.set="green" 95 | ui.color.title.set="red" 96 | 97 | # 256 color tweak 98 | ui.color.complete.set=41 99 | ui.color.stopped.set=33 100 | ui.color.even.set="on 234" 101 | ui.color.odd.set="on 233" 102 | ui.color.progress0.set=196 103 | ui.color.progress20.set=202 104 | ui.color.progress40.set=213 105 | ui.color.progress60.set=214 106 | ui.color.progress80.set=226 107 | ui.color.progress100.set=41 108 | ui.color.progress120.set="green" 109 | 110 | # ASCII glyphs 111 | ui.style.ratio.set=0 112 | -------------------------------------------------------------------------------- /.vimrc: -------------------------------------------------------------------------------- 1 | " 2 | " .vimrc 3 | " 4 | 5 | " source systemwide configuration 6 | source /arch/vim/vimrc 7 | imap jk 8 | -------------------------------------------------------------------------------- /.xinitrc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export _XINIT_WM="${@-"monsterwm"}" 3 | 4 | # xrandr first for monitor setup 5 | xrandr --output HDMI-1 --auto --output DVI-D-1 --auto --right-of HDMI-1 6 | 7 | # autostart 8 | autostart() { 9 | # wait for wm 10 | while ! killall -0 $_XINIT_WM; do sleep 1; done 11 | # nitrogen 12 | nitrogen --restore 13 | # start stalonetray daemon 14 | stalonetrayd 15 | # redshift for my eyes 16 | redshift -l 62:22 &> /dev/null & 17 | # start irc, rss, torrent 18 | irc; rss; torrent; 19 | # xcmenu clipboard manager 20 | xcmenu -d 21 | # unclutter 22 | unclutter -grab -root & 23 | } 24 | 25 | # kill leftovers 26 | autokill() { 27 | # kill redshift 28 | killall redshift 29 | # kill xcmenu 30 | killall xcmenu 31 | # kill stalonetray 32 | killall stalonetray 33 | # kill unclutter 34 | killall unclutter 35 | } 36 | 37 | # monsterwm bar 38 | monsterwm_bar() { 39 | local ff="/tmp/monsterwm.fifo" 40 | pgrep -x "^monsterstatus" > /dev/null || { 41 | monsterstatus "$ff" | bar & 42 | } 43 | } 44 | 45 | # special route for monsterwm 46 | monsterwm_init() { 47 | local ff="/tmp/monsterwm.fifo" 48 | rm "$ff"; monsterwm_bar 49 | while [[ ! -p "$ff" ]]; do sleep 1; done; sleep 1 50 | exec monsterwm | tee -a "$ff" &> /dev/null 51 | [[ -p "$ff" ]] && rm "$ff" 52 | } 53 | 54 | # Check if wm is already running 55 | pgrep -x "^$_XINIT_WM" > /dev/null && { monsterwm_bar; exit 0; } 56 | 57 | # 58 | # dirty bits below 59 | # 60 | 61 | # UIM 62 | export GTK_IM_MODULE='uim' 63 | export XMODIFIERS=@im='uim' 64 | export QT_IM_MODULE='uim' 65 | uim-xim &> /dev/null & 66 | 67 | # Wacom 68 | xsetwacom --set 11 MapToOutput "1680x1050+0+0" 69 | xsetwacom --set 12 MapToOutput "1680x1050+0+0" 70 | 71 | xset +fp /usr/share/fonts/local 72 | xset r rate 350 45 73 | xset s off 74 | xset -dpms 75 | setxkbmap fi 76 | xrdb -load $HOME/.Xresources 77 | xsetroot -cursor_name left_ptr 78 | setxkbmap -option terminate:ctrl_alt_bksp 79 | setxkbmap -option compose:rwin 80 | 81 | autostart & 82 | [[ "$_XINIT_WM" == "monsterwm" ]] && monsterwm_init 83 | [[ "$_XINIT_WM" != "monsterwm" ]] && exec $_XINIT_WM &> /dev/null 84 | autokill; sleep 1 85 | -------------------------------------------------------------------------------- /.ycm_extra_conf.py: -------------------------------------------------------------------------------- 1 | # 2 | # Default YCM config powered with bear (https://github.com/rizsotto/Bear)! 3 | # pylint: disable=invalid-name, missing-docstring, import-error, line-too-long, undefined-variable 4 | # 5 | 6 | import os 7 | import ycm_core 8 | from clang_helpers import PrepareClangFlags 9 | 10 | def FindCompileCommands(): 11 | path = os.getcwd() 12 | first = os.path.split(os.path.sep)[0] 13 | while path is not first and not os.path.isfile(os.path.join(path, 'compile_commands.json')): 14 | path = os.path.dirname(path) 15 | 16 | if path is first: 17 | return None 18 | 19 | return path 20 | 21 | 22 | # Set this to the absolute path to the folder (NOT the file!) containing the 23 | # compile_commands.json file to use that instead of 'flags'. See here for 24 | # more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html 25 | # Most projects will NOT need to set this to anything; you can just change the 26 | # 'flags' list of compilation flags. Notice that YCM itself uses that approach. 27 | compilation_database_folder = FindCompileCommands() 28 | 29 | if compilation_database_folder is not None: 30 | database = ycm_core.CompilationDatabase(compilation_database_folder) 31 | else: 32 | database = None 33 | 34 | def MakeRelativePathsInFlagsAbsolute(flags, working_directory): 35 | if not working_directory: 36 | return flags 37 | 38 | new_flags = [] 39 | make_next_absolute = False 40 | path_flags = ['-isystem', '-I', '-iquote', '--sysroot='] 41 | for flag in flags: 42 | new_flag = flag 43 | 44 | if make_next_absolute: 45 | make_next_absolute = False 46 | if not flag.startswith('/'): 47 | new_flag = os.path.join(working_directory, flag) 48 | 49 | for path_flag in path_flags: 50 | if flag == path_flag: 51 | make_next_absolute = True 52 | break 53 | 54 | if flag.startswith(path_flag): 55 | path = flag[len(path_flag):] 56 | new_flag = path_flag + os.path.join(working_directory, path) 57 | break 58 | 59 | if new_flag: 60 | new_flags.append(new_flag) 61 | 62 | return new_flags 63 | 64 | def FlagsForFile(filename): 65 | if not database: 66 | return None 67 | 68 | # Bear in mind that compilation_info.compiler_flags_ does NOT return a 69 | # python list, but a "list-like" StringVec object 70 | compilation_info = database.GetCompilationInfoForFile(filename) 71 | final_flags = PrepareClangFlags(MakeRelativePathsInFlagsAbsolute( 72 | compilation_info.compiler_flags_, compilation_info.compiler_working_dir_), filename) 73 | 74 | return { 75 | 'flags': final_flags, 76 | 'do_cache': True 77 | } 78 | -------------------------------------------------------------------------------- /.zshrc: -------------------------------------------------------------------------------- 1 | # 2 | # .zshrc 3 | # 4 | 5 | # export prezto directory 6 | export ZDOTDIR="$HOME" 7 | 8 | export XKB_DEFAULT_LAYOUT="fi" 9 | 10 | # source system-wide configuration 11 | source "/arch/shell/zshrc" 12 | source "$HOME/.private" 13 | source "$HOME/lib/anime/envanime" 14 | 15 | # unalias stuff we don't want 16 | unalias scp 17 | unalias sftp 18 | 19 | # show time if command takes longer than 5 seconds 20 | export REPORTTIME=5 21 | 22 | # OpenGL stuff 23 | export __GL_SYNC_TO_VBLANK=1 24 | export __GL_SYNC_DISPLAY_DEVICE=DFP-0 25 | export __GL_THREADED_OPTIMIZATIONS=0 26 | 27 | # edit commandline in vim 28 | bindkey "^E" edit-command-line 29 | 30 | # wine related 31 | export WINEDIR="${XDG_DATA_HOME-$HOME/.local/share}/wine" 32 | export WINEPREFIX="$WINEDIR/prefixes/default" 33 | alias winedir="cd $WINEDIR" 34 | alias vmetal="WINEDEBUG=-all wine $WINEDIR/prefixes/default/drive_c/Program\ Files/Native\ Instruments/Kontakt\ 5/Kontakt\ 5.exe" 35 | 36 | # other aliases 37 | alias mplayer=mpv 38 | alias qchmod="find . \( -type f -execdir chmod -v 644 {} \; \) -o \( -type d -execdir chmod -v 755 {} \; \)" 39 | alias homurapolkka='mpv -loop inf "/mnt/storage/videos/【MMD】Go home Homura, you are drunk【ハピトリ】HD Version!-kwiuX2OAvJg.mp4"' 40 | alias sxivbooru="sxiv -R /mnt/storage/pictures/danbooru" 41 | 42 | # directory aliases 43 | alias dev="cd /mnt/storage/dev" 44 | alias ogl="cd /mnt/storage/dev/projektit/glhck" 45 | alias pkg="cd /arch/pkg" 46 | alias pkgb="cd /arch/pkg/pkgbuild" 47 | alias src="cd /arch/pkg/source" 48 | alias manime="cd /mnt/anime" 49 | alias manime2="cd /mnt/anime2" 50 | alias mstorage="cd /mnt/storage" 51 | alias mstorage2="cd /mnt/storage2" 52 | alias mth="cd /mnt/東方" 53 | alias mcd="cd /mnt/東方/music" 54 | alias eterm="vim ~/.config/termite/config" 55 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Dotfiles for the new SSD install. 2 | -------------------------------------------------------------------------------- /bin/ixio: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # paste to ixio or other paste services 3 | 4 | declare -A servers # Assocative arrays, BASH 4.2 or something 5 | servers['s1']='http://ix.io f:1' 6 | servers['s2']='http://sprunge.us sprunge' 7 | servers['s3']='http://vpaste.net text' 8 | 9 | # default server 10 | s=${1-'s2'} 11 | [[ -n "${servers[$s]}" ]] || s='s2' 12 | [[ "$1" == "$s" ]] && shift 1 13 | 14 | # check argument for server 15 | components=(${servers[$s]}) 16 | server="${components[0]}" 17 | field="${components[1]}" 18 | 19 | # sanitize 20 | if [[ ! -n "$server" ]] || [[ ! -n "$field" ]]; then 21 | echo "-!- bad server or curl field! ($server : $field)" 1>&2 22 | exit 1 23 | fi 24 | 25 | if [[ -n "$1" ]] && [[ ! -f "$1" ]]; then 26 | echo "-!- no such file: $1" 27 | exit 1 28 | fi 29 | 30 | # do the thing 31 | if [[ -f "$1" ]]; then 32 | out="$(curl -s -F "$field=<$1" "$server")" # file 33 | else 34 | out="$(curl -s -F "$field=<-" "$server")" # stdin 35 | fi 36 | 37 | # result 38 | if [[ -n "$out" ]]; then 39 | echo "$out" 40 | else 41 | echo "-!- paste failed!" 1>&2 42 | fi 43 | 44 | # vim: set ts=8 sw=3 tw=0 : 45 | -------------------------------------------------------------------------------- /lib/anime/bin/anime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # watch anime 3 | # arg: l <- open episodes for last anime 4 | # 5 | # to save shell history do alias 6 | # in zsh: 7 | # alias anime='print -s "$(/path/to/this/script)"' 8 | # in bash: 9 | # alias anime='history -s "$(/path/to/this/script)"' 10 | # 11 | 12 | source "$_LIBANIME_ROOT/libanime" 13 | 14 | main() { 15 | # init 16 | _anime_init "$@"; shift $? 17 | 18 | # locate and filter 19 | local match1="$(_anime_get_f "$_ANIME_WATCHING" "$@")" 20 | local match2="$(_anime_get_f "$_ANIME_WATCHED" "$@")" 21 | 22 | # join matches 23 | [[ -n "$match1" ]] && match="$match1" 24 | [[ -n "$match2" ]] && { 25 | [[ -n "$match" ]] && match="$match\n" 26 | match="$match$match2" 27 | } 28 | 29 | # get index for anime from history 30 | [[ -n "$hsanime" ]] && index=$(echo -e "$match" | sed 's/^IMG:.*\t//' | grep -Fon "$hsanime" | cut -f1 -d: | head -n1) 31 | [[ -n "$index" ]] || index=1 32 | 33 | # output to dmenu 34 | [[ $(echo -e "$match" | wc -l) -gt 1 ]] && match="$(echo -e "$match" | dmenu -i -l 5 -si $index -is 153 -ia top -p "anime")" 35 | [[ -n "$match" ]] || return 1 36 | 37 | # create full path 38 | file="$(_anime_lookup_f "$_ANIME_WATCHING" "$match")" 39 | [[ -f "$file" ]] || file="$(_anime_lookup_f "$_ANIME_WATCHED" "$match")" 40 | [[ -f "$file" ]] || return 1; 41 | 42 | # append to history 43 | _anime_hist_store "$match" 44 | 45 | # play 46 | echo "playing: $file" 47 | mpv "$file" 1> /dev/null 48 | } 49 | 50 | IFS=$'\n' 51 | args=($(_anime_hist_get 1)) 52 | hsanime="${args[1]}" 53 | if [[ "$1" == "l" ]] && [[ -n "${args[@]}" ]]; then 54 | anime="$(echo ${args[1]} | sed 's/[0-9-]//g;s/[- ]*$//g;s/ ?*/ /g')" 55 | main -r "${args[0]}" "$anime" 56 | else 57 | main "$@" 58 | fi 59 | -------------------------------------------------------------------------------- /lib/anime/bin/hsanime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # show anime history 3 | # args: [number] to do basically head on this script 4 | 5 | source "$_LIBANIME_ROOT/libanime" 6 | 7 | let p=0 8 | _anime_hist_get $@ | while read i; do 9 | [[ $p -eq 0 ]] && echo -n "anime -r \"$i\" " 10 | [[ $p -eq 1 ]] && echo "$i" 11 | let p=!p 12 | done 13 | -------------------------------------------------------------------------------- /lib/anime/bin/mkanime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # create new anime directory in watched 3 | # directory 4 | 5 | source "$_LIBANIME_ROOT/libanime" 6 | 7 | err() { echo "$@" 1>&2; exit 1; } 8 | main() { 9 | _anime_init "$@"; shift $? 10 | [[ -n "$@" ]] || err "usage: [-r ] $(basename $0) [anime name]" 11 | 12 | # mkdir 13 | mkdir "$_ANIME_WATCHING/$@" 14 | echo "created: $_ANIME_WATCHING/$@" 15 | 16 | # update caches 17 | echo "-!- updating cache" 18 | _anime_update "$_ANIME_WATCHING" 19 | } 20 | main "$@" 21 | -------------------------------------------------------------------------------- /lib/anime/bin/mvanime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # move anime from seed location 3 | # to watching location 4 | # 5 | # mvanime uses only find (atm at least) 6 | 7 | source "$_LIBANIME_ROOT/libanime" 8 | 9 | main() { 10 | local from=; local to=; local update=; 11 | _anime_init "$@"; shift $? 12 | 13 | # select seed 14 | fromf="$(find $_ANIME_SEED -maxdepth 1 -mindepth 1 -type f -exec basename {} \; | \ 15 | grep -v "\.ass" | grep -v "\.srt")" 16 | fromd="$(find "$_ANIME_SEED" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;)" 17 | from="$(echo -e "$fromf\n$fromd" | dmenu -i -l 5 -p mvanime)" 18 | [[ -n "$from" ]] || return 19 | [[ -f "$_ANIME_SEED/$from" ]] && from="$_ANIME_SEED/$from" 20 | [[ -d "$_ANIME_SEED/$from" ]] && from="$_ANIME_SEED/$from" 21 | [[ ! -d "$from" ]] && [[ ! -f "$from" ]] && return 22 | 23 | # select destination 24 | to="$(find "$_ANIME_WATCHING" "$_ANIME_WATCHED" -maxdepth 1 -mindepth 1 -type d -exec basename {} \; | dmenu -i -l 5 -p "to")" 25 | [[ -n "$to" ]] || return 26 | [[ -d "$_ANIME_WATCHING/$to" ]] && { update="$_ANIME_WATCHING"; to="$_ANIME_WATCHING/$to"; } 27 | [[ -d "$_ANIME_WATCHED/$to" ]] && { update="$_ANIME_WATCHED"; to="$_ANIME_WATCHED/$to"; } 28 | [[ ! -d "$to" ]] && [[ ! -f "$to" ]] && return 29 | 30 | # move 31 | mv -v "$from" "$to" || return 32 | 33 | # update caches 34 | echo "-!- updating cache" 35 | _anime_update "$update" 36 | "$_LIBANIME_ROOT/bin/tbanime" -r "$_ANIME_ROOT" "$(_anime_filter "$from")" &> /dev/null 37 | } 38 | main "$@" 39 | -------------------------------------------------------------------------------- /lib/anime/bin/rsanime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # move anime from watching location 3 | # to watched location 4 | # 5 | # rsanime uses only find (atm at least) 6 | 7 | source "$_LIBANIME_ROOT/libanime" 8 | 9 | main() { 10 | local from=; local to= 11 | _anime_init "$@"; shift $? 12 | 13 | # select seed 14 | from="$(find "$_ANIME_WATCHING" -maxdepth 1 -mindepth 1 -type d -exec basename {} \; | \ 15 | dmenu -i -l 20 -p rsanime)" 16 | [[ -n "$from" ]] && [[ -d "$_ANIME_WATCHING/$from" ]] || return 17 | 18 | # store 19 | mv -v "$_ANIME_WATCHING/$from" "$_ANIME_WATCHED/$from" || 20 | return 21 | 22 | # update caches 23 | echo "-!- updating cache" 24 | _anime_update "$_ANIME_WATCHING" 25 | _anime_update "$_ANIME_WATCHED" 26 | } 27 | main "$@" 28 | -------------------------------------------------------------------------------- /lib/anime/bin/tbanime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Create thumbnails for anime 3 | # arg: c <- clear all thumbnails 4 | 5 | source "$_LIBANIME_ROOT/libanime" 6 | 7 | # Signal handler 8 | sigint() { 9 | # Kill all sub processes 10 | test -z "`jobs -p`" || kill -9 `jobs -p` &> /dev/null 11 | echo "$(basename "$0"): SIGINT" 12 | exit 1 13 | } 14 | 15 | # $1 = int 16 | # $2 = out 17 | # $3 = name 18 | thumb() { 19 | [[ -f "$2" ]] || 20 | ffmpeg -nostdin -ss 00:05:00 -i "$1" -vframes 1 -filter:v scale="153:86" "$2" &> /dev/null 21 | [[ -f "$2" ]] || 22 | ffmpeg -nostdin -ss 00:00:20 -i "$1" -vframes 1 -filter:v scale="153:86" "$2" &> /dev/null 23 | echo "$3" 24 | } 25 | 26 | main() { 27 | _anime_init "$@"; shift $? 28 | 29 | [[ -n "$_LIBANIME_THUMB" ]] || { echo "-!- No thumbnail cache directory specified"; return; } 30 | [[ -d "$_LIBANIME_THUMB" ]] || { echo "-!- Thumbnail cache directory doesn't exist: $_LIBANIME_THUMB"; return; } 31 | [[ "$@" == "c" ]] || [[ "$@" == "-c" ]] || [[ "$@" == "--clean" ]] && { 32 | echo "-!- Clearing all thumbnails..." 33 | rm "$_LIBANIME_THUMB/"* 34 | echo "-!- Anime thumbnail cache cleared" 35 | return 36 | } 37 | 38 | local FORK_LIMIT=3 39 | _anime_get_f "$_ANIME_WATCHING" "$@" | sed 's/^IMG:.*\t//' | while read i; do 40 | f="$(_anime_lookup_f "$_ANIME_WATCHING" "$i")" 41 | img="$_LIBANIME_THUMB/$(__anime_md5 "$i").png" 42 | thumb "$f" "$img" "$i" & 43 | while [[ $(jobs -p | wc -l) -gt $FORK_LIMIT ]]; do sleep 1; done 44 | done 45 | while [[ $(jobs -p | wc -l) -gt 1 ]]; do sleep 1; done 46 | _anime_get_f "$_ANIME_WATCHED" "$@" | sed 's/^IMG:.*\t//' | while read i; do 47 | f="$(_anime_lookup_f "$_ANIME_WATCHED" "$i")" 48 | img="$_LIBANIME_THUMB/$(__anime_md5 "$i").png" 49 | thumb "$f" "$img" "$i" & 50 | while [[ $(jobs -p | wc -l) -gt $FORK_LIMIT ]]; do sleep 1; done 51 | done 52 | while [[ $(jobs -p | wc -l) -gt 1 ]]; do sleep 1; done 53 | } 54 | 55 | # Trap SIGINT 56 | trap sigint SIGINT 57 | main "$@" 58 | -------------------------------------------------------------------------------- /lib/anime/bin/upanime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # update anime cache manually 3 | 4 | source "$_LIBANIME_ROOT/libanime" 5 | 6 | main() { 7 | _anime_init "$@"; shift $? 8 | echo "-!- updating cache" 9 | _anime_update "$_ANIME_WATCHING" 10 | _anime_update "$_ANIME_WATCHED" 11 | } 12 | main "$@" 13 | -------------------------------------------------------------------------------- /lib/anime/envanime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # anime enviroiment 3 | # 4 | # needs: mlocate 5 | 6 | # configuration 7 | export _LIBANIME_ROOT="$HOME/lib/anime" # root path to this library 8 | export _LIBANIME_DB="$_LIBANIME_ROOT/locate.db" # locate.db for mlocate 9 | export _LIBANIME_CACHE="$_LIBANIME_ROOT/cache" # .afil, .adir for regexped cache 10 | export _LIBANIME_THUMB="$_LIBANIME_ROOT/thumb" # thumbnails 11 | export _ANIME_HISTORY="$_LIBANIME_ROOT/history" # history list 12 | export _ANIME_HISTORY_MAX=100 # max history 13 | export _ANIME_SEED_DIR="seed" # seed directory 14 | export _ANIME_WATCHING_DIR="watching" # watching directory 15 | export _ANIME_WATCHED_DIR="watched" # watched directory 16 | export _ANIME_ROOT="/mnt/anime" # root of your animus 17 | 18 | # setup PATH 19 | export PATH="$_LIBANIME_ROOT/bin:$PATH" 20 | -------------------------------------------------------------------------------- /lib/anime/libanime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # common source file for anime functions 3 | # 4 | # needs: mlocate, sed, perl 5 | 6 | CACHE_IGNORE_EGREP='\.srt\|\.ass\|\.sfv' 7 | CACHE_STORE_REGEX='s/\..\{3\}$//;s/\[[^]]*\]/ /g;s/([^)]*)//g;s/[_.]/ /g;s/^[- ]*//g;s/[- ]*$//g;s/v[0-9]//;s/ ?*/ /g' 8 | CACHE_LOOKUP_REGEX='s/ \([0-9]\w\)/?\1/g;s/[!]/*/g;s/ \+ /*/g;s/ /*/g' 9 | 10 | err() { echo "$@" 1>&2; exit 1; } 11 | 12 | # get md5 13 | __anime_md5() { 14 | md5="$(echo "$@" | md5sum)" 15 | echo "${md5%% *}" 16 | } 17 | 18 | # get md5sum for path 19 | __anime_hash() { 20 | local bname="$@"; local md5= 21 | [[ -d "$bname" ]] && bname="$(echo "$bname" | sed 's/\/*$//')" 22 | [[ ! -d "$bname" ]] && bname="$(dirname "$bname")" 23 | __anime_md5 "$bname" 24 | } 25 | 26 | # basename and echo files only 27 | __anime_base_f() { 28 | while read fn; do 29 | [[ -f "$fn" ]] && basename "$fn" 30 | done 31 | } 32 | 33 | # basename and echo directories only 34 | __anime_base_d() { 35 | while read fn; do 36 | [[ -d "$fn" ]] && basename "$fn" 37 | done 38 | } 39 | 40 | # store anime to history 41 | # $1 = anime 42 | _anime_hist_store() { 43 | local histline="$@ @=> $_ANIME_ROOT" 44 | [[ -n "$_ANIME_HISTORY" ]] || return 45 | [[ "$histline" == "$(tail -n1 "$_ANIME_HISTORY")" ]] && return 46 | echo "$histline" >> "$_ANIME_HISTORY" 47 | [[ $_ANIME_HISTORY_MAX -gt 0 ]] && tail -n$_ANIME_HISTORY_MAX "$_ANIME_HISTORY" | sponge "$_ANIME_HISTORY" 48 | } 49 | 50 | # get anime from history (by index) 51 | # returns: storage \n anime 52 | _anime_hist_get() { 53 | [[ -f "$_ANIME_HISTORY" ]] || return 54 | if [[ $1 -gt 0 ]]; then 55 | local line="$(tail -n$1 "$_ANIME_HISTORY" | head -n1)" 56 | echo "${line/* @=> /}" # storage 57 | echo "${line/ @=> */}" # anime 58 | else 59 | tac "$_ANIME_HISTORY" | while read line; do 60 | echo "${line/* @=> /}" # storage 61 | echo "${line/ @=> */}" # anime 62 | done 63 | fi 64 | } 65 | 66 | # filter single filename 67 | # $1 = filename 68 | _anime_filter() { 69 | basename "$@" | grep -ve "$CACHE_IGNORE_EGREP" | sed "$CACHE_STORE_REGEX" | perl -p -e 's/^\n//g' 70 | } 71 | 72 | # get anime list from location (files only) 73 | # $1 = directory to search 74 | # $2 = search term 75 | _anime_get_f() { 76 | local db="$1"; local md5="$(__anime_hash "$1")"; shift; local name="$@" 77 | [[ -f "$_LIBANIME_CACHE/$md5.afil" ]] && { grep -i "$name" "$_LIBANIME_CACHE/$md5.afil"; return; } || 78 | locate -d "$_LIBANIME_DB" "$db" | __anime_base_f | \ 79 | grep -ve "$CACHE_IGNORE_EGREP" | sed "$CACHE_STORE_REGEX" | perl -p -e 's/^\n//g' | \ 80 | while read i; do echo -n "IMG:$_LIBANIME_THUMB/$(__anime_md5 "$i").png"; echo -ne "\t"; echo "$i"; done | \ 81 | tee "$_LIBANIME_CACHE/$md5.afil" | grep -i "$name" 82 | } 83 | 84 | # get anime list from location (directories only) 85 | # $1 = directory to search 86 | # $2 = search term 87 | _anime_get_d() { 88 | local db="$1"; local md5="$(__anime_hash "$1")"; shift; local name="$@" 89 | [[ -f "$_LIBANIME_CACHE/$md5.adir" ]] && { grep -i "$name" "$_LIBANIME_CACHE/$md5.adir"; return; } || 90 | locate -d "$_LIBANIME_DB" "$db" | __anime_base_d | \ 91 | grep -ve "$CACHE_IGNORE_EGREP" | sed "$CACHE_STORE_REGEX" | perl -p -e 's/^\n//g' | \ 92 | tee "$_LIBANIME_CACHE/$md5.adir" | grep -i "$name" 93 | } 94 | 95 | # lookup anime from _get list (files only) 96 | # $1 = directory to search 97 | # $2 = search term 98 | _anime_lookup_f() { 99 | local db="$1"; local md5="$(__anime_hash "$db")"; 100 | shift; local lookup="$(echo "$@" | sed "$CACHE_LOOKUP_REGEX")" 101 | # echo "$db/*$lookup*" 1>&2 102 | locate -d "$_LIBANIME_DB" "$db/*$lookup*" | grep -ve "$CACHE_IGNORE_EGREP" | tail -n1 103 | } 104 | 105 | # lookup anime from _get list (directories only) 106 | _anime_lookup_d() { 107 | local db="$1"; local md5="$(__anime_hash "$db")"; 108 | shift; local lookup="$(echo "$@" | sed "$CACHE_LOOKUP_REGEX")" 109 | locate -d "$_LIBANIME_DB" "$db/*$lookup*" | grep -ve "$CACHE_IGNORE_EGREP" | tail -n1 110 | } 111 | 112 | # purge cache 113 | _anime_purge() { 114 | [[ -d "$_LIBANIME_CACHE" ]] && { 115 | rm "$_LIBANIME_CACHE/*.afil" 116 | rm "$_LIBANIME_CACHE/*.adir" 117 | } 118 | } 119 | 120 | # update cache 121 | _anime_update() { 122 | local hasd=0; local hasf=0; 123 | local md5="$(__anime_hash "$@")" 124 | 125 | # remove cache files 126 | [[ -f "$_LIBANIME_CACHE/$md5.afil" ]] && { 127 | rm "$_LIBANIME_CACHE/$md5.afil" 128 | hasf=1 129 | } 130 | [[ -f "$_LIBANIME_CACHE/$md5.adir" ]] && { 131 | rm "$_LIBANIME_CACHE/$md5.adir" 132 | hasd=1 133 | } 134 | 135 | # update database 136 | updatedb -l 0 -o "$_LIBANIME_DB" -U "$_ANIME_ROOT" 137 | 138 | # update cache files 139 | [[ $hasd -eq 1 ]] && 140 | _anime_get_d "$@" &> /dev/null 141 | [[ $hasf -eq 1 ]] && 142 | _anime_get_f "$@" &> /dev/null 143 | } 144 | 145 | # pass main $@ arguments here 146 | _anime_init() { 147 | local sft=0 148 | [[ "$1" == "-r" ]] && 149 | { _ANIME_ROOT="$2"; shift 2; sft=2; } 150 | 151 | [[ -d "$_ANIME_ROOT" ]] || 152 | err "$_ANIME_ROOT: directory does not exist" 153 | 154 | # db is not set 155 | [[ -n "$_LIBANIME_DB" ]] || 156 | err "\$_LIBANIME_DB is not set!" 157 | 158 | # cache is not set 159 | [[ -n "$_LIBANIME_CACHE" ]] || 160 | err "\$_LIBANIME_CACHE is not set!" 161 | 162 | # create cache dir, if it doesn't exist 163 | [[ -d "$_LIBANIME_CACHE" ]] || 164 | mkdir "$_LIBANIME_CACHE" 165 | 166 | # time to set correct variables 167 | _ANIME_SEED="$_ANIME_ROOT/$_ANIME_SEED_DIR" 168 | _ANIME_WATCHING="$_ANIME_ROOT/$_ANIME_WATCHING_DIR" 169 | _ANIME_WATCHED="$_ANIME_ROOT/$_ANIME_WATCHED_DIR" 170 | 171 | # final checks 172 | [[ -d "$_ANIME_SEED" ]] || 173 | err "$_ANIME_SEED: directory does not exist" 174 | [[ -d "$_ANIME_WATCHING" ]] || 175 | err "$_ANIME_WATCHING: directory does not exist" 176 | [[ -d "$_ANIME_WATCHED" ]] || 177 | err "$_ANIME_WATCHED: directory does not exist" 178 | 179 | # update database 180 | updatedb -l 0 -o "$_LIBANIME_DB" -U "$_ANIME_ROOT" 181 | 182 | # shifted arguments 183 | return $sft 184 | } 185 | --------------------------------------------------------------------------------