Skip to content

Instantly share code, notes, and snippets.

View agritheory's full-sized avatar

Tyler Matteson agritheory

View GitHub Profile
@agritheory
agritheory / unreconciled_sales_return_example.md
Last active May 8, 2024 20:59
Unreconciled Sales Return example.md

A Customer purchased two Items and paid in cash. The ERPNext user created the Sales Invoice including payment. This is appropriate since the issue of inventory, consent to sell and payment are co-temporal.

Account Stock Ledger Debit Credit
Cost of Goods Sold $100.00
Inventory on Hand 2 @ $50.00 $100.00
Accounts Receivable $100.00
Sales $100.00
Accounts Receivable $100.00
Bank / cash account $100.00
import { existsSync, readFile, writeFile } from "fs";
import { remark } from 'remark';
import RemarkLinkRewrite from './rewrite.js';
import shelljs from "shelljs"
const { exec } = shelljs;
if (!existsSync("./content/")) {
exec("mkdir -p ./content");
}
@agritheory
agritheory / unshallow_clone_repo.md
Last active May 7, 2024 06:11
Create a full clone of a Frappe app locally

Create a full clone of a Frappe app locally

Synthesized from several helpful stackoverflow responses and some trial and error. This is intended for use in a development or possibly staging environment.

bench get-app cloud_storage git@github.com:agritheory/cloud_storage.git --skip-assets

This will complete the default clone/install (but not build) of a Frappe app.

In [1]: simple_dictionary = {'celtics': "Let's go", 'heat': 'Beat the'}
In [2]: simple_dictionary.get('la')
In [3]: simple_dictionary.get('la', '!!!')
Out[3]: '!!!'
In [4]: frappe_dictionary = frappe._dict({'celtics': "Let's go", 'heat': 'Beat the'})
In [5]: frappe_dictionary.get('la')
from frappe.modules.utils import export_customizations
def export_dimension_fields():
doctypes = [
"GL Entry",
"Sales Invoice",
"Purchase Invoice",
"Payment Entry",
"Expense Claim Detail",
"Expense Taxes and Charges",
@agritheory
agritheory / add_github_deploy.sh
Last active August 10, 2023 13:34
Add deploy key
# on local machine generate public and private keys
ssh-keygen -t ed25519
$ Generating public/private ed25519 key pair.
$ Enter file in which to save the key (/home/tyler/.ssh/id_ed25519): deploy_key
# add deploy_key.pub to github deploy keys via UI
# add both keys to server
# modify permissions
@agritheory
agritheory / edgewise_create_data.py
Created April 1, 2020 17:28
Generate Company and User with Mimesis
import csv
import random
import typing
from pathlib import Path
import mimesis
def write_to_file(filename: str, data: list) -> typing.NoReturn:
raw_path = Path(__file__).parent / filename
@agritheory
agritheory / token_auth_example.py
Last active March 4, 2020 01:14
Frappe Token Authorization Example
from requests import request
from base64 import b64encode
api_secret = get_decrypted_password("User", "example_username", "api_secret") # this is an internal frappe method
token = frappe.get_value("User", "example_username", "api_key") # this is an internal frappe method
url = "https://" + subdomain + ".some_domain.com"
headers = {
"Content-Type": "application/json",
"Authorization": "Basic "
+ b64encode(bytes(token + ":" + api_secret, "ascii")).decode("ascii"),
@agritheory
agritheory / Python Async Decorator.py
Created February 15, 2020 02:27 — forked from Integralist/Python Async Decorator.py
[Python Async Decorator] #python #asyncio #decorator
import asyncio
from functools import wraps
def dec(fn):
@wraps(fn)
async def wrapper(*args, **kwargs):
print(fn, args, kwargs) # <function foo at 0x10952d598> () {}
await asyncio.sleep(5)