Skip to content

Instantly share code, notes, and snippets.

View daluu's full-sized avatar

David Luu daluu

View GitHub Profile
@blochberger
blochberger / Info.plist
Last active January 14, 2024 14:12
macOS/iOS TLS 1.3 Support
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>www.howsmyssl.com</key>
<dict>
# Copyright 2019 Google LLC.
# SPDX-License-Identifier: Apache-2.0
# This snippet shows you how to use Blob.generate_signed_url() from within compute engine / cloud functions
# as described here: https://cloud.google.com/functions/docs/writing/http#uploading_files_via_cloud_storage
# (without needing access to a private key)
# Note: as described in that page, you need to run your function with a service account
# with the permission roles/iam.serviceAccountTokenCreator
import os, google.auth
from google.auth.transport import requests
import random, csv
from datetime import timedelta, datetime
from faker import Faker
from faker.providers import person
from faker.providers import internet
from faker.providers import ssn
from faker.providers import address
from faker.providers import job
from faker.providers import date_time
import random
from datetime import timedelta, datetime
from faker import Faker
from faker.providers import person
from faker.providers import internet
from faker.providers import ssn
from faker.providers import address
from faker.providers import job
from faker.providers import date_time
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mimoo
mimoo / compress_tar_gzip.go
Last active May 5, 2025 18:02
How to compress a folder in Golang using tar and gzip (works with nested folders)
package main
import (
"archive/tar"
"bytes"
"compress/gzip"
"fmt"
"io"
"os"
"path/filepath"
@quyenlv
quyenlv / remote-capture-packet-simple.rst
Last active March 20, 2025 08:52
Remote capturing packet with tcpdump and wireshark.

Topology

+------------------+                    +----------------------+
|   Local host     |  tcpdump over ssh  |    Remote Host       |
|                  |--------------------|                      |\ eth0
| +--------------+ |--------------------|                      |/
| |   Wireshark  | |                    |  tcpdump -i eth0...  |
@tsenart
tsenart / 00_go_output.txt
Last active October 31, 2018 03:21
Quantum effects
10/s: min: 454ns max: 5.341µs 0.50: 711ns 0.90: 1.042µs 0.95: 1.223µs 0.99: 4.173µs
50/s: min: 278ns max: 76.968µs 0.50: 768ns 0.90: 1.306µs 0.95: 2.956µs 0.99: 5.596µs
100/s: min: 193ns max: 41.241µs 0.50: 712ns 0.90: 1.136µs 0.95: 1.614µs 0.99: 4.393µs
500/s: min: 148ns max: 21.488µs 0.50: 721ns 0.90: 1.003µs 0.95: 1.086µs 0.99: 3.061µs
1000/s: min: 137ns max: 44.32µs 0.50: 735ns 0.90: 1.009µs 0.95: 1.069µs 0.99: 2.682µs
5000/s: min: 109ns max: 11.757µs 0.50: 348ns 0.90: 374ns 0.95: 398ns 0.99: 491ns
10000/s: min: 109ns max: 22.745µs 0.50: 348ns 0.90: 371ns 0.95: 384ns 0.99: 478ns
@fvigotti
fvigotti / purge_prom_pushgateway.sh
Created October 1, 2018 13:56
this is a sample script that clean old metrics from pushgateway, not very clean but working anyway, used as sample in a issue
trap 'echo "got sigterm" ; exit 0' SIGTERM
EXPIRATION_SECONDS=${EXPIRATION_SECONDS:-900}
PGW_URL=${PGW_URL:-http://pushgateway}
function convert_to_standardnotation(){
# convert number from scientific notation to standar d( ie '1.5383780136826127e+09' )
printf '%.0f' $1
}