Skip to content

Instantly share code, notes, and snippets.

@monmohan
monmohan / asymmetric.go
Last active January 18, 2023 09:02
JWK - Certificate from X5c and validation
package jws
import (
"bytes"
"crypto"
"crypto/rsa"
_ "crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/binary"
@adamluzsi
adamluzsi / postgresql.sql
Last active April 5, 2020 03:11
SQL Cheat sheet
-- show queries that are blocked by other queries (>= 9.6)
SELECT pid,
usename,
pg_blocking_pids(pid) as blocked_by,
query AS blocked_query
FROM pg_stat_activity
WHERE cardinality(pg_blocking_pids(pid)) > 0;
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
@subfuzion
subfuzion / github-wiki-how-to.md
Last active June 5, 2024 05:31
GitHub Wiki How-To

How do I clone a GitHub wiki?

Any GitHub wiki can be cloned by appending wiki.git to the repo url, so the clone url for the repo https://myorg/myrepo/ is: git@github.com:myorg/myrepo.wiki.git (for ssh) or https://github.com/my/myrepo.wiki.git (for https).

You make edits, and commit and push your changes, like any normal repo. This wiki repo is distinct from any clone of the project repo (the repo without wiki.get appended).

How do I add images to a wiki page?

@rosenfeld
rosenfeld / application_controller.rb
Created July 18, 2014 11:47
Supporting automatic return from render/redirect/head in Rails
# Please don't comment in this gist since I'm not notified by any comments here:
# https://github.com/isaacs/github/issues/21
# This is the discussion to comment on: http://blog.arkency.com/2014/07/4-ways-to-early-return-from-a-rails-controller/
class ApplicationController < ActionController::Base
# ...
around_action :catch_halt
def render(*args)
@huyng
huyng / reflect.py
Created February 7, 2011 17:57
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):