7 次代码提交 94c6e15e74 ... 98f47a05ab

作者 SHA1 备注 提交日期
  koreymacdougall 98f47a05ab Various updates 3 年之前
  koreymacdougall b4a391be10 Various updates - esp. dircolors 3 年之前
  koreymacdougall 2c14844226 Modified config 3 年之前
  koreymacdougall 765e27ed71 Merge branch 'master' of https://github.com/koreymacdougall/config_files 3 年之前
  koreymacdougall be8334ba19 Various updates; vim markdown remove _ error 3 年之前
  Korey MacDougall c8afc38149 Update clean_zsh_history.py 4 年之前
  koreymacdougall f4d74eac77 Various updates 4 年之前
共有 10 个文件被更改,包括 271 次插入100 次删除
  1. 19 20
      .Xresources
  2. 0 26
      .gitconfig
  3. 1 0
      .gitignore
  4. 18 4
      .tmux.conf
  5. 42 36
      dircolors
  6. 8 4
      dmenu_scripts/display_select.sh
  7. 1 1
      i3/i3_config
  8. 3 2
      mk_sym_links.sh
  9. 179 7
      notes/cheatsheet.md
  10. 0 0
      ranger/rc.conf

+ 19 - 20
.Xresources

@@ -15,23 +15,22 @@ XTerm.vt100.translations: #override \n\
   Ctrl <Key> minus: smaller-vt-font() \n\
   Ctrl <Key> plus: larger-vt-font() \n\
 
-! gruvbox Xresources palette
-*.background: #282828
-*.foreground: #EBDBB2
-*.cursorColor: #d0d0d0
-*.color0: #282828
-*.color1: #ff0090
-*.color2: #66aa11
-*.color3: #c47f2c
-*.color4: #AA0000
-*.color5: #7e40a5
-*.color6: #3579a8
-*.color7: #9999aa
-*.color8: #303030
-*.color9: #ff6666
-*.color10: #80ff00
-*.color11: #ffba68
-*.color12: #fabd2f
-*.color13: #bb88dd
-*.color14: #4eb4fa
-*.color15: #FFFFFF
+! Dracula Xresources palette
+*.foreground: #F8F8F2
+*.background: #282A36
+*.color0:     #000000
+*.color8:     #4D4D4D
+*.color1:     #FF5555
+*.color9:     #FF6E67
+*.color2:     #50FA7B
+*.color10:    #5AF78E
+*.color3:     #F1FA8C
+*.color11:    #F4F99D
+*.color4:     #BD93F9
+*.color12:    #CAA9FA
+*.color5:     #FF79C6
+*.color13:    #FF92D0
+*.color6:     #8BE9FD
+*.color14:    #9AEDFE
+*.color7:     #BFBFBF
+*.color15:    #E6E6E6

+ 0 - 26
.gitconfig

@@ -1,26 +0,0 @@
-[user]
-    email = korey@koreymacdougall.com
-    name = koreymacdougall
-[merge]
-    tool = vimdiff
-[alias]
-    co = checkout
-    br = branch
-    st = status
-    pullom = pull origin master
-    pushom = push origin master
-[diff]
-    tool = vimdiff
-
-# [credential]
-    # set with: git config --global credential.username koreymacdougall
-    # username = kmac
-[github]
-    user = koreymacdougall
-    # token = %<ENV_someting>%
-[web]
-    browser = firefox
-[push]
-    default = simple
-[credential]
-	helper = cache

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
 *.swp
 pman
+.gitconfig

+ 18 - 4
.tmux.conf

@@ -2,20 +2,34 @@
 ##### COLOURS ######
 ####################
 
+BACKGROUND=colour8
+
 # tmux-256 color makes my dir colors work, but breaks the S-Tab sequence I use for UltiSnips...
 # manually setting "export term=xterm-256color" within tmux, before launching
 # vim, fixes this... extremely hackish
 
-# set -g default-terminal "screen-256color"
 set -g default-terminal "xterm-256color"
+# set -g default-terminal "xterm"
+# set -g default-terminal "screen-256color"
+# set -g default-terminal "tmux-256color"
+
+# enable true color support (this took forever to find)
+# https://deductivelabs.com/blog/tech/using-true-color-vim-tmux/
+set-option -ga terminal-overrides ",xterm-256color:Tc"
+
 
 # set a larger scrollback buffer size
 set-option -g history-limit 10000
 
 # default statusbar colors
-set-option -g status-bg colour0
+set-option -g status-bg default  #note the invisible ink, colour15
 set-option -g status-fg yellow
 
