Skip to content

Instantly share code, notes, and snippets.

@vr-greycube
vr-greycube / gspreadsheet.py
Last active June 1, 2025 09:46
Create Google Spreadsheet in Frappe, using frappe built-in oauth setup in Google Settings for Google Drive
import frappe
from frappe.utils import cstr
from frappe.integrations.google_oauth import GoogleOAuth
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from frappe.desk.query_report import run
class GoogleOAuthSpreadsheets(GoogleOAuth):
"""
@vr-greycube
vr-greycube / restore_db.sh
Last active May 9, 2025 08:08
Script to import mysqldump by splitting into individual tables
#!/bin/bash
# Name of the gzipped backup file (passed as command-line argument)
if [ -z "$1" ]; then
echo "Error: Backup file name is required as the first argument."
echo "Usage: $0 <backup_file.sql.gz>"
exit 1
fi
backup_file="$1"
frappe.ui.form.on('Travel Request', {
onload(frm) {
new StatusStepper(frm, {
grid_fields: ['itinerary'],
fieldnames: ['travel_to', 'mode_of_travel']
}).init()
class StatusStyler {
constructor() {
this.btnTemplate = BUTTON_TEMPLATE
}
getSelector(prefix, field) {
return `${prefix}[data-fieldname="${field}"]`
}
@vr-greycube
vr-greycube / ubuntu frappe development in docker .md
Created October 27, 2024 03:48
set up frappe development in Docker on ubuntu
sudo apt update && sudo apt upgrade && sudo apt autoremove

sudo apt install git curl

https://docs.docker.com/engine/install/ubuntu/

for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done

sudo apt update && sudo apt upgrade && sudo apt autoremove

sudo apt install -y git curl gh

https://docs.docker.com/engine/install/ubuntu/

for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done

Add Docker's official GPG key:

sudo apt-get update

@vr-greycube
vr-greycube / find.md
Last active August 8, 2023 03:08
ubuntu terminal survival guide

# sorted by modified

find . -type f -not -path "*/__pycache__/*" -printf "%TY-%Tm-%Td %TT %p\n" | sort -n

# sorted by modified reverse

find . -type f -not -path "*/__pycache__/*" -printf "%TY-%Tm-%Td %TT %p\n" | sort -nr
@vr-greycube
vr-greycube / jupyter.md
Last active August 8, 2023 03:14
frappe python survival guide