Skip to content

Instantly share code, notes, and snippets.

View jim3ma's full-sized avatar
🎯
Focusing

Jim Ma jim3ma

🎯
Focusing
View GitHub Profile
@denji
denji / golang-tls.md
Last active May 18, 2024 16:33 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@joyrexus
joyrexus / README.md
Last active January 20, 2024 22:01
nested templates in go

Example of nested templates.

Given this file layout ...

.
├── server.go
└── templates
    ├── profiles.html
    └── layout.html
@thbkrkr
thbkrkr / gen-ssl.sh
Created April 7, 2015 16:15
Generate Self-Signed SSL Certificate without prompt
# Generate a passphrase
openssl rand -base64 48 > passphrase.txt
# Generate a Private Key
openssl genrsa -aes128 -passout file:passphrase.txt -out server.key 2048
# Generate a CSR (Certificate Signing Request)
openssl req -new -passin file:passphrase.txt -key server.key -out server.csr \
-subj "/C=FR/O=krkr/OU=Domain Control Validated/CN=*.krkr.io"
@RichardWithnell
RichardWithnell / RPi
Last active August 2, 2017 20:56
MPTCP Raspberry Pi
git clone http://github.com/richardwithnell/mptcp-rpi
make mrproper
# 64 Bit
# export CCPREFIX=/home/richard/Software/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
# 32 Bit
export CCPREFIX=/home/richard/Software/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-
make ARCH=arm CROSS_COMPILE=$CCPREFIX bcmrpi_defconfig
make ARCH=arm CROSS_COMPILE=$CCPREFIX menuconfig
make -j3 ARCH=arm CROSS_COMPILE=$CCPREFIX
@xjamundx
xjamundx / blog-webpack-2.md
Last active April 21, 2024 16:20
From Require.js to Webpack - Part 2 (the how)

This is the follow up to a post I wrote recently called From Require.js to Webpack - Party 1 (the why) which was published in my personal blog.

In that post I talked about 3 main reasons for moving from require.js to webpack:

  1. Common JS support
  2. NPM support
  3. a healthy loader/plugin ecosystem.

Here I'll instead talk about some of the technical challenges that we faced during the migration. Despite the clear benefits in developer experience (DX) the setup was fairly difficult and I'd like to cover some of the challanges we faced to make the transition a bit easier.

@nerdalert
nerdalert / Netfilter-IPTables-Diagrams.md
Last active May 20, 2024 20:38
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.

@kokjo
kokjo / sendfd.c
Last active April 16, 2024 10:27
Send a file descriptor over an abstract unix domain socket
// compile with: gcc -static -o sendfd sendfd.c
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <strings.h>
int send_fd(int sock, int fd){
// This function does the arcane magic for sending
// file descriptors over unix domain sockets
struct msghdr msg;
@felipou
felipou / retry.sh
Last active March 26, 2024 16:41
Retry command
#!/bin/bash
#
# Created by Felipe Machado - 2016/02/14
#
# A retry command for bash
# Retries the given command up to MAX_RETRIES, with an interval of SLEEP_TIME
# between each retry. Just put it on your bash_profile and be happy :)
# Usage:
# retry [-s SLEEP_TIME] [-m MAX_RETRIES] COMMAND_WITH_ARGUMENTS
#
@jim3ma
jim3ma / starttls_smtp_example.go
Last active March 28, 2024 20:04 — forked from chrisgillis/ssl_smtp_example.go
Golang StartTLS SMTP Example
package main
import (
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"crypto/tls"
)
@Brainiarc7
Brainiarc7 / VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
Last active March 26, 2024 18:18
This gist contains instructions on setting up FFmpeg and Libav to use VAAPI-based hardware accelerated encoding (on supported platforms) for H.264 (and H.265 on supported hardware) video formats.

Using VAAPI's hardware accelerated video encoding on Linux with Intel's hardware on FFmpeg and libav

Hello, brethren :-)

As it turns out, the current version of FFmpeg (version 3.1 released earlier today) and libav (master branch) supports full H.264 and HEVC encode in VAAPI on supported hardware that works reliably well to be termed "production-ready".