Skip to content

Instantly share code, notes, and snippets.

Magnus magnli10

Block or report user

Report or block magnli10

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View regexp-global-sticky.md

Summary: .global (/g) and .sticky (/y)

/g /y /yg
.exec() at .lI or later at .lI same as /y
.test() at .lI or later at .lI same as /y
.replace() ignores & resets .lI at .lI /g w/o gaps
.replaceAll() ignores .lI TypeError /g w/o gaps
.search() no effect no effect no effect
.match() Array of group 0 captures like .exec() /g w/o gaps
@alryaz
alryaz / MiScale_Test.py
Last active Aug 18, 2019
First attempt at developing homeassistant-discoverable MiScale integration
View MiScale_Test.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import binascii
import time
import os
import csv
import sys
import json
@squidpickles
squidpickles / README.md
Created Jan 27, 2018
Multi-platform (amd64 and arm) Kubernetes cluster
View README.md

Multiplatform (amd64 and arm) Kubernetes cluster setup

The official guide for setting up Kubernetes using kubeadm works well for clusters of one architecture. But, the main problem that crops up is the kube-proxy image defaults to the architecture of the master node (where kubeadm was run in the first place).

This causes issues when arm nodes join the cluster, as they will try to execute the amd64 version of kube-proxy, and will fail.

It turns out that the pod running kube-proxy is configured using a DaemonSet. With a small edit to the configuration, it's possible to create multiple DaemonSets—one for each architecture.

Steps

Follow the instructions at https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/ for setting up the master node. I've been using Weave Net as the network plugin; it see

@paulirish
paulirish / server-timing-demo.js
Last active Jul 31, 2018
Demo of server timing values. visualized in chrome devtools
View server-timing-demo.js
// see for screenshot:
// https://twitter.com/paul_irish/status/829090506084749312
const http = require('http');
function requestHandler(request, response) {
const headers = {
'Server-Timing': `
sql-1;desc="MySQL lookup Server";dur=100,
sql-2;dur=900;desc="MySQL shard Server #1",
@PhilKershaw
PhilKershaw / gist:2171814
Created Mar 23, 2012
Simple example of using 2-legged OAuth in Node.js (requires node-oauth)
View gist:2171814
var express = require('express');
var oauth = require('oauth');
var app = express.createServer();
var key = "[api-key]";
var secret = "[api-secret]";
var request = new oauth.OAuth(null, null, key, secret, '1.0', null, 'HMAC-SHA1');
app.get('/api-request', function(req, res){
request.get(
"http://127.0.0.1:8000/api/1.0/data.json",
@kogakure
kogakure / .gitignore
Created Jul 17, 2009
Git: .gitignore file for LaTeX projects
View .gitignore
*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl
You can’t perform that action at this time.