+# set window title list colors
+set-window-option -g window-status-style fg=brightblue,bg=$BACKGROUND #note the invisible ink, colour15
+# active window title colors
+set-window-option -g window-status-current-style fg=brightred,bg=$BACKGROUND
+
 # active window colors
 # these are the basic text/background colours,
 # but are only used when multiple panes are open
@@ -23,8 +37,8 @@ set-option -g status-fg yellow
 # set -g window-style "bg=colour8"
 
 # window indicators w/ ctrl-q
-set-window-option -g window-status-fg brightblue
-set-window-option -g window-status-bg colour0
+# set-window-option -g window-status-fg brightblue
+# set-window-option -g window-status-bg colour0
 
 # window indicators w/ ctrl-q when splits
 set-window-option -g window-status-current-fg brightred

+ 42 - 36
dircolors

@@ -1,5 +1,11 @@
 # dircolors specification
 # lifted from: Sebastian Tramp - http://sebastian.tramp.name
+#
+# Note - each field in colors below has various fields separated by semi-colons
+# example:
+# NORMAL 00;38;5;14       
+# 38;5;colorN escape sequence for foreground colors 
+# 48;5;colorN escape sequence for background colors
 
 # Term Section
 TERM Eterm
@@ -89,46 +95,46 @@ TERM tmux-256color
 
 ## Special files
 
-NORMAL 00;38;5;15       # use color 15 (the bright foreground)
-# NORMAL 00;38;5;0       # use color 15 (the bright foreground)
+NORMAL 00;38;5;14       # use color 15 (the bright foreground)
 FILE 00                 # regular file: use no color at all
 RESET 0                 # reset to "normal" color
-DIR 00;38;5;12          # directory
+DIR 00;38;5;4         # directory
 LINK 00;38;5;37         # symbolic link
 EXEC 00;38;5;160        # This is for files with execute permission:
 
 ## Archives or compressed (violet + bold for compression)
-.tar    00;38;5;231
-.tgz    00;38;5;231
-.arj    00;38;5;231
-.taz    00;38;5;231
-.lzh    00;38;5;231
-.lzma   00;38;5;231
-.tlz    00;38;5;231
-.txz    00;38;5;231
-.zip    00;38;5;231
-.z      00;38;5;231
-.Z      00;38;5;231
-.dz     00;38;5;231
-.gz     00;38;5;231
-.lz     00;38;5;231
-.xz     00;38;5;231
-.bz2    00;38;5;231
-.bz     00;38;5;231
-.tbz    00;38;5;231
-.tbz2   00;38;5;231
-.tz     00;38;5;231
-.deb    00;38;5;231
-.rpm    00;38;5;231
-.jar    00;38;5;231
-.rar    00;38;5;231
-.ace    00;38;5;231
-.zoo    00;38;5;231
-.cpio   00;38;5;231
-.7z     00;38;5;231
-.rz     00;38;5;231
-.apk    00;38;5;231
-.gem    00;38;5;231
+#
+.tar    00;38;5;2
+.tgz    00;38;5;2
+.arj    00;38;5;2
+.taz    00;38;5;2
+.lzh    00;38;5;2
+.lzma   00;38;5;2
+.tlz    00;38;5;2
+.txz    00;38;5;2
+.zip    00;38;5;2
+.z      00;38;5;2
+.Z      00;38;5;2
+.dz     00;38;5;2
+.gz     00;38;5;2
+.lz     00;38;5;2
+.xz     00;38;5;2
+.bz2    00;38;5;2
+.bz     00;38;5;2
+.tbz    00;38;5;2
+.tbz2   00;38;5;2
+.tz     00;38;5;2
+.deb    00;38;5;2
+.rpm    00;38;5;2
+.jar    00;38;5;2
+.rar    00;38;5;2
+.ace    00;38;5;2
+.zoo    00;38;5;2
+.cpio   00;38;5;2
+.7z     00;38;5;2
+.rz     00;38;5;2
+.apk    00;38;5;2
+.gem    00;38;5;2
 
 # Image formats (pink)
 .jpg    00;38;5;201
@@ -161,8 +167,8 @@ EXEC 00;38;5;160        # This is for files with execute permission:
 .eps    00;38;5;201
 
 # config files (light gren)
-*rc              38;5;122
-*conf            38;5;122
+*rc              38;5;05
+*conf            38;5;05
 
 # Audio formats (blue)
 .aac    00;38;5;69

+ 8 - 4
dmenu_scripts/display_select.sh

@@ -4,12 +4,16 @@
 
 choices="Laptop\nBenq\nDual"
 
