Skip to content

Instantly share code, notes, and snippets.

@enricofoltran
enricofoltran / main.go
Last active Aug 8, 2022
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
View main.go
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@raineorshine
raineorshine / sendRawTransaction.js
Last active Jul 9, 2022
Sends a raw transaction with web3 v1.2.2, ethereumjs-tx v2.1.1, and Infura
View sendRawTransaction.js
const Web3 = require('web3')
const Tx = require('ethereumjs-tx').Transaction
// connect to Infura node
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/INFURA_KEY'))
// the address that will send the test transaction
const addressFrom = '0x1889EF49cDBaad420EB4D6f04066CA4093088Bbd'
const privateKey = new Buffer('PRIVATE_KEY', 'hex')
@thomasdarimont
thomasdarimont / KeycloakClientAuthExample.java
Last active Feb 17, 2022
Retrieve and verify AccessToken with Keycloak Client.
View KeycloakClientAuthExample.java
package de.tdlabs.keycloak.client;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.keycloak.OAuth2Constants;
import org.keycloak.RSATokenVerifier;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.KeycloakBuilder;
import org.keycloak.common.VerificationException;
import org.keycloak.jose.jws.JWSHeader;
import org.keycloak.representations.AccessToken;
View AudioManager.cs
using System;
using System.Runtime.InteropServices;
// ReSharper disable SuspiciousTypeConversion.Global
// ReSharper disable InconsistentNaming
namespace VideoPlayerController
{
/// <summary>
/// Controls audio using the Windows CoreAudio API
/// from: http://stackoverflow.com/questions/14306048/controling-volume-mixer
@denji
denji / golang-tls.md
Last active Aug 10, 2022 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples
View golang-tls.md

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)
@yosssi
yosssi / go-nginx.md
Last active Jul 23, 2022
Go networking performance vs Nginx
View go-nginx.md

1. Nginx

$ wrk -t12 -c400 -d2s http://127.0.0.1:8080
Running 2s test @ http://127.0.0.1:8080
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     7.71ms    3.16ms  23.05ms   69.17%
    Req/Sec     3.44k     1.98k    7.80k    58.22%
  63697 requests in 2.00s, 17.86MB read
@dlivingstone
dlivingstone / main.cpp
Created Nov 7, 2011
OpenGL with GLM & SDL: A simple program to demonstrate modern OpenGL programming (compatible with OpenGL 3.0 and later) CC-BY-SA Daniel Livingstone
View main.cpp
#include <iostream>
#include <fstream>
// Windows specific: Uncomment the following line to open a console window for debug output
#if _DEBUG
#pragma comment(linker, "/subsystem:\"console\" /entry:\"WinMainCRTStartup\"")
#endif
// Simple OpenGL GLM/SDL demo
// Renders a rotating pyramid, showing 3 of 4 sides (allowing back faces to be seen)