Skip to content

Instantly share code, notes, and snippets.

View bitliner's full-sized avatar

Giovanni Gaglione bitliner

View GitHub Profile

Homebrew: How to Backup & Restore Homebrew Packages

Homebrew makes it easy to install and keep installed software up to date on your Mac - as part of my backup routine for my Mac I want to be able to run a single command to reinstall all packages.

If you're searching on how to backup & restore Homebrew, then I assume you're here for the commands.

Brewfiles

Brewfiles are files generated with definitions that Homebrew reads and processes, a generated

python

pandas

Link


pytest

pandas

merge two dataframe

Append the columns of df2 to df1

df1.join(df2)

Docker

List all containers

docker container ls -a

Find the volume of a docker container

docker inspect

Audio

Detect number of channels from an audio file

brew install mediainfo

mediainfo file-path

curl

Http post with JSON body

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"username":"xyz"}' \
  http://localhost:3000/api/login

Kubernetes

Get IP of a pod

  • kubectl get pods - get the name of a deployment or pod
  • kubectl exec --stdin --tty <POD_NAME> -- /bin/bash - ssh into the pod
  • wget ifconfig.me - get external ip
  • whois IP - get info about the ip
@bitliner
bitliner / git.md
Last active October 15, 2020 16:46

Git

Commit

  • Empty commit git commit --allow-empty -m 'fake commit to push'

Git stash

  • git stash
  • git stash pop - apply last stashed patch
@bitliner
bitliner / web-servers.md
Created January 18, 2020 11:01 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000

Get Linux version

lsb_release -a