-chosen=$(echo -e "$choices" | dmenu -i)
+
+chosen=$(echo "$choices" | dmenu -i)
+# -e for echo is to recognize new lines, but it was messing up script
+# keeping for posterity / troubleshooting (2021-03-29)
+# chosen=$(echo -e "$choices" | dmenu -i)
 
 case "$chosen" in
-    Laptop) xrandr --output LVDS1 --auto --output VGA1 --off;;
-    Benq) xrandr --output LVDS1 --off --output VGA1 --auto;;
-    Dual) xrandr --output LVDS1 --auto --output VGA1 --auto --right-of LVDS1;;
+    Laptop) xrandr --output eDP1 --auto --output DP1 --off;;
+    Benq) xrandr --output eDP1 --off --output DP1 --auto;;
+    Dual) xrandr --output eDP1 --auto --output DP1 --auto --left-of eDP1;;
 esac
 
 sh ~/.fehbg

+ 1 - 1
i3/i3_config

@@ -205,7 +205,7 @@ bindsym XF86AudioPlay exec --no-startup-id cmus-remote -u
 ########################################
 
 # compton for compositing
-exec --no-startup-id compton --config ~/.config/compton.conf -bc &
+# exec --no-startup-id compton --config ~/.config/compton.conf -bc &
 
 #bindsym $mod+control+t exec --no-startup-id /usr/bin/pulseaudio-ctl down
 

+ 3 - 2
mk_sym_links.sh

@@ -11,8 +11,9 @@ ln -sf ~/config_files/vim/.vimrc ~/.vimrc
 ln -sf ~/.vim/plugged/xmledit/ftplugin/xml.vim ~/.vim/plugged/xmledit/ftplugin/html.vim
 
 #.vim/after symlink
-mkdir -p ~/.vim/after/plugin
-ln -sf ~/config_files/vim/after/plugin/disable_mappings.vim ~/.vim/after/plugin/disable_mappings.vim
+ln -sf ~/config_files/vim/after/ ~/.vim/
+# mkdir -p ~/.vim/after/plugin
+# ln -sf ~/config_files/vim/after/plugin/disable_mappings.vim ~/.vim/after/plugin/disable_mappings.vim
 
 #dracula theme
 ln -sf ~/config_files/vim/dracula.vim  ~/.vim/plugged/vim/colors/dracula.vim

+ 179 - 7
notes/cheatsheet.md

@@ -18,6 +18,46 @@
 - Fixed with 'sudo alsactl init'
     - alsactl -h  / shows commands
     - help screen showed that alsactl init returns driver to a default state
+# AWS
+## Viewing logs from CLI
+- aws logs commands:
+    - combined command, to get most recent log stream for a log group:
+        -  aws logs describe-log-streams --log-group-name /aws/lambda/{fn name} --query 'logStreams[*].logStreamName' --max-items 1 --order-by LastEventTime --descending |  awk -F'"' '$0=$2' | xargs aws logs get-log-events --log-group-name /aws/lambda/{fn_name } --log-stream-name | jq
+    - breakdown:
+        - specify log group name based on fn name
+        - query for 1 item, sorted by most recent
+        - take val between two ""
+        - pass name to xargs to get-log-events
+        - jq to format json
+
+    - commands:
+        - describe-log-groups
+        - describe-log-streams --{log group name}
+        - get-log-events --{log group name} -{log stream name}
+## Run/invoke lambda function from CLI
+- aws lambda invoke --invocation-type RequestResponse --function-name {fn_name} --region ca-central-1 --cli-binary-format raw-in-base64-out --payload fileb:///code/{fn_name}/payload.json response.json
+- NOTE: running through a docker container will fail silently on AWS side; hash returned
+  is just the docker id
+## deleting s3 buckets that have had improper policies attached to them
+- need to use use the aws cli to run 's3api delete-bucket-policy --bucket {bucket name}'
+    - can't use aws console, also can't delete bucket before deleting policy
+- need to use access keys of root account
+    - log in as root acct, generate new pair of access/secret access keys, use it to configure
+      aws-cli in docker, delete key pair, re-config the image to use iam user
+      creds,
+    - see steps below to configure/run docker aws-cli
+- adapting example below, command will be:
+    - (first run config with root creds)
+    - docker run --rm -v $HOME/.aws:/root/.aws amazon/aws-cli s3api delete-bucket-policy --bucket {bucket name}
+## uploading cors configurations
+    - the xml syntax appears to be deprecated?  Though I didn't see this
+      mentioned anywhere.
+    - using the cli put-bucket-cors command solved the issue
+    - sudo docker run --rm -tiv $HOME/.aws:/root/.aws amazon/aws-cli s3api put-bucket-cors --bucket {bucket name} --cors-configuration file:///root/.aws/{config file name}.json
+        - note the triple slash after file
+        - I think 'file://' is needed to indicate a fileread, rather than
+          reading a string from stdin
+
 # CALCURSE
 ## to move date of appt:
     -specify date as month/day (e.g., 1/1 for jan 1)
