Skip to content

Instantly share code, notes, and snippets.

View Grohden's full-sized avatar
:shipit:
*tec tec tec noises*

Gabriel Rohden Grohden

:shipit:
*tec tec tec noises*
View GitHub Profile
@takanuva
takanuva / agt.h
Last active July 25, 2022 19:57
Simple generic print() and scan() macros
/*******************************************************************************
* Copyright 2022 Paulo Torrens *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy *
* of this software and associated documentation files (the "Software"), to *
* deal in the Software without restriction, including without limitation the *
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or *
* sell copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
import qualified Data.Set as Set
fInput [] = []
fInput (_:b:c:others) =
(words b, c):fInput others
solve' _ target [] ans
| target /= [] = []
| otherwise = ans
solve' dict target (p:ps) ans =
@sibelius
sibelius / useEventEmitter.tsx
Created April 16, 2019 01:20
UseEventEmitter hook to work with react navigation navigationOptions buttons
import { useEffect, useRef } from 'react';
export const useEventEmitter = (eventEmitter, eventName: string, fn: () => void) => {
const subscription = useRef(null);
useEffect(() => {
subscription.current = eventEmitter.addListener(eventName, fn);
return () => {
if (subscription.current) {
@Taneb
Taneb / Bogosort.hs
Created February 24, 2019 00:02
Bogosort and Bogobogosort in Haskell
module Bogosort where
import Control.Monad.Primitive
import Control.Monad.ST
import Control.Monad.ST.Unsafe
import Control.Monad.Trans.State.Strict
import Data.Monoid
import qualified Data.Vector as V
import qualified Data.Vector.Generic.Mutable as VGM
import Data.Vector.Generic.Mutable (MVector)
@miguelmota
miguelmota / faketime_install.sh
Created June 22, 2018 23:12
macOS faketime brew install
brew install libfaketime --build-from-source
# usage
faketime -f "@2020-01-01 00:00:00" node app.js
@kilink
kilink / OkHttpCompletableFuture.kt
Created February 11, 2017 07:26
OkHttp Java 8 CompletableFuture extension method
import okhttp3.Call
import okhttp3.Callback
import okhttp3.Response
import java.io.IOException
import java.util.concurrent.CompletableFuture
fun Call.executeAsync(): CompletableFuture<Response> {
val future = CompletableFuture<Response>()
enqueue(object : Callback {
override fun onResponse(call: Call, response: Response) {
function transformOrigin(matrix, origin) {
const { x, y, z } = origin;
const translate = MatrixMath.createIdentityMatrix();
MatrixMath.reuseTranslate3dCommand(translate, x, y, z);
MatrixMath.multiplyInto(matrix, translate, matrix);
const untranslate = MatrixMath.createIdentityMatrix();
MatrixMath.reuseTranslate3dCommand(untranslate, -x, -y, -z);
MatrixMath.multiplyInto(matrix, matrix, untranslate);
@lopes
lopes / aes-cbc.py
Last active March 21, 2024 04:22
Simple Python example of AES in CBC mode.
#!/usr/bin/env python3
#
# This is a simple script to encrypt a message using AES
# with CBC mode in Python 3.
# Before running it, you must install pycryptodome:
#
# $ python -m pip install PyCryptodome
#
# Author.: José Lopes
# Date...: 2019-06-14
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing