Skip to content

Instantly share code, notes, and snippets.

View souenzzo's full-sized avatar
🚴‍♂️
💨 💨

Enzzo souenzzo

🚴‍♂️
💨 💨
View GitHub Profile
@thinkerbot
thinkerbot / public_enc_example.sh
Created November 19, 2010 04:56
Public-key encryption example using OpenSSL
#!/bin/bash
#
# Public-Key Encryption and Decryption
# * http://www.openssl.org/
# * http://barelyenough.org/blog/2008/04/fun-with-public-keys/
#
# Mac OS X 10.6.4
# OpenSSL 0.9.8l 5 Nov 2009
# Generate keys
@semperos
semperos / clojure-deftype-scaffolding.clj
Created October 4, 2012 18:16
Clojure Scaffolding for deftype (Christophe Grand) - Show which methods a class implements and for which interfaces
;; Big thanks to Christophe Grand - https://groups.google.com/d/msg/clojure/L1GiqSyQVVg/m-WJogaqU8sJ
(defn scaffold [iface]
(doseq [[iface methods] (->> iface .getMethods
(map #(vector (.getName (.getDeclaringClass %))
(symbol (.getName %))
(count (.getParameterTypes %))))
(group-by first))]
(println (str " " iface))
(doseq [[_ name argcount] methods]
(println
@creationix
creationix / jsonparse.js
Last active December 11, 2023 15:37
A streaming JSON parser as an embeddable state machine.
// A streaming byte oriented JSON parser. Feed it a single byte at a time and
// it will emit complete objects as it comes across them. Whitespace within and
// between objects is ignored. This means it can parse newline delimited JSON.
function jsonMachine(emit, next) {
next = next || $value;
return $value;
function $value(byte) {
if (!byte) return;
if (byte === 0x09 || byte === 0x0a || byte === 0x0d || byte === 0x20) {
@racerxdl
racerxdl / gps.py
Created May 19, 2014 02:29
Naza-M Lite GPS Interface
#!/usr/bin/env python
import serial
import struct
ser = serial.Serial("/dev/ttyUSB0", 115200, timeout=2)
msgid = {
0x10 : "GPS",
(require '[clojure.core.async :as a])
(def xform (comp (map inc)
(filter even?)
(dedupe)
(flatmap range)
(partition-all 3)
(partition-by #(< (apply + %) 7))
(flatmap flatten)
(random-sample 1.0)

Github Two-Factor Authentication (2FA) for Brazil via SMS

The Github doesn't provide country code for Brazil (+55). To add this option, just run the code below in your console. The option Brazil +55 will be the first on the list, already selected:


🇧🇷 [pt-BR]

Autenticação em dois fatores (2FA) do GitHub para o Brasil via SMS

@seantempesta
seantempesta / core.cljs
Created February 1, 2016 18:37
om-next + react-native
(ns mattsum.simple-example.core
(:require-macros [natal-shell.core :refer [with-error-view]]
[natal-shell.components :refer [view text image touchable-highlight]]
[natal-shell.alert :refer [alert]])
(:require [om.next :as om :refer-macros [defui]]))
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
(def app-registry
(.-AppRegistry js/React))
@Deraen
Deraen / spec-coercion.clj
Created June 14, 2016 15:47
Clojure.spec coercion test
(ns spec-test.core
(:require [clojure.spec :as s]))
(defn x-integer? [x]
(if (integer? x)
x
(if (string? x)
(try
(integer/parseint x)
(catch exception e
@zehnpaard
zehnpaard / figwheel-garden.core.cljs
Created November 22, 2016 08:34
Minimal setup to get lein-garden auto-compile and Figwheel auto-load working with Reagent
(ns figwheel-garden.core
(:require
[reagent.core :as r]))
(defn my-app []
[:div
[:h1 "Hello Reagent!"]
[:p "Hello Garden!"]
[:p.my-class "Hello My-Class!"]])
@halgari
halgari / gist:f431b2d1094e4ec1e933969969489854
Last active April 16, 2023 04:06
What I want from a Type System
The question was asked why I (as a programmer who prefers dynamic languages) don't consider static types "worth it". Here
is a short list of what I would need from a type system for it to be truely useful to me:
1) Full type inference. I would really prefer to be able to write:
(defn concat-names [person]
(assoc person :full-name (str (:first-name person)
(:second-name person))))
And have the compiler know that whatever type required and produced from this function was acceptible as long as the