Skip to content

Instantly share code, notes, and snippets.

@formatcom
formatcom / client.go
Created Mar 1, 2020 — forked from xjdrew/client.go
golang tls client and server, require and verify certificate in double direction
View client.go
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io"
"io/ioutil"
"log"
"os"
View test python
# Esta parte hace esto
lookup = '__'.join(['name', 'isnull']) # name__isnull simplemente construye este string
# Esto ni lo explico .i.
def test(name__isnull, name):
print('arg:', str(name__isnull))
print('name:', name)
print('lookup:', lookup)
@formatcom
formatcom / aes256-gcm.go
Created Feb 2, 2018 — forked from kkirsche/aes256-gcm.go
AES-256 GCM Encryption Example in Golang
View aes256-gcm.go
package example_test
import (
"crypto/aes"
"crypto/cipher"
"hex"
"io"
)
// AES-GCM should be used because the operation is an authenticated encryption
@formatcom
formatcom / rand.go
Created Feb 2, 2018
golang rand binary
View rand.go
package main
import (
"crypto/rand"
"io"
"bytes"
"bufio"
"fmt"
)
@formatcom
formatcom / extract_emails_from_text.py
Created Dec 18, 2017 — forked from dideler/example.md
A python script for extracting email addresses from text files. You can pass it multiple files. It prints the email addresses to stdout, one address per line. For ease of use, remove the .py extension and place it in your $PATH (e.g. /usr/local/bin/) to run it like a built-in command.
View extract_emails_from_text.py
#!/usr/bin/env python
#
# Extracts email addresses from one or more plain text files.
#
# Notes:
# - Does not save to file (pipe the output to a file if you want it saved).
# - Does not check for duplicates (which can easily be done in the terminal).
#
# (c) 2013 Dennis Ideler <ideler.dennis@gmail.com>
@formatcom
formatcom / Operaciones-Git
Last active Aug 28, 2015 — forked from jelcaf/Operaciones-Git
Git Tips - Mini-trucos de Git para facilitarme la tarea
View Operaciones-Git
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas
@formatcom
formatcom / local-storage-size.js
Last active Aug 29, 2015 — forked from cdmckay/local-storage-size.js
Detects the size of the browser's localStorage
View local-storage-size.js
if (localStorage && !localStorage.getItem('size')) {
var i = 0;
try {
// Test up to 10 MB
for (i = 250; i <= 10000; i += 250) {
localStorage.setItem('test', new Array((i * 1024) + 1).join('a'));
}
} catch (e) {
localStorage.removeItem('test');
localStorage.setItem('size', i - 250);
View preload-images.htm
<!doctype html>
<html ng-app="Demo">
<head>
<meta charset="utf-8" />
<title>
Preloading Images In AngularJS With Promises
</title>
</head>
<body ng-controller="AppController">