Skip to content

Instantly share code, notes, and snippets.

View criscola's full-sized avatar
🎯
Focusing

Cristiano Colangelo criscola

🎯
Focusing
View GitHub Profile
@Jai-JAP
Jai-JAP / 1000-signGrub.hook
Last active February 28, 2026 15:46
Manjaro SecureBoot Setup Guide
[Trigger]
Operation = Install
Operation = Upgrade
Operation = Remove
Type = Path
Target = /boot/efi/EFI/Manjaro/grubx64.efi
[Action]
Description = Signing GRUB with Machine Owner Key for Secure Boot
When = PostTransaction
@TonyGravagno
TonyGravagno / zodDefaultInstance.ts
Last active March 12, 2026 14:13
Create a default object from a Zod schema
import { z } from 'zod'
/**
* @summary Function returns default object from Zod schema
* @version 23.05.15.2
* @link https://gist.github.com/TonyGravagno/2b744ceb99e415c4b53e8b35b309c29c
* @author Jacob Weisenburger, Josh Andromidas, Thomas Moiluiavon, Tony Gravagno
* @param schema z.object schema definition
* @param options Optional object, see Example for details
* @returns Object of type schema with defaults for all fields
@AverageMarcus
AverageMarcus / Dockerfile
Created September 2, 2021 08:49
Example multi-arch Dockerfile for Go projects
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.16 as builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app/
ADD . .
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" -o yourapplication main.go
@PrasadG193
PrasadG193 / retrywatcher_example.go
Last active April 12, 2024 08:55
An example of using RetryWatcher to watch resource events
package main
import (
"context"
"fmt"
"os"
"path/filepath"
"time"
corev1 "k8s.io/api/core/v1"
@unstppbl
unstppbl / go_time_parsing.md
Last active September 23, 2024 07:10
Parsing custom time layout in Golang

There are some key values that the time.Parse is looking for.

By changing:

test, err := time.Parse("10/15/1983", "10/15/1983")

to

@cbess
cbess / mysql-sp.md
Last active November 13, 2025 18:29
mysql stored procedure call from golang

A stored procedure that saves (insert/update) a URL, then returns the id for the record.

Works in Go v1.11.6+ and MySQL 5.7+.

DELIMITER ;;

CREATE DEFINER=`root`@`%` PROCEDURE SaveUrl(
    IN p_url varchar(8200),
    IN p_title text
@mrcrilly
mrcrilly / gin_jwt_middleware.go
Last active July 3, 2025 09:40
Gin JWT Middleware (Example)
package main
import (
"errors"
"net/http"
"strconv"
"strings"
"time"
"github.com/dgrijalva/jwt-go"
@heathermiller
heathermiller / scala-cheatsheet.md
Last active March 11, 2026 23:15
Scala Cheatsheet

This cheat sheet originated from the forum, credits to Laurent Poulain. We copied it and changed or added a few things.

Evaluation Rules

  • Call by value: evaluates the function arguments before calling the function
  • Call by name: evaluates the function first, and then evaluates the arguments if need be
    def example = 2      // evaluated when called
    val example = 2      // evaluated immediately
@finalfantasia
finalfantasia / improving_text_antialiasing_and_gui_performance_in_intellij_idea_on_openjdk_8.md
Last active May 5, 2025 21:11
Improving Text Anti-aliasing and GUI Performance in IntelliJ IDEA on OpenJDK 8

This is a list of tweaks to make IntelliJ IDEA work better with OpenJDK 8. Refer to System Properties for Java 2D Technology for the details of the options used below.

Note that the performance boost achieved via the OpenGL-based hardware acceleration pipeline is made possible by using the open-source Radeon driver (for AMD graphics cards) included in the latest stable version (10.3.3 as of now) of the Mesa 3D Graphics Library available in the official Fedora 21 stable repository. Therefore, the gained performance boost might vary based on the types of graphics cards and the versions of the drivers used in your system.

  1. Fixing Text Anti-aliasing in Fedora (Ubuntu users may skip this step.)
  2. Fixing text anti-aliasing in IntelliJ IDEA

In $IDEA_HOME/bin/idea64.vmoptions (or $IDEA_HOME/bin/idea.vmoptions on a x86 architecture), change

@tsenart
tsenart / gist:5fc18c659814c078378d
Last active February 25, 2026 11:21
HTTP Closures
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)