Skip to content

Instantly share code, notes, and snippets.

View Jolg42's full-sized avatar
Taking a break 🏕️

Joël Galeran Jolg42

Taking a break 🏕️
View GitHub Profile
#!/bin/bash
# Discussion, issues and change requests at:
# https://github.com/nodesource/distributions
#
# Script to install the NodeSource Node.js 14.x repo onto a
# Debian or Ubuntu system.
#
# Run as root or insert `sudo -E` before `bash`:
#
@Jolg42
Jolg42 / tree_sitter_guide.md
Created July 19, 2022 10:09 — forked from Aerijo/tree_sitter_guide.md
Guide to writing your first Tree-sitter grammar

Guide to your first Tree-sitter grammar

NOTE: The Tree-sitter API and documentation has changed and improved since this guide was created. I can't guarantee this is up to date.

About

Tree-sitter is the new way Atom is providing language recognition features, such as syntax highlighting, code folding, autocomplete, and more. In contrast to TextMate grammars, which work by regex matching, Tree-sitter will generate an entire syntax tree. But more on that can be found in it's own docs.

Here, we look at making one from scratch.

@Jolg42
Jolg42 / making_language_grammar.md
Created July 19, 2022 10:08 — forked from Aerijo/making_language_grammar.md
Guide to writing an Atom language grammar

A guide to writing a language grammar (TextMate) in Atom

Tree sitter

  • Atom is transitioning to an entirely new way of defining grammars using tree-sitter. This will be enabled by default quite soon now. It is theoretically faster and more powerful than regex based grammars (the one described in this guide), but requires a steeper learning curve. My understanding is that regex based grammars will still be supported however (at least until version 2), so this guide can still be useful. To enable it yourself, go to Settings -> Core and check Use Tree Sitter Parsers

Links for tree-sitter help:

@Jolg42
Jolg42 / cleanupGitHub.sh
Created April 8, 2022 10:00
Script to delete GitHub Actions worfklow runs for cleanup (only way to get rid of an unused workflow, is to delete all the runs)
OWNER=prisma
REPO=the-repo
# 1. list workflows
gh api -X GET /repos/$OWNER/$REPO/actions/workflows | jq '.workflows[] | .name,.id'
# 2. copy the ID of the workflow you want to clear and set it
WORKFLOW_ID=ID-FROM-PREVIOUS-STEP
# 3. list runs as safe check before deting
@Jolg42
Jolg42 / milestones.js
Created November 5, 2021 08:46
Run with `deno run --allow-net deno.ts`
import { Octokit } from 'https://cdn.skypack.dev/@octokit/core'
// import { Endpoints } from 'https://cdn.skypack.dev/@octokit/types'
// type listMilestonesParameters = Endpoints['GET /repos/{owner}/{repo}/milestones']['parameters']
// type listMilestonesResponse = Endpoints['GET /repos/{owner}/{repo}/milestones']['response']
const token = 'ghp_....'
const octokit = new Octokit({ auth: token })
// const repos = await octokit.request('GET /user/repos')
// console.log(repos.data)
@Jolg42
Jolg42 / index.js
Last active October 20, 2021 13:12
Prisma Milestones
import { Octokit } from "https://cdn.skypack.dev/@octokit/core";
const token = Deno.env.get("GITHUB_TOKEN")
const octokit = new Octokit({ auth: token});
const repos = await octokit.request('GET /user/repos');
const milestones = [{
"title": "3.4.0",
// "description": ""
"due_on": "2021-11-02T00:00:00Z"
}];
@Jolg42
Jolg42 / etc-hosts
Created February 5, 2021 09:54
GotHub Actions hosts file
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
127.0.0.1 stratum.antpool.com
@Jolg42
Jolg42 / index.js
Last active February 3, 2021 08:52
Cloudflare CORS Proxy to NPM Registry
// From https://developers.cloudflare.com/workers/examples/cors-header-proxy
// We support the GET, POST, HEAD, and OPTIONS methods from any origin,
// and allow any header on requests. These headers must be present
// on all responses to all CORS preflight requests. In practice, this means
// all responses to OPTIONS requests.
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,HEAD,OPTIONS",
"Access-Control-Max-Age": "86400",
}
@Jolg42
Jolg42 / readme.md
Created January 25, 2020 14:13
Code Signing on macOS and Windows + Apple Notarization

macOS

Steps

  • What we want is to get a Developer Id https://developer.apple.com/developer-id/ to be able to sign the binaries for distribution.
  • The company needs to get an Apple Developer Account Membership for macOS for $99/y https://developer.apple.com/programs/enroll/
  • Apple needs a A D-U-N-S® Number to register the account, the person doing the registration will need to get in touch with somebody that knows the legal part.
  • The registration could take a couple days
  • When done, a certificate can be created for signing, you'll need to sync it with Xcode.
  • Now the binary can be signed, and the signature can be verified.
@Jolg42
Jolg42 / 00_logdna.config
Created December 4, 2018 11:11
00_logdna.config
files:
"/home/ec2-user/logdna.sh" :
mode: "000777"
owner: root
group: root
content: |
#!/bin/sh
rpm --import https://repo.logdna.com/logdna.gpg
echo "[logdna]
name=LogDNA packages