Skip to content

Instantly share code, notes, and snippets.

View ashgkwd's full-sized avatar
💎
Open to work

Ash Gaikwad ashgkwd

💎
Open to work
View GitHub Profile
@ashgkwd
ashgkwd / launch.json
Created May 6, 2024 03:12
VS Code launch.json for Rails app debugging with ruby_lsp
{
"version": "0.2.0",
"configurations": [
{
"type": "ruby_lsp",
"name": "Rails",
"request": "launch",
"program": "${workspaceRoot}/bin/rails s",
"env": {
"RAILS_ENV": "development"
@ashgkwd
ashgkwd / settings.json
Created May 1, 2024 00:58
Making VS Code task bar red in color without affecting the current theme
{
"workbench.colorTheme": "Spinel",
"workbench.colorCustomizations": {
"[Spinel]": {
"statusBar.background": "#CC0000",
"statusBar.noFolderBackground": "#CC0000",
"statusBar.debuggingBackground": "#CC0000"
}
}
}
@ashgkwd
ashgkwd / serve.sh
Created April 28, 2024 00:30
Serve current folder on HTTP
ruby -run -e httpd . -p 8080
@ashgkwd
ashgkwd / sample_code_to_diagram.py
Created April 26, 2024 19:31
Code to diagram to be pasted in a Jupyter Notebook
from diagrams import Diagram, Cluster
from diagrams.aws.compute import EC2
from diagrams.aws.database import RDS
from diagrams.aws.network import ELB
from diagrams.onprem.inmemory import Redis
with Diagram("Web Service", show=False) as diag:
with Cluster("Compute"):
web_1 = EC2("web 1")
web_2 = EC2("web 2")
@ashgkwd
ashgkwd / extensions.json
Created April 22, 2024 14:14
VS Code Extension Recommendations for Ruby
{
"recommendations": [
"aliariff.vscode-erb-beautify",
"aki77.rails-db-schema",
"shopify.ruby-extensions-pack"
]
}
@ashgkwd
ashgkwd / Cable.js
Created December 29, 2021 10:42
Connect to WebSocket opened by ActionCable
export function Cable() {
function _initSocket({
url = "ws://localhost:4080/cable", // Take from config
onOpen,
onClose,
onError,
onMessage,
}) {
Cable.socket = new WebSocket(url);
Cable.socket.onopen = onOpen;
@ashgkwd
ashgkwd / deploy-to-bucket.sh
Last active November 9, 2022 15:56
Deploy to GCS bucket for static website hosting
DOMAIN_NAME="my.web.site";
PROJECT_ID="my-gcp-project-id";
# create bucket of domain name
gsutil mb -p $PROJECT_ID -b on gs://$DOMAIN_NAME
# set index file
gsutil web set -m index.html gs://$DOMAIN_NAME
# set error file
@ashgkwd
ashgkwd / disable-two-fingers-on-brave.sh
Created August 18, 2021 17:58
Disables two finger back and forward gestures on macOS for Brave browser
# Set your app name - the Chromium Browser (i.e Chrome, Brave) in a variable.
appName="Brave"
# Get the bundle Id of the Chromium Browser, store it in a variable.
bundleID=$(osascript -e 'id of app "'$appName'"')
# Example: Get the bundle Id of Brave browser
# Returns:
# com.brave.Browser
import hashlib
passwd = "mywalletpassword"
salt = "summersaltstringwhichislong"
p = 1
r = 8
n = 262144
dklen = 32
dec_key = hashlib.scrypt(bytes(passwd, 'utf-8'), salt=bytes.fromhex(salt), n=n, r=r, p=p, maxmem=2000000000, dklen=dklen)
print(dec_key)
@ashgkwd
ashgkwd / .gitconfig
Created August 18, 2019 07:13
Some handy commands for Git users. Put it in your ~/.gitconfig
[core]
editor = vi
[alias]
spull = !git-svn fetch && git-svn rebase
spush = !git-svn dcommit
send = !git spull && git spush
up = pull --rebase
on = push origin master
co = checkout