Skip to content

Instantly share code, notes, and snippets.

View Overbryd's full-sized avatar

Lukas Rieder Overbryd

View GitHub Profile
@Overbryd
Overbryd / 0_usage.md
Last active May 6, 2024 14:30
Auto-refreshing XOAuth token system for Google

Usage

Simple as XOauthSession.access_token.

First time usage, either create a yaml file yourself or:

Setup your app at Google developer console. There you follow the menu "APIs & auth" > "Credentials". Click "Create new Client ID" and select "Installed Application" and then "Other". Download oauth2.py and execute the following with the credentials of the Google Developer console.

@Overbryd
Overbryd / README.md
Created January 5, 2024 16:04
Containerd private registry authentication

Containerd private registry authentication (Gitlab)

  1. Obtain a private access token (or a group deploy token) with read_registry rights.
  2. Encode the username + token $ echo -n 'USERNAME:TOKEN' | base64
  3. Configure containerd
[plugins."io.containerd.grpc.v1.cri".registry.configs."registry.gitlab.com".auth]
  auth = "ENCODED_TOKEN"
@Overbryd
Overbryd / app.py
Last active December 1, 2023 09:40
# ... snip
def generate_upload_signed_url_v4(bucket_name, blob_name, *, origin=None):
storage_client = storage.Client()
bucket = storage_client.bucket(bucket_name)
blob = bucket.blob(blob_name)
headers = {}
if origin:
headers['origin'] = origin
return blob.generate_signed_url(
@Overbryd
Overbryd / hacking-club-mate-imatate.md
Created June 22, 2011 13:46
Hacking Club Mate "imatate"

Hacking Club Mate "imatate"

Read about the end result here

Join me when I start brewing my first batch of Club Mate. Inspired by a podcast from chaos radio express on the topic "Hackerbrausen" (Hacker's soda, listen here) I want to try this by myself.

So far I have bought all the necessary ingrediends and tools to get started. And with the help from Jan (@janl) I can even carbonate the end result :)

When? Where?

@Overbryd
Overbryd / 0-README.md
Last active September 11, 2023 19:14
Cloudflare Fragment Caching

Cloudflare fragment rendering/caching

This worker script will evaluate your origin response, and replace html comments marked as fragment:key with a respective prefetch defined in a X-Fragments response header.

Usage

Your origin must include the X-Fragments header, specifying the a comma separated list of prefetch requests to make for that response.

< HTTP/1.1 200 OK
@Overbryd
Overbryd / unbound.conf
Created March 29, 2019 14:54
A pretty good unbound.conf, DNSSEC, caching and local forwarding
remote-control:
control-enable: yes
server:
do-ip6: no
do-ip4: yes
do-udp: yes
tls-cert-bundle: /etc/ssl/certs/ca-certificates.crt
num-threads: 4
# Enable logs
verbosity: 1
@Overbryd
Overbryd / nginx.conf
Created March 27, 2012 22:22
Nginx configuration for a CouchDB reverse proxy, also very useful for hosting CouchApps
worker_processes 4;
events {
worker_connections 1024;
}
http {
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
var botty = (function() {
'use strict';
var d = {
// Record client timestamp
ct: new Date().getTime(),
ctD: 0,
// Record obvious red flags
rf: (
window.callPhantom === undefined
@Overbryd
Overbryd / 1_example.rb
Last active June 2, 2022 10:27
Sexiest assertion since I started testing APIs: assert_structure
# lets say this is the response we receive
response = {
"results" => {
"total_count" => 15,
"per_page" => 100,
"companies" => [
{
"company" => {
"name" => "Foo Bar Ltd",
"registered_address" => { ... },
@Overbryd
Overbryd / path-in-mac-osx-10.7.mdown
Created January 24, 2012 09:58
Correcting $PATH in MacOSX 10.7 for homebrew

$PATH in MacOSX 10.7

MacOSX has a truly global path setting that precedes any other setting like ~/.bash_profile. The file /private/etc/paths is a list of pathnames. The order from top to bottom defines the resulting order in the $PATH variable. After loading /private/etc/paths there is a directory /private/etc/paths.d/ with files in the same style. Those are appended to the $PATH variable.

The default content of /private/etc/paths looks like this:

/usr/bin

/bin