Skip to content

Instantly share code, notes, and snippets.

View jeffotoni's full-sized avatar

Jefferson Otoni Lima jeffotoni

View GitHub Profile
package main
import (
"fmt"
"log"
"net/http"
)
func Hello(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
dockerfile ◀◀ buffers
# Start by building the application.
FROM golang:1.10 as build
WORKDIR /go/src/app
// exemplo mapa generico
package main
import (
"fmt"
"reflect"
)
func main() {
@jeffotoni
jeffotoni / js-crypt-descript.js
Last active July 14, 2018 12:28
keygen/encrypt/decrypt using symmetric encryption with AES
// Resources:
// https://github.com/diafygi/webcrypto-examples
// https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey
// http://blog.engelke.com/tag/webcrypto/
// Tested in Firefox
function ArrayToBuffer(str) {
var buf = new ArrayBuffer(str.length * 2);
var bufView = new Uint16Array(buf);
for (var i = 0, strLen = str.length; i < strLen; i++) {
/**
* @autor jeffotoni@gmail.com
*/
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
int main()
{
<input type='file' accept='*' onchange='openFile(event)'><br>
<textarea id='output' rows=9 cols=35></textarea>
<script>
var openFile = function(event) {
var output = document.getElementById('output');
var input = event.target;
@petermuller71
petermuller71 / cryptor.php
Last active July 23, 2023 16:41
cryptor : PHP Encryption and decryption based on libsodium (standard lib >php7.2)
<?php
print "<h1>PHP Encryption with libsodium</h1>";
$message = "This text is secret";
$ciphertext = cryptor::encrypt("password", $message);
$plaintext = cryptor::decrypt("password", $ciphertext);
print "Message:<br />$message <br /><br />Ciphertext:<br />$ciphertext<br /><br />Plaintext:<br />$plaintext";
@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
@reagent
reagent / 00_README.md
Last active January 29, 2024 13:31
Custom HTTP Routing in Go

Custom HTTP Routing in Go

Basic Routing

Responding to requests via simple route matching is built in to Go's net/http standard library package. Just register the path prefixes and callbacks you want invoked and then call the ListenAndServe to have the default request handler invoked on each request. For example:

package main

import (