Skip to content

Instantly share code, notes, and snippets.

View ccjoel's full-sized avatar
🌀
REPL'ing

Joel Quiles ccjoel

🌀
REPL'ing
View GitHub Profile
@brandomr
brandomr / es-mapping-update.py
Created November 21, 2022 19:32
es-mapping-update
from elasticsearch import Elasticsearch
import json
es = Elasticsearch('http://localhost:9200')
q = {
"query": {
"match_all": {}
}
}
@ccjoel
ccjoel / gist:eb7dcd892805006b2db1567f4f0df1d3
Created May 2, 2019 20:19 — forked from aphyr/gist:3200862
Clojure message passing test
(ns messagepassing.core)
(import [java.util.concurrent LinkedTransferQueue])
(def m 10000000)
(defn queue-test []
(defn bounce [in out m]
(let [value (.take in)]
(if (< value m)
(do
@paolocarrasco
paolocarrasco / README.md
Last active July 22, 2024 14:38
How to understand the `gpg failed to sign the data` problem in git

Problem

You have installed GPG, then tried to commit and suddenly you see this error message after it:

error: gpg failed to sign the data
fatal: failed to write commit object

Debug

shadow-cljs code split

Quick comparison to the cljs.loader recently added to CLJS.

Things shadow-cljs does for you:

  • enable-console-print! is a config option, you do not need to call it
  • loader/set-loaded! will be injected for you as well

Install

@causal-agent
causal-agent / babyjit.c
Created October 13, 2016 03:09
Baby's First JIT
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/mman.h>
#include <unistd.h>
#include <err.h>
#include <sysexits.h>
typedef int32_t (*fptr)(int32_t);

Things that programmers don't know but should

(A book that I might eventually write!)

Gary Bernhardt

I imagine each of these chapters being about 2,000 words, making the whole book about the size of a small novel. For comparison, articles in large papers like the New York Times average about 1,200 words. Each topic gets whatever level of detail I can fit into that space. For simple topics, that's a lot of space: I can probably walk through a very basic, but working, implementation of the IP protocol.

@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@addyosmani
addyosmani / headless.md
Last active May 17, 2024 03:38
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

@timmc
timmc / rest.swear.clj
Last active December 15, 2016 15:24
rest in curje [now called swearjure]
;; An exercise in writing #'rest without [0-9a-zA-Z], by Tim McCormack
;; Note that the input must be a vector, although the code could easily be
;; modified to vector-ify any input coll.
;; Let's take this a step at a time...
(#(((% 1) :main) %) ;; call the main method with the input and fns
[[0 1 2 3 4 5] ;; the input is hardcoded here
;; fns are accessed by static indices into the fn table
{:main #(if (= (% 0) [])
@aspyct
aspyct / signal.c
Last active February 19, 2024 11:24
Unix signal handling example in C, SIGINT, SIGALRM, SIGHUP...
/**
* More info?
* a.dotreppe@aspyct.org
* http://aspyct.org
*
* Hope it helps :)
*/
#include <stdio.h>
#include <stdlib.h>