Skip to content

Instantly share code, notes, and snippets.

View midwire's full-sized avatar
🏠
Working from home

Chris Blackburn midwire

🏠
Working from home
View GitHub Profile
@midwire
midwire / fixit.sh
Last active April 4, 2022 16:42
[Fix Slack not loading on Linux] #linux #slack
# Remove slack settings directory
rm -rf ~/.config/Slack/
@midwire
midwire / helpers.rb
Created March 12, 2022 16:34
[Access Rails URL helpers outside of views and controllers] #rails
Rails.application.routes.url_helpers.whatever_path
Rails.application.routes.url_helpers.whatever_url(model.id)
@midwire
midwire / tunnel.sh
Created March 10, 2022 20:00
[SSL Tunnels] #ssl
echo "Access jenkins on https://localhost:8888"
#
ssh -L 8888:10.19.112.198:443 host-to-login-to
@midwire
midwire / as_delete.rb
Created March 9, 2022 18:10
Delete ActiveStorage File #rails #active_storage
file = ActiveStorage::Attachment.find(params[:id])
file.purge
@midwire
midwire / stream.sh
Created February 26, 2022 21:30
[raspberry pi streaming video] How to stream video from a raspberry pi with camera #raspberrypi #pi
# On the Pi:
libcamera-vid -t 0 --inline --listen -o tcp://0.0.0.0:8888
# From a client, like VNC - open a network stream
# ... replace raspberrypi.local with your PI's IP address.
tcp/h264://raspberrypi.local:8888
@midwire
midwire / local-tunnel.sh
Created January 4, 2022 15:51
[Local Tunnel] Expose your local web server, or service to the internet #tunnel #linux
npm install -g localtunnel
\lt --local-host 0.0.0.0 --port 3000 --subdomain ajla-ts
# Using these pry gems -- copy to your Gemfile
# group :development, :test do
# gem 'awesome_print' # pretty print ruby objects
# gem 'pry' # Console with powerful introspection capabilities
# gem 'pry-byebug' # Integrates pry with byebug
# gem 'pry-doc' # Provide MRI Core documentation
# gem 'pry-rails' # Causes rails console to open pry. `DISABLE_PRY_RAILS=1 rails c` can still open with IRB
# gem 'pry-rescue' # Start a pry session whenever something goes wrong.
# gem 'pry-theme' # An easy way to customize Pry colors via theme files
# end
@midwire
midwire / fstab.sh
Created November 27, 2021 05:23
[Mount Samba/SMB drive from Linux] #linux #samba #smb
# /home/user/.smbpasswd
username=my_username
password=my_password
domain=172.1.1.1
# /etc/fstab
//172.1.1.1/Media /mnt/nas_media cifs user,uid=1000,gid=1000,rw,suid,vers=2.0,credentials=/home/user/.smbpasswd 0 0
@midwire
midwire / speedtest.sh
Created November 26, 2021 16:17
[Determine network speed between 2 hosts] #linux #networking
yes | pv | ssh router.foo.com "cat > /dev/null"
@midwire
midwire / restart.sh
Created September 22, 2021 19:57
[Curl - restart file downloads]
# Start normal download
curl -L -O your_url
# Restart interrupted download
curl -L -O -C - your_url