This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
users: | |
- name: joel | |
ssh_authorized_keys: | |
- <pub_key> | |
sudo: ALL=(ALL:ALL) ALL | |
groups: sudo | |
shell: /bin/bash | |
chpasswd: | |
expire: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs"); | |
async function getDownloadsPerDay(pkgName) { | |
// for the past year | |
const from = "2022-12-01"; | |
const until = "2023-11-30"; | |
try { | |
const res = await fetch( | |
`https://npm-stat.com/api/download-counts?package=${pkgName}&from=${from}&until=${until}`, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { promisify } = require("util"); | |
const execAsync = promisify(require("child_process").exec); | |
const fs = require("fs"); | |
async function getReleaseData(pkgName) { | |
const command = `npm view ${pkgName} time --json`; | |
try { | |
const { stdout } = await execAsync(command); | |
const data = JSON.parse(stdout); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run git shortlog to get the contributors and their commit counts | |
git shortlog -s -n > contributors.txt | |
# Calculate total commits and average commits per contributor | |
total_commits=$(awk '{s+=$1} END {print s}' contributors.txt) | |
num_contributors=$(wc -l < contributors.txt) | |
average_commits_per_contributor=$((total_commits / num_contributors)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is a TS & modified version of: https://gist.github.com/mattiaerre/8dbd2d8efca3f242c7085a9ce82ecbde | |
import * as React from 'react'; | |
// from: https://usehooks.com/useLocalStorage | |
import { useLocalStorage } from './useLocalStorage'; | |
export const useReducerWithLocalStorage = <S, A>(reducer: React.Reducer<S, A>, initializerArg: S, key: string) => { | |
const [localStorageState, setLocalStorageState] = useLocalStorage(key, initializerArg); | |
return React.useReducer( |