Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
#
# See https://stackoverflow.com/questions/26881441/can-you-get-the-number-of-lines-of-code-from-a-github-repository
#
git clone --depth 1 [email protected]:oreillymedia/heron.git
printf "\nTotal lines\n"
echo "========================="
cloc heron --quiet --csv --include-lang=Python,JavaScript,HTML --exclude-dir=migrations | cut -d ',' -f 2,5
printf "\nLines excluding tests\n"
echo "========================="
// Based on https://dev.to/andyrewlee/cheat-sheet-for-updating-objects-and-arrays-in-react-state-48np
const DATA = [
{ id: 123, name: "bart" },
{ id: 256, name: "lisa" },
{ id: 344, name: "homer" },
{ id: 412, name: "marge" },
];
const addRecord = { id: 477, name: "frink" };
@odewahn
odewahn / clone-github-repo-to-google-drive.md
Created October 19, 2022 20:36
Clone a github repo into google drive using google colab

Here's how to import a github repo into drive using google colab.

In the first cell, import the drive package and mount you google drive:

from google.colab import drive
drive.mount('/content/drive')

In the next cell, put a bash script that just clones whatever repo you want:

@odewahn
odewahn / fetch-example.py
Last active December 12, 2024 20:30
Grab content from ORM api
import aiohttp
import sys
import asyncio
import os
# Before you start, get a content token from https://learning.oreilly.com/account/api-tokens/
# You'll need the account manager role on your user membership. If you're not an account manager
# then you'll need to request on from the U&A team of someone who can create tokens
# Then create an environment variable called ORM_AUTH_TOKEN with the token as the value