Skip to content

Instantly share code, notes, and snippets.

View joshuamschultz's full-sized avatar

Joshua joshuamschultz

View GitHub Profile
@joshuamschultz
joshuamschultz / extract-year-from-date.py
Created January 6, 2021 18:21
Extract Month or Year from a date
df['year'] = pd.DatetimeIndex(df['date']).year
pip install --upgrade git+https://github.com/@username/@repo.git
@joshuamschultz
joshuamschultz / Kill Port Bind
Created November 27, 2018 00:53
Use to find what is binding to a port and kill it
lsof -wni tcp:3000
kill -9 [PID]
@joshuamschultz
joshuamschultz / fix new user ssh for ubuntu.md
Last active November 6, 2018 01:03
Fixing Permission Denied when SSH to a new user on Ubuntu
  1. adduser username
  2. usermod -aG sudo username
  3. edit /etc/ssh/sshd_config by setting PubkeyAuthentication yes
  4. cd /home/username
  5. mkdir .ssh
  6. sudo chown yourusername:yourusername /home/username/ -R
  7. sudo chmod 700 /home/username/ -R
  8. on local ssh-copy-id -i identifyfile username@ip
  9. try ssh username@ip, if it fails continue
  10. on local cat .ssh/id_rsa.pub

Keybase proof

I hereby claim:

  • I am joshuamschultz on github.
  • I am joshuamschultz (https://keybase.io/joshuamschultz) on keybase.
  • I have a public key ASDId5Yy4Tk9eGSOnvnd5lQ3Ka4DrE-Gv2aHvroeADwLBAo

To claim this, I am signing this object:

Find out the process ID (PID) which is occupying the port number (e.g., 5955) you would like to free
sudo lsof -i :5955
Kill the process which is currently using the port using its PID
sudo kill -9 PID
brew unlink imagemagick
brew install imagemagick@6 && brew link imagemagick@6 --force
for b in `git branch -r | grep -v -- '->'`; do git branch --track ${b##origin/} $b; done
git fetch --all
@joshuamschultz
joshuamschultz / pg_hba.conf for GUI access
Last active May 27, 2017 21:39
In order to allow pg gui to access database. First line must be:
## pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
host all all 0.0.0.0/0 md5
## postgresql.conf
listen_addresses = '*'