Skip to content

Instantly share code, notes, and snippets.

View Integralist's full-sized avatar
🎯
Making an impact

Mark McDonnell Integralist

🎯
Making an impact
View GitHub Profile
@Integralist
Integralist / backend_template.vcl
Last active March 18, 2022 09:58 — forked from hrmsk66/backend_definition_via_loop.md
[Terraform create backend definitions from a list of hostnames] #terraform #fastly #work
backend F_${backendname} {
.between_bytes_timeout = 10s;
.connect_timeout = 1s;
.dynamic = true;
.first_byte_timeout = 15s;
.host = "${hostname}";
.max_connections = 200;
.port = "443";
.share_key = "...";
.ssl = true;
@Integralist
Integralist / profile_ctx.py
Last active June 7, 2020 15:20 — forked from andriykohut/profile_ctx.py
[Python profiling context management] #python #profiling #performance
import cProfile
import contextlib
import io
import pstats
import sys
import timeit
@contextlib.contextmanager
def prof(*restrictions, stdout=True, dump=None, sortby='cumulative'):
# https://minhajuddin.com/2016/03/03/put-this-in-your-code-to-debug-anything
require 'rouge'
require 'method_source'
require 'pp'
class Dbg
def initialize(object, to:)
@object, @stream = object, to
end
@Integralist
Integralist / Faraday SSL example.rb
Last active October 13, 2015 09:14 — forked from mislav/gist:938183
Faraday SSL example
connection = Faraday::Connection.new('http://example.com') do |builder|
builder.request :url_encoded # for POST/PUT params
builder.adapter :net_http
end
# same as above, short form:
connection = Faraday.new 'http://example.com'
# GET
connection.get '/posts'
@Integralist
Integralist / Godofile.go
Last active August 29, 2015 14:28
Godo re-build task
// It's important to realise that you'll only ever want to `go build` or `go run` a single file
// This confused me originally
// I could understand why my task's `Context` didn't get passed the name of the changed file
// The problem was I was just hacking little scripts together
// In practice, you'll be working within a project directory and you'll have a single entry point file
package main
import . "gopkg.in/godo.v1"
@Integralist
Integralist / Makefile
Last active January 22, 2024 00:30 — forked from isaacs/Makefile
Example of a detailed Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors

@Integralist
Integralist / zsh.md
Last active August 29, 2015 14:11 — forked from jcleveley-zz/zsh.md
Zsh tips

Path replacement

Moving from: /www/site1/media/css/main to /www/site2/media/css/main can be a pain, but not in zsh:

cd site1 site2
@Integralist
Integralist / ext.vim
Last active February 11, 2019 10:32 — forked from sjl/ext.vim
Some basic examples of executing external commands within Vim's COMMAND-LINE mode
" run command
" no stdin
" output displayed in "Press enter to continue" style
" current buffer untouched
:!uptime
" run command
" pipe range of text to command on stdin
" output replaces the range in the current buffer
:RANGE!grep foo
@Integralist
Integralist / curry.js
Last active August 29, 2015 14:04 — forked from unscriptable/curry.js
Curry implementation in Node
module.exports = curry;
function curry (f) {
var arity = f.length;
var params = [];
var end = createEnd(f, arity);
return createCurried(params, arity, end);
}
function createEnd (f, arity) {