Skip to content

Commit

Permalink
Dump a ton of shit
Browse files Browse the repository at this point in the history
  • Loading branch information
yaahc committed Feb 23, 2018
1 parent cc736ed commit 91c72f8
Show file tree
Hide file tree
Showing 19 changed files with 573 additions and 446 deletions.
27 changes: 27 additions & 0 deletions Scripts/fenagle_filenames.py
@@ -0,0 +1,27 @@
#! /usr/bin/env python2
SOURCE_DIR = "$HOME/git/scale-product/"

# import glob
# import os.path

# for filename in glob.iglob(os.path.join(SOURCE_DIR, '/**/*.c'), recursive=True):
# print(filename)

import sys
import os.path

# sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
sys.stdin = os.fdopen(sys.stdin.fileno(), 'r', 200)

translation_map = {}

for fname in sys.argv:
basename = os.path.basename(fname)
translation_map[basename] = fname

for line in sys.stdin:
for key in translation_map.keys():
if key in line:
line = line.replace(key, translation_map[key])
print line,
sys.stdout.flush()
6 changes: 6 additions & 0 deletions Scripts/fscmake
@@ -0,0 +1,6 @@
#! /bin/bash

sc_build_root="$HOME/.scalerc"
. $sc_build_root
scmake $@ # | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"
# cat $HOME/Scripts/lastbuild | sed -r "s/^\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"
99 changes: 99 additions & 0 deletions Scripts/rscmake
@@ -0,0 +1,99 @@
#! /bin/bash

sc_build_root="$HOME/.scalerc"

# translates buildvm paths to local paths. Correct _most_ of the time, but
# occasionally fooled.
#tee /tmp/lastbuild;

# I'm gonna try just symlinking /local/scale-product and see how that goes
# function convertToPwd {
# local THEPWD="$HOME/git/scale-product"
# { cat <(cd "$THEPWD" && find "." | egrep '(cpp|h)$') \
# <(echo SWITCHOVER);
# tee /dev/null;
# } | tee /tmp/lastbuild | gawk '
# BEGIN { sw=0; FS="/"; }
# /SWITCHOVER/ {sw=1; FS=":"; printf("switchover\n");}
# sw == 0 { m[$NF] = $0; }

# sw == 1 { printed = 0 }
# /:[0-9]+:/ && sw == 1 {

# tmp=$0;
# if (match($1, /\/([^\/]+)$/, r) != 0) $1 = r[1];

# for (i in m) {
# if ($0 ~ i) {
# sub(i, m[i], tmp);
# print tmp;
# printed = 1;
# }
# }
# }
# sw == 1 && printed == 0 {
# print $0;
# }
# '
# }

function convertToPwd {
local THEPWD="$HOME/git/scale-product"
{ cat <(cd "$THEPWD" && find "$THEPWD" | egrep '(cpp|h)$') \
<(echo SWITCHOVER);
tee /dev/null;
} | tee /tmp/lastbuild | gawk '
BEGIN { sw=0; FS="/"; }
/SWITCHOVER/ {sw=1; FS=":"; printf("switchover\n");}
sw == 0 { m[$NF] = $0; }
sw == 1 { printed = 0 }
/:[0-9]+:/ && sw == 1 {
tmp=$0;
if (match($1, /\/([^\/]+)$/, r) != 0) $1 = r[1];
gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]/, "", $1)
if ($1 in m) {
# print $tmp
# print $1
# print m[$1]
rgx="^[^:]*"$1
sub(rgx, m[$1], tmp);
print tmp;
} else {
print $0;
}
printed = 1;
}
sw == 1 && printed == 0 {
print $0;
}
'
}


cd ~/git/scale-product
LAST_FILE=""
echo $(git ls-files --exclude-standard --others --modified)
for file in $(git ls-files --exclude-standard --others --modified); do
if [ "x$LAST_FILE" = "x" ]; then
LAST_FILE=$(dirname $file)
else
echo $LAST_FILE
echo $file
LAST_FILE=$(printf "%s\n%s\n" "$LAST_FILE" "$file" | sed -e 'N;s/^\(.*\).*\n\1.*$/\1/')
fi
done

echo $LAST_FILE
FILES=$(rg --color=never -g "*.h" -g "*.cpp" --files ~/git/scale-product)

if [ ! -f $LAST_FILE ]; then
if [ ! -d $LAST_FILE ]; then
LAST_FILE=$(dirname $LAST_FILE)
fi
cd $LAST_FILE
fi
if [ -f $sc_build_root ]; then
# $HOME/Scripts/fscmake $@ | $HOME/Scripts/fenagle_filenames.py $FILES
$HOME/Scripts/fscmake $@ | convertToPwd
fi

2 changes: 1 addition & 1 deletion aliasrc
Expand Up @@ -6,7 +6,7 @@ fi

