Skip to content

Instantly share code, notes, and snippets.

Avatar

gmarik gmarik

View GitHub Profile
@gmarik
gmarik / 0_new.md
Created Feb 8, 2021 — forked from zaach/0_new.md
New Jison 0.3 features
View 0_new.md

Some improvements have been made for parser and lexer grammars in Jison 0.3 (demonstrated in the FlooP/BlooP example below.)

For lexers:

  • Patterns may use unquoted characters instead of strings
  • Two new options, %options flex case-insensitive
  • flex: the rule with the longest match is used, and no word boundary patterns are added
  • case-insensitive: all patterns are case insensitive
  • User code section is included in the generated module
View how-to-view-source-of-chrome-extension.md

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@gmarik
gmarik / latency.txt
Created Jul 2, 2020 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@gmarik
gmarik / ca.md
Created Jun 23, 2020 — forked from soarez/ca.md
How to setup your own CA with OpenSSL
View ca.md

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@gmarik
gmarik / clojure-match.clj
Created Jun 23, 2020 — forked from ckirkendall/clojure-match.clj
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
View clojure-match.clj
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})
View Crawler.go
package main
import (
"net/http"
"net/url"
"runtime"
"strings"
"context"
"bytes"
@gmarik
gmarik / google-apps-script.md
Last active Jun 23, 2020 — forked from labnol/google-apps-script.md
How to Learn Google Apps Script - The best resources for learning Google Apps Script, the glue that connects GSuite services including Gmail, Google Drive, Calendar, Maps, Analytics and more.
View google-apps-script.md

Learning Google Apps Script

The best place to learn more about Google Script is the official documentation available at developers.google.com. Here are other places that will help you get up to speed.

  1. MAKING A GMAIL BOT WITH APPS SCRIPT AND TYPESCRIPT
  2. Google Apps Scripts - Snippets by +Amit Agarwal
  3. Apps Script Starter - Create Google Apps Script projects locally inside VS Code.
  4. Digital Inspiration by +Amit Agarwal - Google Addons
  5. Awesome Google Scripts by +Amit Agarwal
  6. Build with Google Apps Script - Setup a local development environment for Apps Script
@gmarik
gmarik / Dockerfile
Created Sep 29, 2019 — forked from Irio/Dockerfile
GCP Serverless scrapers
View Dockerfile
FROM golang:1.12 as build
WORKDIR $GOPATH/src/github.com/Irio/wohnung
COPY scraper scraper
COPY main.go .
RUN go get -d -v ./...
RUN go install
FROM gcr.io/distroless/base
@gmarik
gmarik / analyze.go
Created Nov 12, 2015 — forked from nf/analyze.go
'spent' script to log where time is spent
View analyze.go
package main
import (
"bufio"
"fmt"
"os"
"regexp"
"sort"
"strconv"
"strings"
View chat.go
package main
import (
"bufio"
"fmt"
"net"
)
type Client struct {
incoming chan string