Skip to content

Instantly share code, notes, and snippets.

@jcgregorio
jcgregorio / glibc_install.sh
Last active April 28, 2022 12:58 — forked from cheuerde/glibc_install.sh
Install GNU libc version parallel to existing system
# Claas Heuer, August 2015
#
# urls:
# http://stackoverflow.com/questions/847179/multiple-glibc-libraries-on-a-single-host
# http://www.gnu.org/software/libc/download.html
cd $HOME
mkdir glibc_update
cd glibc_update
@jcgregorio
jcgregorio / gen-example.go
Created October 11, 2021 12:51
Random Integer Matrices With Inverses That Are Also Integer Matrices, aka Generating Unimodular Matrices
// Demo application for generating random Unimodular Matrices: https://en.wikipedia.org/wiki/Unimodular_matrix
package main
import (
"fmt"
"math/rand"
"time"
"gonum.org/v1/gonum/mat"
)
// ncrev is essentially "nc -l NNNN", i.e. netcat listening on a port and
// directing the traffic to stdin/stdout, but it first checks that nothing is
// already listening on port NNNN.
package main
import (
"flag"
"io"
"log"
"net"
@jcgregorio
jcgregorio / settings.json
Created April 17, 2020 14:23
VS Code Settings
{
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": false,
"editor.find.autoFindInSelection": "always",
"go.testFlags": [
"-count=1"
],
"go.delveConfig": {
"useApiV1": false,
"dlvLoadConfig": {
@jcgregorio
jcgregorio / helloweb.yaml
Created January 1, 2020 18:10
helloweb deployment + service + ingress
apiVersion: apps/v1
kind: Deployment
metadata:
name: helloweb
labels:
app: hello
spec:
selector:
matchLabels:
app: hello
FROM debian:testing-slim
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
git \
python \
curl
RUN mkdir -p --mode=0777 /workspace/__cache \
&& groupadd -g 2000 skia \
&& useradd -u 2000 -g 2000 --home /workspace/__cache skia

Create a Google Cloud Storage bucket, and then create a service account that has Admin access to that bucket. Export a JSON key of that service account and store it at:

~/.config/{bucket name goes here}/key.json

foo: foo.c foo.h bar.c bar.h
gcc bar.c foo.c -o foo -lm
clean:
rm foo foo.o bar.o
<!DOCTYPE html>
<html>
<head>
<title>select-sk demo</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=egde,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" charset="utf-8">
// This bit of script loads the custom elements v1 polyfill, but only if required.
if (!window.customElements) {
window.customElements.define('subreddit-van', class extends HTMLElement {
// Only get callbacks when our 'name' attribute changes.
static get observedAttributes() { return ['name']; }
// Called when our 'name' attribute changes.
attributeChangedCallback(attr, oldValue, newValue) {
if (newValue === '') {
return
}
fetch(`https://www.reddit.com/r/${ newValue }/top.json?limit=5`).then(resp => {