@@ -28,6 +68,8 @@
 ## remove cached metadata (e.g., after running id3convert -s **/*)
     - :update-cache
     - can use -f flag if not co-operating
+## repeat current song
+    - ^C
 # DJANGO
 ## commands
 ### create a new project
@@ -127,6 +169,17 @@
     * for full system/world update: 
         * sudo emerge --update --changed-use --deep --ask --with-bdeps=y @world
 # GIT
+## delete files from history (specifically large files)
+### using bfg - recommended for removing large files
+- https://rtyley.github.io/bfg-repo-cleaner/
+    - download file
+-  java -jar ~/source_packages/bfg-1.13.1.jar --strip-blobs-bigger-than 40M repo_name.git
+### using filter-brach
+git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch unwanted_file_or_dir' --prune-empty
+
+## view files on a different branch without switching branches
+git show branch:filepath/filename
+    - e.g., git show master:README.md
 ## to sync a forked, local repo, can use the rebase command, which will avoid the ugly merge commit added when doing a normal pull.
     - git pull --rebase <remote name> <branch name>
 ## rename a local branch
@@ -145,16 +198,67 @@
     - git merge --abort
 ## use vimdiff for git difftool
     - git config diff.tool vimdiff
+    - also: Gdiffsplit (from fugitive)
+    - once split, :diffget and :diffput make editing a diff really easy
+## grep / search history of files (source code)
+git grep {regex to search} $(git rev-list --all)
+# GPG
+## reset gpg-connect-agent / when borking pw entry 
+    - echo RELOADAGENT | gpg-connect-agent
 # Javascript
 ## Run Prettier for code formatting, w/in vim
     - :Prettier
+# Jupyter and jupyterlab
+## autoreload modules:
+    - %load_ext autoreload
+    - %autoreload 2
+
+    - the first command 'loads extension' autoreload, which is disabled by default
+    - '2' means reload everything; 0 means nothing; 1 is only for modules loaded via %aimport
+    - see: https://switowski.com/blog/ipython-autoreload
+## install vim keybindings:
+    - jupyter labextension install @axlair/jupyterlab_vim
+    - using this specific repo/version because the newest (2020-09-30) version
+      of jupyterlab doesn't support newest version of the extension
+        - see: https://github.com/jwkvam/jupyterlab-vim/issues/118
+## matplotlib integration
+pip install ipympl
+pip install nodejs
+jupyter labextension install @jupyter-widgets/jupyterlab-manager
+jupyter labextension install jupyter-matplotlib
+
 # LaTeX
     - cancel a compilation: 
         - x <enter>
 
+# LibreOffice
+- Fix fonts and icons, when installing on debian based system, by installing libreoffice-gtk3
+    - This helped a great deal with an i3-based install, anyway
+
 # LINUX
+## toggle between ttys (e.g., between term and xorg):
+    - ctrl+atl+{f1-f7}
+    - OR  alt+left or alt+right
+        - this latter works to get back to a running xorg session
+## installing with dpkg when dependencies missing
+- if running 'sudo dpkg -i {filename}.deb' and hitting a missing dependency
+  error, do the following to use 'fix-missing' functionality:
+    - # apt-get update --fix-missing
+    - sudo apt-get update -f
+        - long-form (apt-get update --fix-broken)
+## customize desktop and icons (themes)
+- lxappearance is an easy gui tool
+## determine file type in terminal
+file -i {filename}
 ## set default web browser (particularly in Debian sytems)
     - xdg-settings set default-web-browser firefox-esr.desktop
+## set default applications
+- xdg-mime --help
+    - not optimal??
+- to set default file manager:
+    - edit ~/.config/mimeapps.list
+- NOTE: firefox cannot launch an external application like thunar/nautilus if
+  it's running under firejail    
 ## crontab and mysqldump gotcha - escaping percent sign
     - \% for dates and such
 ## printing  (CUPS - common unix print system)
@@ -241,7 +345,8 @@
 
     - check dmesg logs for messages
     - remove/re-add kernel module - # rmmod brcmfmac & # modprobe brcmfmac
-
+## add user to group (e.g., sudo group)
+    - usermod -aG sudo km
 # METADATA
 ## mp3 files
   - strip with id3lib
@@ -255,6 +360,9 @@
   4.  W clears flag (w sets)
   5.  enter flag to clear (here, O)
 
