Skip to content

Instantly share code, notes, and snippets.

@caiofilipini
caiofilipini / maxconn.go
Created November 15, 2019 21:08
Go (golang) HTTP server with a simple connection limiter (max conn)
package main
import (
"context"
"flag"
"log"
"net"
"net/http"
"os"
"os/signal"
select concat(
'mysqldump'
, ' --user=wcm_dwh'
, ' --password=wcm_dwh'
, ' --no-create-info'
, ' --where="'
, case p2.partition_method
when 'hash' then
concat(
p2.partition_expression, ' % '
@filipenf
filipenf / aws-s3-buckets-with-tags.sh
Created April 22, 2015 18:46
Print a list of aws buckets along with their tags
#!/bin/bash
# lists all buckets along with their tags in the following format:
# bucket_name | { tag_name: tag_value }
# depends on AWS CLI and JQ
for bucket in `aws s3api list-buckets | jq .Buckets[].Name | tr -d \"`; do
tags=$(aws s3api get-bucket-tagging --bucket $bucket | jq -c '.[][] | {(.Key): .Value}' | tr '\n' '\t')
echo $bucket '|' $tags
done
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active May 29, 2024 23:08
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@zaius
zaius / background.sh
Created January 16, 2011 23:29
How to redirect a running process output to a file and log out
ctrl-z
bg
touch /tmp/stdout
touch /tmp/stderr
gdb -p $!
# In GDB
p dup2(open("/tmp/stdout", 1), 1)
p dup2(open("/tmp/stderr", 1), 2)