Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Norman 2color

View GitHub Profile
@2color
2color / references.js
Created Nov 16, 2012
Object References in JS
View references.js
(function(exports) {
var object1 = { name : 'daniel' };
// make a reference to the local variable
exports.globalObject = { reference : object1 };
})(window);
View solarized (dark) theme.css
body {
white-space: pre;
font-family: monospace;
font-family: inconsolata;
background: #042029;
color: #819090;
}
.property {
font-weight: normal;
View server.js
var express = require('express'),
wine = require('./routes/wines');
var app = express();
app.configure(function () {
app.use(express.logger('dev')); /* 'default', 'short', 'tiny', 'dev' */
app.use(express.bodyParser());
});
@2color
2color / movies.md
Last active Dec 12, 2015
movies to watch
View movies.md
View readme.md
@2color
2color / Button.jsx
Last active Feb 16, 2017 — forked from eloypnd/Button.jsx
Theme defaults with styled components
View Button.jsx
import styled from 'styled-components'
import themeVars from 'theme.variables'
const Button = styled.button`
background-color: ${({theme}) => theme.button.backgroundColor};
border: none;
border-radius: ${({theme}) => theme.button.radius}px;
color: white;
cursor: pointer;
padding: ${({theme}) => theme.button.padding}rem;
@2color
2color / questions.md
Last active Jul 10, 2017
Prometheus Question
View questions.md

Prometheus Questions

  • metric names
    • Should the same metrics, e.g. requests_total be used across all http services or should one introduce a prefix for services?
    • What are the scaling considerations for an approach as the above
    • What if there's a load balancer and services where a request would be increase two counter, e.g. nginx_lb_requests_total and some_service_requests_total?
  • Series churn
    • When series churn happens and you have two time series, e.g. http_requests_total{code="200"} and http_requests_total{code="500"} are two new series created when the new prometheus container scrapes that target (not sure if same storage is mounted in k8s)?
@2color
2color / gist:2070f7870cc237ea7ab72e5276b149ff
Created Sep 5, 2017 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.
View gist:2070f7870cc237ea7ab72e5276b149ff

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
View emoji-table.md
Emoji Meaning
⚠️ WIP
Done
Not Done
🎆 Serendipitous
You can’t perform that action at this time.