Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
One does not so much learn category theory as absorb it over time.

Fabian Beuke madnight

💭
One does not so much learn category theory as absorb it over time.
View GitHub Profile
View envs.md

App configuration in environment variables: for and against

For (some of these as per the 12 factor principles)

  1. they are are easy to change between deploys without changing any code

  2. unlike config files, there is little chance of them being checked into the code repo accidentally

View profile.log
SCRIPT /home/x/.vim/plugged/vim-misc/autoload/xolox/misc/cursorhold.vim
Sourced 1 time
Total time: 0.000191
Self time: 0.000191
count total (s) self (s)
" Rate limiting for Vim's CursorHold event.
"
" Author: Peter Odding <peter@peterodding.com>
" Last Change: June 22, 2014
@madnight
madnight / active-issues.sql
Created Sep 21, 2017 — forked from alysonla/active-issues.sql
Queries that power the open source section of the 2016 Octoverse report https://octoverse.github.com/
View active-issues.sql
-- Active issues
-- Count of total active issues in the specified time frame
-- Source: githubarchive public data set via Google BigQuery http://githubarchive.org/
SELECT
COUNT(DISTINCT JSON_EXTRACT_SCALAR(events.payload, '$.issue.id')) AS events_issue_count
FROM (SELECT * FROM TABLE_DATE_RANGE([githubarchive:day.],TIMESTAMP('2015-09-01'),TIMESTAMP('2016-08-31')))
AS events
-- 10,723,492 active issues
@madnight
madnight / hn-aeson.hs
Created Sep 30, 2016 — forked from Gonzih/hn-aeson.hs
Aeson HN example of nested JSON (unoptimized binary ~20 mb)
View hn-aeson.hs
{-# LANGUAGE OverloadedStrings #-}
import Data.Aeson
import Control.Applicative ((<$>), (<*>))
import Control.Monad (mzero)
import Network.HTTP.Conduit
import Data.ByteString.Lazy.Internal (ByteString(..))
data Item = Item { title :: String
, url :: String
View restpdf.rb
require 'json'
require 'base64'
require 'tempfile'
require 'sinatra'
require 'pdfkit'
# HTTP Status Codes
OK, BAD_REQUEST, UNAUTHORIZED, INTERNAL_SERVER_ERROR = 200, 400, 401, 500
# service is up and running
You can’t perform that action at this time.