Skip to content

Instantly share code, notes, and snippets.

View tonidy's full-sized avatar

toni dy tonidy

View GitHub Profile
@mika76
mika76 / Info.cshtml
Last active October 20, 2021 16:49
phpinfo like page for .net core
@page
@{
Layout = "";
}
@using System.Linq;
@using System.Collections;
@using System.Reflection;
<html>
@l3nz
l3nz / README.md
Last active August 8, 2023 05:54
NOT Fixed: accountsd using 400% CPU on MacOS Catalina 10.15.7 (19H2)

accountsd using 400% CPU on MacOS Catalina 10.15.7 (19H2)

TL;DR: Still open - see below.

This morning I woke up to some not-so-nice surprise - my 2018 MPB 13" would be kind of totally unusable. The accountsd process was stable at 400%, battery was going like ice-cream in the Sahara, and opening up LibreOffice was like a major achievement.

I did check the logs (that were growing at like 500 lines per second) and I saw a lot of lines at FAULT level:

fault 07:54:04.271342+0200 accountsd Unentitled access by client 'CallHistoryPlugi' (selector: accountsWithAccountType:handler:)

<?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 May 20, 2024 12:11
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: