Skip to content

Instantly share code, notes, and snippets.

View jagtesh's full-sized avatar

Jag Chadha jagtesh

View GitHub Profile
@8bitgentleman
8bitgentleman / roam-backend-api-example.py
Last active September 27, 2023 17:28
Example python functions for accessing the Roam Research Alpha Backend API
import requests
import json
import pprint
GRAPH_NAME = "GRAPH"
API_TOKEN_READ = "TOKEN"
API_TOKEN_WRITE = 'TOKEN'
BASE_URL = "https://api.roamresearch.com"
ENDPOINT_q = f"/api/graph/{GRAPH_NAME}/q"
@rain-1
rain-1 / LLM.md
Last active June 29, 2024 07:00
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@spenserhale
spenserhale / git-batch-push.sh
Last active June 16, 2024 11:10
When your repo exceeds upload limit (GitHub 2GB), you can push in batches so you can store up to total size limit. (100GB) (Warning uses force push, ideally should be used for setting up new remote, once)
# Adjust the following variables as necessary
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=250
# check if the branch exists on the remote
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# if so, only push the commits that are not on the remote already
range=$REMOTE/$BRANCH..HEAD
else
@lucasmenares
lucasmenares / Disable Device Enrollment Program (DEP) notification on macOS Ventura (Apple Silicon Chips).md
Last active January 24, 2024 21:32
Disable Device Enrollment Program (DEP) notification on macOS Sonoma/Ventura (Apple Silicon Chips)

This worked for me on M1 Pro 2021 with MacOS Ventura, original method was for Big Sur but I changed it using a different type of domain block since the old method doesn't work anymore:

First of all, if you want to trigger the notification you can use this command: sudo profiles show -type enrollment

Now we will start. First block your Mac from reaching the domain iprofiles.apple.com. For this you can use your hosts file like:

echo "0.0.0.0 iprofiles.apple.com" | sudo tee -a /etc/hosts

or blocking them from your firewall.

@tombarys
tombarys / children-block-count.clj
Last active October 5, 2023 01:18
Show children block count
;; Instructions for including the Clojure script (this) into your Roam can be found in my article
;; here: https://lifehacky.net/how-to-list-namespaces-and-find-more-in-roam-research-5c25d9f24556
;; Search for section "How to make it work in your Roam?" and think of "better-search" as of "children-block-count"
(ns reddit.8-7-2022-reagent
(:require [roam.datascript :as rd]
[reagent.core :as r]
[roam.datascript.reactive :as rdr]))
(defn show-num [uid]
@dbieber
dbieber / roam-blocks.js
Last active October 3, 2021 11:59
JavaScript Functions for Inserting Blocks in Roam. Documentation at https://davidbieber.com/snippets/2021-02-12-javascript-functions-for-inserting-blocks-in-roam/
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function getPage(page) {
// returns the uid of a specific page in your graph.
// _page_: the title of the page.
let results = window.roamAlphaAPI.q(`
[:find ?uid
:in $ ?title
@dbieber
dbieber / detect.py
Created January 5, 2021 02:47
Automatic distraction detection. Detects visits to distraction websites on your phone from your computer.
"""Automatic distraction detection. Work in progress.
Usage:
python detect.py main
"""
import fire
import subprocess
import plyvel
import re
Copy this to roam/js page, including the "{{[[roam/js]]}}" node:
- {{[[roam/js]]}}
- ```javascript
/*
* Roam template PoC by @ViktorTabori
* 0.1alpha
*
* How to install it:
* - go to `roam/js` page`
@Sandy4321
Sandy4321 / XGBoost-from-scratch-python.py
Created May 7, 2020 12:24 — forked from Ekeany/XGBoost-from-scratch-python.py
A numpy/pandas implementation of XGBoost
import numpy as np
import pandas as pd
from math import e
class Node:
'''
A node object that is recursivly called within itslef to construct a regression tree. Based on Tianqi Chen's XGBoost
the internal gain used to find the optimal split value uses both the gradient and hessian. Also a weighted quantlie sketch
and optimal leaf values all follow Chen's description in "XGBoost: A Scalable Tree Boosting System" the only thing not
@kadereub
kadereub / numba_polyfit.py
Last active June 10, 2024 16:44
A numba implementation of numpy polfit
# Load relevant libraries
import numpy as np
import numba as nb
import matplotlib.pyplot as plt
# Goal is to implement a numba compatible polyfit (note does not include error handling)
# Define Functions Using Numba
# Idea here is to solve ax = b, using least squares, where a represents our coefficients e.g. x**2, x, constants
@nb.njit