Skip to content

Instantly share code, notes, and snippets.

View bibstha's full-sized avatar
💭
🇳🇵🇨🇦

Bibek Shrestha bibstha

💭
🇳🇵🇨🇦
  • Vancouver, Canada
  • 21:06 (UTC -08:00)
View GitHub Profile
@bibstha
bibstha / django_for_rails_developers.md
Created November 7, 2024 07:32
Django for Rails Developers

Learning Django for Rails Developmers

I used ChatGPT to create this book to quickly get started understanding Django coming from a Rails background.

You:

I’m writing a book titled “Using Django for People familiar with Ruby on Rails” it’s focussed on programmers already familiar with Python and preciously familiar with Ruby on Rails. This to help them get up to speed with Django development fast

ChatGPT:

@bibstha
bibstha / pre-deploy
Created July 2, 2024 04:37
Kamal pre-deploy hook to run database migrations. File path .kamal/hooks/pre-deploy
#!/usr/bin/env ruby
# These environment variables are available:
# KAMAL_RECORDED_AT
# KAMAL_PERFORMER
# KAMAL_VERSION
# KAMAL_HOSTS
# KAMAL_COMMAND
# KAMAL_SUBCOMMAND
# KAMAL_ROLE (if set)
@bibstha
bibstha / Dockerfile
Created June 27, 2024 08:24
Ruby Jupyter Notebook with persistent gems folder and jupyter token
FROM rubydata/datascience-notebook
RUN rm /home/jovyan/.gemrc
@bibstha
bibstha / docker_command.sh
Last active June 1, 2024 09:27
Letsencrypt, Certbot, Cloudflare and Twilio link shortening cert upload script.
# Update: Use this repo instead https://github.com/bibstha/twilio-certbot-autoupdater/
#
# Make sure you create an api token to be used to auto add temporary TXT entries to your
# cloudflare DNS using certbot automatically.
# in Cloudflare: My Profile > API Tokens > Create Token
# Permission required: domain-name - DNS:Edit
# Copy token and replace the XXXX below
echo "dns_cloudflare_api_token = XXXXXX" > /tmp/cloudflare.ini
# This folder is where certbot downloads files. We will mount it to the certbot docker container later.
@bibstha
bibstha / init.vim
Last active August 16, 2023 21:13
Minimal neovim config for use with VSCode
" VimPlug for plugin management
" Treesitter + VimMatchup improves start-end matching significantly
call plug#begin()
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'andymass/vim-matchup'
call plug#end()
lua <<EOF
@bibstha
bibstha / gist:97e7922fa6ee650d4adc2981ea0c00a9
Last active February 25, 2023 04:32
Compiling rubyfmt in M1 mac
# if you haven't cloned rubyfmt yet
git clone [email protected]:fables-tales/rubyfmt.git
cd rubyfmt
# update ruby submodule if previously checked in
cd librubyfmt/ruby_checkout/
git reset --hard HEAD
cd ..
git submodule update
# now build ruby
cd ruby_checkout
@bibstha
bibstha / speed_test.sh
Created October 28, 2022 13:14
Speed test
wget -O /dev/null -q --show-progress http://speedtest.newark.linode.com/100MB-newark.bin
@bibstha
bibstha / vimtest_docker_composer.sh
Last active July 19, 2022 11:35
Run rails test inside docker container using vimtest
let g:test#ruby#rails#executable = 'docker compose run -ti --rm backend-test rails test'
# Replace backend-test with the name of the service.
You wouldn't want to run it in the main service because it ends up using the resetting development database.
@bibstha
bibstha / readme.md
Created July 15, 2022 22:25
Vim command to play keystrokes on each matching line

Given

a1, b1, c1, d1, e1 
a2, b2, c2, d2, e2

I could do :g/,/normal 2nd$ to delete everything from second , onwards to give sth like

@bibstha
bibstha / cmd.sh
Created May 31, 2021 15:39
negative lookahead with silversearcher ag on file pattern
# find sorbet strictly typed files that are not tests and also instantiate instance variables
ag '@.+=.+' $(ag -G '.*/?!.*(test)/somepath/.*.rb' 'typed: strict' -l)