Skip to content

Instantly share code, notes, and snippets.

View tonidy's full-sized avatar

toni dy tonidy

View GitHub Profile
<?php
namespace main;
define("BACKEND_SOCKET", '<where the unix socket>');
define("BASE_URL", '<where this file located>');
function exit_500($msg) {
$msg = rtrim($msg, "\n") . "\nDebug trace:\n";
foreach(debug_backtrace() as $trace) {
@dzungtran
dzungtran / main.go
Last active November 14, 2023 06:35
[Golang] Read large csv file with worker pool
package main
// Sample file for test: https://drive.google.com/file/d/1DFkJdX5UTnB_xL7g8xwkkdE8BxdurAhN/view?usp=sharing
import (
"encoding/csv"
"encoding/json"
"fmt"
"io"
"os"
"strconv"
"sync"
@relyt0925
relyt0925 / provision_ubuntu2004_qemu_macosx.sh
Created May 14, 2020 04:50
Provisions a Ubuntu 20.04 VM in QEMU on Mac OSX using Cloud-Init
#!/usr/bin/env bash
#Install brew and qemu + cloud init metadata dependencies
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install qemu
brew install cdrtools
rm -rf /tmp/ubuntuqemuboot
#download Ubuntu 20.04 Cloud Image and resize to 30 Gigs
mkdir -p /tmp/ubuntuqemuboot/images
@riffrain
riffrain / uuidv4.js
Last active August 28, 2023 16:18
Simple UUID(v4) Generator
function uuidv4_1() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
.split('')
.map((c) => {
if (c === 'x') return Math.floor(Math.random() * 0xf).toString(16); // [0-9a-f]
if (c === 'y') return Math.floor(Math.random() * 4 + 8).toString(16); // [89ab]
return c;
})
.join('');
}
@GAM3RG33K
GAM3RG33K / ReadMe.md
Created February 14, 2020 07:07
A Guide to setup and use Plantuml
@mpreu
mpreu / fcos-qemu-demo
Last active May 25, 2021 05:41
Fedora CoreOS - Example script to setup a FCOS virtual machine using QEMU. Originates from this blog post: https://www.matthiaspreu.com/posts/fedora-coreos-first-steps/.
#!/bin/env bash
set -eo pipefail
#
# Part of an introductory Fedora CoreOS blog post on my website:
# https://www.matthiaspreu.com/posts/fedora-coreos-first-steps/
#
# Script sets up a FCOS virtual machine using QEMU.
#
# Initial user "matthias" with password "test" can be used.
@MichaelSimons
MichaelSimons / RetrievingDockerImageSizes.md
Last active March 25, 2024 11:14
Retrieving Docker Image Sizes

Retrieving Docker Image Sizes

There are two metrics that are important to consider when discussing the size of Docker images.

  1. Compressed size - This is often referred to as the wire size. This affects how fast/slow images can be pulled from a registry. This impacts the first run experience on machines where images are not cached.
  2. Uncompressed size - This is often referred to as the size on disk. This affects how much local storage is required to support your Docker workloads.

The example commands shown below will work on Windows, MacOS, and Linux.

How to Measure the Compressed Size

@andsilver
andsilver / bitbucket-pipelines.yml
Created November 12, 2019 17:58
Bitbucket pipeline to auto deploy Docker Compose app to Google Kubernetes Engine
pipelines:
branches:
<BRANCH_NAME>:
- step:
services:
- docker
name: Deploy to GKE
deployment: staging
image: google/cloud-sdk:latest
script:
@jeremymaya
jeremymaya / dotnet-macOS.md
Last active April 12, 2024 11:36
ASP.NET Core Development with macOS
@ipmb
ipmb / docker-exec-ecs.sh
Last active June 2, 2022 17:30
docker exec on AWS ECS with SSM
#!/bin/bash
# USAGE: CLUSTER=mycluster SERVICE=myservice ./docker-exec-ecs.sh
set -euf -o pipefail
TASK_ARN=$(aws ecs list-tasks --cluster=$CLUSTER --service=$SERVICE \
| jq -r .taskArns[0])
if [ "$TASK_ARN" = "null" ]; then
echo "Could not find any running tasks for $SERVICE on cluster:$CLUSTER."
exit 1
fi