Skip to content

Instantly share code, notes, and snippets.

@jgarte
jgarte / gist:4fb279152626dc9fd14ddcf488800e4c
Created December 22, 2020 23:04 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@jgarte
jgarte / github-repo-stars.py
Created December 29, 2020 20:09 — forked from iamaziz/github-repo-stars.py
Scrape the stars count of a GitHub repo (beautifulSoup)
from bs4 import BeautifulSoup as bs
import requests
def stars_count(url):
html = requests.get(url).text
soup = bs(html, 'lxml')
stars_class = "social-count js-social-count"
stars = soup.find('a', class_=stars_class).text.strip()
return stars
@jgarte
jgarte / main.c
Created January 1, 2021 21:55 — forked from ncweinhold/main.c
Calling Gambit-C scheme functions from C
#include <stdio.h>
#define ___VERSION 406001
#include "gambit.h"
#include "somescheme.h"
#define SCHEME_LIBRARY_LINKER ____20_somescheme__
___BEGIN_C_LINKAGE
@jgarte
jgarte / UnderscoreFFI.js
Created January 2, 2021 06:24 — forked from paf31/UnderscoreFFI.js
Minimal UnderscoreJS Binding for PureScript
"use strict";
// module UnderscoreFFI
exports.map = function(f) {
return function (arr) {
return require('underscore').map(arr, f);
};
};
@jgarte
jgarte / lisp.lua
Created January 2, 2021 11:27 — forked from polymeris/lisp.lua
Toy Lisp interpreter in Lua / LPEG
local lpeg = require'lpeg'
local P, R, S = lpeg.P, lpeg.R, lpeg.S --patterns
local C, Ct = lpeg.C, lpeg.Ct --capture
local V = lpeg.V --variable
local parser = P {
'program', -- initial rule
program = Ct(V'sexpr' ^ 0),
wspace = S' \n\r\t' ^ 0,
atom = V'boolean' + V'integer' + V'string' + V'symbol',
@jgarte
jgarte / README.md
Created January 10, 2021 05:34 — forked from mrkpatchaa/README.md
Bulk delete github repos

Use this trick to bulk delete your old repos or old forks

(Inspired by https://medium.com/@icanhazedit/clean-up-unused-github-rpositories-c2549294ee45#.3hwv4nxv5)

  1. Open in a new tab all to-be-deleted github repositores (Use the mouse’s middle click or Ctrl + Click) https://github.com/username?tab=repositories

  2. Use one tab https://chrome.google.com/webstore/detail/onetab/chphlpgkkbolifaimnlloiipkdnihall to shorten them to a list.

  3. Save that list to some path

  4. The list should be in the form of “ur_username\repo_name” per line. Use regex search (Sublime text could help). Search for ' |.*' and replace by empty.

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bind.dnsutils -p traceroute -p curl
# impure: needs ping
#source: https://s3.amazonaws.com/aws-cloudfront-testing/CustomerTesting.html
function _e {
echo "> $@"
eval "$@" 2>&1 | sed -e "s/^/ /"
printf "Exit: %s\n\n\n" "$?"
}
@jgarte
jgarte / freecodecamp_intro_to_jamstack.md
Created January 31, 2021 04:36 — forked from philhawksworth/freecodecamp_intro_to_jamstack.md
freeCodeCamp - Introduction to JAMstack

freeCodeCamp Introduction to JAMstack

Here's a list of links to resources to accompany the "Introduction to JAMstack" video on freeCodeCamp, by Phil Hawksworth

Watch the video

JAMstack video

The Why and When of Choosing Elm

What is Elm?

  • Language (and "framework") for building web frontend applications
  • Can be used in place of HTML, CSS and JavaScript
  • Compiles into the above
@jgarte
jgarte / syntax-rules.txt
Created March 7, 2021 07:33 — forked from tomjakubowski/syntax-rules.txt
"syntax-rules Primer for the Merely Eccentric" by Joe Marshall
JRM's Syntax-rules Primer for the Merely Eccentric
In learning to write Scheme macros, I have noticed that it is easy to
find both trivial examples and extraordinarily complex examples, but
there seem to be no intermediate ones. I have discovered a few tricks
in writing macros and perhaps some people will find them helpful.
The basic purpose of a macro is *syntactic* abstraction. As functions
allow you to extend the functionality of the underlying Scheme
language, macros allow you to extend the syntax. A well designed