if [ -x /usr/bin/dircolors ]; then
# GNU cli color config
if test -r ~/.dircolors; then eval "$(dircolors -b ~/.dircolors)"; else eval "$(dircolors -b)"; fi
# if test -r ~/.dircolors; then eval "$(dircolors -b ~/.dircolors)"; else eval "$(dircolors -b)"; fi
alias ls='ls --color=auto --group-directories-first'
alias dir='dir --color=auto'
alias grep='grep --color=auto'
Expand Down
16 changes: 9 additions & 7 deletions bash_profile
@@ -1,10 +1,12 @@
# echo "Sourcing .bash_profile"
# .bash_profile

# . "$HOME/.profile"

if [ -n "$BASH_VERSION" ] && [ -f $HOME/.bashrc ];then
source $HOME/.bashrc
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# echo "Attaching screen"
# screen -dRR
# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH
110 changes: 13 additions & 97 deletions bashrc
@@ -1,108 +1,24 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# .bashrc

# echo "Sourcing .bashrc"

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
export HISTCONTROL=ignoreboth:erasedups

# append to the history file, don't overwrite it
shopt -s histappend
set completion-ignore-case on

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTFILESIZE=10000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

# if [ "$color_prompt" = yes ]; then
# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# else
# PS1='\W >>'
# fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
# case "$TERM" in
# xterm*|rxvt*)
# echo "3"
# PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
# ;;
# *)
# ;;
# esac

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
if [ -f $HOME/.shellrc ]; then
. $HOME/.shellrc
fi

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
. /etc/bashrc
fi
PROMPT_COMMAND=""

[ -f ~/.fzf.bash ] && source ~/.fzf.bash

if [ -f ~/.aliasrc ]; then
. ~/.aliasrc
if [ -f `which powerline-daemon` ]; then
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. /usr/share/powerline/bash/powerline.sh
fi

__fzf_editor__() {
local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | cut -b3-"}"
eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" fzf -m "$@" | while read -r item; do
printf '%q %q' "$VISUAL" "$item"
done
}
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# CTRL-P - open selected file with configured editor
if [[ ! -o vi ]]; then
bind '"\C-p": " \C-e\C-u`__fzf_editor__`\e\C-e\er\C-m"'
else
bind '"\C-p": "\C-x\C-addi`__fzf_editor__`\C-x\C-e\C-x\C-r\C-m"'
bind -m vi-command '"\C-p": "ddi`__fzf_editor__`\C-x\C-e\C-x\C-r\C-m"'
fi
# User specific aliases and functions

. "$HOME/.scalerc"
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
6 changes: 4 additions & 2 deletions configure_dotfiles
Expand Up @@ -47,8 +47,6 @@ linkfile gitconfig
linkfile git_template
linkfile gitignore_global

git submodule update --init --recursive

# linkfile profile
linkfile shellrc
linkfile zprofile
Expand All @@ -75,13 +73,17 @@ linkfile weechat .config/weechat
linkfile pianobar .config/pianobar
linkfile Scripts Scripts
linkfile tmux.conf
linkfile ctags


echo "Update package installation? [y/N]"
read resp
if [ "$resp" = "Y" ] || [ "$resp" = "y" ]; then
git submodule update --init --recursive
. $MY_DIR/install-packages.sh
else
echo "Skipping install-packages.sh"
fi

exit 0

6 changes: 6 additions & 0 deletions ctags
Expand Up @@ -12,3 +12,9 @@
--regex-nesC=/^[ \t]*task[ \t]*([a-zA-Z0-9_]+)[ \t]+([a-zA-Z0-9_]+)[ \t]*\(/\1 \2/t,task/
--regex-nesC=/^[ \t]*result_t[ \t]+([a-zA-Z0-9_]+)[ \t]*\(/result_t \1/r,result/
--regex-nesC=/^[ \t]*uses[ \t]+interface[ \t]+[a-zA-Z0-9_]+[a-zA-Z0-9 \t]+as[ \t]+([a-zA-Z0-9_]+)/\1/u,uses/
--langdef=thrift
--langmap=thrift:.thrift
--regex-thrift=/^[ \t]*struct[ \t]*([a-zA-Z0-9_]+)/\1/c,classes/
--regex-thrift=/^[ \t]*enum[ \t]*([a-zA-Z0-9_]+)/\1/T,types/
--regex-thrift=/^[ \t]*[a-zA-Z0-9_<>\.]+[ \t]*([a-zA-Z0-9_]+)\(/\1/m,methods/
--regex-thrift=/^[ \t]*([A-Z0-9_]+)[ \t]*=/\1/C,constants/
4 changes: 2 additions & 2 deletions gitconfig
Expand Up @@ -5,7 +5,7 @@
excludesfile = /home/jlusby/.gitignore_global
editor = vim
[merge]
tool = vimdiff
tool = meld
[color]
ui = true
[alias]
Expand All @@ -21,4 +21,4 @@
[init]
templatedir = ~/.git_template
[push]
default = simple
default = matching
1 change: 1 addition & 0 deletions gitignore_global
Expand Up @@ -50,3 +50,4 @@ core.*
*.executed
*.make.txt
tags
update_buildvm.sh

0 comments on commit 91c72f8

Please sign in to comment.