Skip to content

Instantly share code, notes, and snippets.

Avatar

Henrique Carvalho Alves hcarvalhoalves

View GitHub Profile
@leonklingele
leonklingele / client.sh
Last active Mar 29, 2021
netcat – encrypt transfer with openssl
View client.sh
IP="127.0.0.1"
PORT="8877"
SHARED_SECRET="shared secret"
OPENSSL="/usr/local/opt/libressl/bin/openssl"
OPENSSL_CMD="$OPENSSL enc -a -A -aes-256-gcm"
while IFS= read -r MSG; do
echo "$MSG" | $OPENSSL_CMD -e -k "$SHARED_SECRET"
echo
@timothypratley
timothypratley / forshame.md
Last active May 13, 2019
Error reporting in Clojure are the worst, no error reporting in ClojureScript is the worst.
View forshame.md

For Shame!

Clojure error reporting is a problem. This gist contains examples of missed opportunities for a clear error message. Let's discuss how common scenarios can be improved, and get some "patch welcome" tickets out there with clearly defined expectations.

The problem

@viperscape
viperscape / core.clj
Created Sep 3, 2014
async chans and kuroshio streams
View core.clj
(ns chan-test.core
(:gen-class)
(:require [clojure.core.async :as async]
[kuroshio.core :as k]))
(defn create-string []
(apply str (take 10000 (repeat ".\r\n"))))
(defn println-err [& args]
(binding [*out* *err*]
@alanhamlett
alanhamlett / api.py
Last active Apr 13, 2021
Serialize SQLAlchemy Model to dictionary (for JSON output) and update Model from dictionary attributes.
View api.py
import uuid
import wtforms_json
from sqlalchemy import not_
from sqlalchemy.dialects.postgresql import UUID
from wtforms import Form
from wtforms.fields import FormField, FieldList
from wtforms.validators import Length
from flask import current_app as app
from flask import request, json, jsonify, abort
@pauloborges
pauloborges / decorators.py
Last active Dec 10, 2015
@facebook_required decorator
View decorators.py
#coding: utf-8
from functools import wraps
from django.conf import settings
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.utils.decorators import available_attrs
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.views import redirect_to_login
from django.contrib.auth.decorators import login_required
from facepy import GraphAPI