Skip to content

Instantly share code, notes, and snippets.

View emailrhoads's full-sized avatar

John Rhoads emailrhoads

View GitHub Profile
@emailrhoads
emailrhoads / ignore_only_locally.md
Last active April 17, 2020 15:01
[Ignore locally only] #git

Insted of using .gitignore add files to .git/info/exclude

code .git/info/exclude

If you already have files that are changed you'll need to set them as unchanged

git update-index --assume-unchanged .gitmodules
@emailrhoads
emailrhoads / setup_steps
Last active April 8, 2020 16:46
[Setup VirtualBox] #virtualbox
1. Add Storage
2. Display is VBOXSVGA @ 90MB
3. Add Network adapter 2 as HostOnly, promiscuous deny
4. Mount shared folder/drive in settings (may need to do some terminal commands to automount here)
5. Add self to sudo and root group `sudo adduser john sudo` and `sudo usermod -a -G root john`
6. Install posgres and also `sudo apt-get install libpq-dev`
7. Install RBENV, and reshash it
8.
@emailrhoads
emailrhoads / connect_vs_code_remote.md
Created April 8, 2020 14:49
[Connect VS Code Remote to Virtualbox] #virtualbox

On VM run

sudo apt-get install openssh-server openssh-client
ifconfig
@emailrhoads
emailrhoads / hash_to_csv_to_pg.md
Last active March 30, 2020 21:28
[Load Ruby Hash to CSV into Postgres] #postgres

Hash to CSV

my_json = JSON.parse(File.open("ss_to_census_100k_all_unique_results.json").read);
csv_string = CSV.generate(headers: true) do |csv|
  csv << my_json.first.keys
  my_json.each do |hash|
    csv << hash.values
  end
end;
@emailrhoads
emailrhoads / pulll_current_branch.sh
Created March 30, 2020 15:24
[Only pull current branch] #git
git pull origin $(git rev-parse --abbrev-ref HEAD)
@emailrhoads
emailrhoads / find_code_deploy_logs.md
Last active March 27, 2020 21:48
[Find code deploy logs] #aws

Navigate into CodeDeploy in AWS Console

in codedeploy you can see failed deployments and if you click that it shows the instance that fialed

Cd into the log dir on the instance

/opt/codedeploy-agent/deployment-root/07d22c05-8cb4-496c-bc7f-7a5b79efb167

@emailrhoads
emailrhoads / resotre_deleted_file.md
Last active March 25, 2020 14:59
[Restore deleted file] #git

get all the commits which have deleted files and the files deleted; git log --diff-filter=D --summary

to restore the deleted file. git checkout $commit~1 path/to/file.ext

where $commit is the value of the commit you've found at step 1, e.g. e4cf499627

@emailrhoads
emailrhoads / scp_from_ec2_to_local.sh
Last active June 14, 2022 16:36
[Copy file from EC2 to local] #aws
# scp <user>@<ec2-ip>:<path/to/file/to/download.txt> <filepath/on/local.txt>
scp [email protected]:~/new_results.txt new_results.txt
scp [email protected]:/var/luna/user_data.tsv user_data.tsv
# to send to the EC2
scp new_results.txt [email protected]:~/new_results.txt
scp [email protected]:/var/crape/BulkLoans.20211001_20220124_results.tsv BulkLoans.20211001_20220124_results.tsv
@emailrhoads
emailrhoads / fix_vscode_flock.md
Created March 13, 2020 13:51
[Fix repeated password prompts on vscode] #vscode #linux

from microsoft/vscode-remote-release#2518

look for line similar to

 \ln /home/#####/.vscode-server/bin/78a4c91400152c0f27ba4d363eb56d2835f9903a/vscode-remote-lock.#####.78a4c91400152c0f27ba4d363eb56d2835f9903a.target /home/#####/.vscode-server/bin/78a4c91400152c0f27ba4d363eb56d2835f9903a/vscode-remote-lock.#####.78a4c91400152c0f27ba4d363eb56d2835f9903a
[13:55:17.276] stderr> ln: failed to create hard link ‘/home/#####/.vscode-server/bin/78a4c91400152c0f27ba4d363eb56d2835f9903a/vscode-remote-lock.#####.78a4c91400152c0f27ba4d363eb56d2835f9903a’: File exists
[13:55:17.276] > Installation already in progress...

Then go delete the .target file

@emailrhoads
emailrhoads / squash_feature.sh
Created March 12, 2020 15:47
[Squash all commits on current feature branch] #git
git checkout feature_branch
git reset --soft master
git add -A && git commit -m "commit message goes here"