Skip to content

Instantly share code, notes, and snippets.

@michiel
michiel / cors-nginx.conf
Created July 5, 2011 10:41
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@michiel
michiel / get_secret.yaml
Created May 16, 2025 00:57
Re-usable CodeFresh build step to access GCP Secrets Manager secrets
version: "1.0"
name: Secure Secret Run with GCP
description: |
Securely runs a user-provided shell script/command with a secret fetched from GCP Secret Manager.
The secret is provided directly to the script's standard input (stdin).
This step is designed to prevent the secret value from being exposed in environment variables,
Codefresh logs (by this step itself), or unintentionally written to disk *by this step*.
Security Considerations:
- Shared Responsibility: The ultimate security of the secret, once it is piped to the
@michiel
michiel / clone-jira-epic.py
Last active March 2, 2025 19:20
Deep clone Jira epic
from atlassian import Jira
# Jira Configuration
JIRA_URL = "https://your-jira-instance.atlassian.net"
JIRA_USER = "your-email@example.com"
JIRA_API_TOKEN = "your-api-token"
# Initialize Jira connection
jira = Jira(url=JIRA_URL, username=JIRA_USER, password=JIRA_API_TOKEN, cloud=True)
@michiel
michiel / jsonSchemaInterface.ts
Created August 3, 2016 14:20 — forked from enriched/jsonSchemaInterface.ts
TypeScript interface for Json-Schema V4
/**
* MIT License
*
* Copyright (c) 2016 Richard Adams (https://github.com/enriched)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@michiel
michiel / transport-dynamodb-data.sh
Created March 26, 2020 00:13
Export and import DynamoDB data across environments
#!/bin/sh
SOURCE_TABLE=xxx-mydata-accp
TARGET_TABLE=xxx-mydata-prod
AWS_PROFILE=default
AWS_REGION=ap-southeast-2
# Step 1 - export and transform
aws --profile=$AWS_PROFILE \
@michiel
michiel / lat_lng_jitter.js
Last active March 7, 2023 16:51
Add jitter to latitude/longitude
//
// Make a few assumptions and add noise to latitude/longitude position
// Ex, console.log(jitter(-26.4853429150483, -49.072945734375, 5));
//
var rad_Earth = 6378.16;
var one_degree = (2 * Math.PI * rad_Earth) / 360;
var one_km = 1 / one_degree;
function randomInRange(from, to, fixed) {
@michiel
michiel / fluent-bit-nest.md
Last active November 9, 2022 16:03
fluent-bit example config/output for https://github.com/fluent/fluent-bit/pull/531

Nest/Lift

Nest 1

[INPUT]
    Name mem
    Tag  mem.local

[OUTPUT]

Name stdout

@michiel
michiel / collect.sh
Created August 16, 2017 22:21
expect + ssh + scp with password to collect data from a list of servers
#!/bin/bash
PASSWORD="password"
USERNAME="username"
SSHPORT=22
@michiel
michiel / kafka-consumer.java
Created October 11, 2015 17:46 — forked from terrancesnyder/kafka-consumer.java
Simple example of publishing avro messages to Kafka.
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.avro.io.BinaryDecoder;
import org.apache.avro.io.BinaryEncoder;
import org.apache.avro.io.DecoderFactory;

Transparent Git Encryption

This document has been modified from its [original format][m1], which was written by Ning Shang (geek@cerias.net). It has been updated and reformatted into a [Markdown][m2] document by [Woody Gilk][m3] and [republished][m4].

Description

When working with a remote git repository which is hosted on a third-party storage server, data confidentiality sometimes becomes