Skip to content

Instantly share code, notes, and snippets.

View xhit's full-sized avatar

Santiago De la Cruz xhit

View GitHub Profile
@xhit
xhit / uuidv7.php
Last active June 26, 2024 23:28
UUIDv7 in PHP
<?php
// uuidv7 see https://www.rfc-editor.org/rfc/rfc9562#name-uuid-version-7
function uuidv7() {
// current timestamp in ms
$timestamp = intval(microtime(true) * 1000);
return sprintf(
'%02x%02x%02x%02x-%02x%02x-%04x-%04x-%012x',
// first 48 bits are timestamp based
@xhit
xhit / reader.go
Last active June 26, 2024 13:48
Golang read csv with custom enclosure (modified reader.go in Go 1.13.5)
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package csv reads and writes comma-separated values (CSV) files.
// There are many kinds of CSV files; this package supports the format
// described in RFC 4180.
//
// A csv file contains zero or more records of one or more fields per record.
// Each record is separated by the newline character. The final record may
@ecoshub
ecoshub / IntToByteArray.go
Last active May 9, 2024 06:17
golang integer to byte array and byte array to integer function
package main
import (
"fmt"
"unsafe"
)
func main(){
// integer for convert
num := int64(1354321354812)
@miguelmota
miguelmota / crypto.go
Last active June 5, 2024 14:28
Golang SHA256 hash example
package crypto
import (
"crypto/sha256"
)
// NewSHA256 ...
func NewSHA256(data []byte) []byte {
hash := sha256.Sum256(data)
return hash[:]
@branflake2267
branflake2267 / main.dart
Created April 16, 2018 01:18
Flutter - Using the Refresh Indicator
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
@asukakenji
asukakenji / 0-go-os-arch.md
Last active July 2, 2024 13:30
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@Rajeshr34
Rajeshr34 / wkhtmltopdf.sh
Last active May 29, 2024 08:44
Wkhtmltopdf With Patched QT Setup Ubuntu 16+
cd ~
apt-get install libfontenc1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y
#https://github.com/wkhtmltopdf/wkhtmltopdf/releases
#replace arch
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
apt --fix-broken install
@alexcasalboni
alexcasalboni / amazon-rekognition.md
Last active September 6, 2023 15:20
Amazon Rekognition - Python Code Samples

Amazon Rekognition - Python Code Samples

  1. Labels Detection
  2. Faces Detection
  3. Faces Comparison
  4. Faces Indexing
  5. Faces Search
@ammario
ammario / goth
Created September 2, 2016 16:27
golang test coverage html
#!/bin/bash
go test -coverprofile=coverage.out
go tool cover -html=coverage.out
@sdorra
sdorra / keys.go
Created April 17, 2016 19:31
Golang RSA Key Generation
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"