+  example: inbox full of read messages, just want to archive:
+  commands: T ~O ; W O
+
   - taken from 
     -  https://brianbuccola.com/how-to-mark-all-emails-as-read-in-mutt/
 ## cancel prompt
@@ -544,6 +652,9 @@
 - multiple fixes on SO
 - my fix - move or delete Gemfile.lock 
 # SHELL / UNIX
+## Get name of current dir, with just basename:
+    - PWD##*/
+    - in command, e.g., echo ${PWD##*/}
 ## paste args from previous command
     - esc + .  (zsh in viins)
     - alt + .  (emacs binding)
@@ -576,6 +687,8 @@
     - ^Z        - suspend process
     - bg        - continue running process in background
     - fg        - foreground process
+        - e.g., if accidentally press ^Z, can resume with 'fg %', as
+          % represents last suspended job
     - jobs      - list all jobs
 
     - reptyr - utility to reparent a process
@@ -631,6 +744,9 @@
 ## list files in a tarball
     - -t
 # TMUX
+## to get true color support working
+- tmux set-option -ga terminal-overrides ",xterm-256color:Tc"
+    - detach then reattach
 ## make selected pane full screen temporarily
     - leader-z  (for zoom)
 ## renumber windows
@@ -716,6 +832,16 @@ prefix M-5  = tile, new panes on bottom, same height before same width
         - migrate will run compile first (saving a step)
         - after running this, may need to restart console session
 # VIM
+## view where a binding came from - :map
+- :nmap {command of interest}
+- :imap
+- etc
+## copy to system clipboard
+- ensure :echo has('clipboard') returns 1
+    - can do this with vim-gtk3
+- use "+yG  (for example) to yank into + register
+- can paste normally from there
+
 ## sessions  - save and restore:
         - save: mksession ~/session.vim 
         - reload: ~/session.vim
@@ -828,6 +954,15 @@ prefix M-5  = tile, new panes on bottom, same height before same width
     - vim -u NONE    #don't load vimrc or plugins
     - vim -u NORC    #load plugins but not vimrc
 
+## view hex/binary files:
+
+    - vi your_filename
+
+    - esc
+
+    - :%!xxd - to view the hex strings
+        - then :%!xxd -r to return to normal editing.
+
 # Vim Vixen (Firefox add-on)
     - open new tab in background:
         - modify plain json in settings, for "F", to include:
@@ -837,16 +972,53 @@ prefix M-5  = tile, new panes on bottom, same height before same width
     - install webp package
     - dwebp file.webp -o file.png
 # Wordpress
-    - DIVI - uploading will initially fail, show an error message "Link you
-      requested is no longer valid"
-        - this is a limit on upload size and execution time
-        - fix by modifying wordpress file, wp-config.php, and then
-          (importantly), restarting php-fpm.service (at least on aws ec2 amazon
-          linux 2 ami)
+## DIVI 
+- uploading will initially fail, show an error message "Link you
+  requested is no longer valid"
+    - this is a limit on upload size and execution time
+    - fix by modifying wordpress file, wp-config.php, and then
+      (importantly), restarting php-fpm.service (at least on aws ec2 amazon
+      linux 2 ami)
+
+- hide header
+   - in Divi -> Theme Options -> CSS (not quite this path, but close) 
+        - note - remove the dashes before the hashes
+    - #main-header { 
+     display: none; 
+    }
+
+    - #page-container {
+     padding-top: 0px !important;
+     margin-top: -1px !important;
+    }
+## Bitnami on AWS
+
+- total time to restore from a backup - 20 mins (!!)
+- spin up instance (takes a few minutes to launch)
+    - when first connecting, may need to correct host identified in ssh/known_hosts (if re-using elasticIP)
+- attach elastic IP to VM/instance
+- point DNS to elasticIP
+- ssh into bitnami instance, generate cert
+    - sudo /opt/bitnami/bncert-tool
+    - quite handy, as it auto-configures apache settings for ssl certs w/
+      LetsEncrypt, configures servername, sets up renewal cronjob, and sets up
+      http->https redirects)
+- install plugin UpdraftPlus
+    - import backup files (5 of them, db, uploads, etc)
+    - run backup
+    - this will change username and pw to what was set in db (i.e, main creds)
+
+
+
 # X11
     - xprop - get window manager class name
+# XPS 13
+- intel firmware for wifi card:
+    - firmware-iwlwifi_20190114-2_all.deb
+- download from non-free debian archive, install with 'dpkg -i {fname}'
 # XTERM
 ## resize font temporarily
     - ctrl right-click
 
 
+

+ 0 - 0
ranger/rc.conf


部分文件因为文件数量过多而无法显示