Skip to content

Instantly share code, notes, and snippets.


José Aguirre josejaguirre

View GitHub Profile
tomsihap / gist:e703b9b063ecc101f5a4fc0b01a514c9
Created Dec 23, 2018
Install NVM in Ubuntu 18.04 with ZSH
View gist:e703b9b063ecc101f5a4fc0b01a514c9
# Find the latest version on
$ curl -o- | bash
# Add in your ~/.zshrc the following:
export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/" ] && . "$NVM_DIR/"
$ source ~/.zshrc
samanshahmohamadi / sawtooth-default-multi.yaml
Created Oct 16, 2018
Hyperledger Sawtooth configuration to setup a network with multiple validators.
View sawtooth-default-multi.yaml
# Copyright 2017 Intel Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# -*- coding: utf-8 -*-
# /var/runtime/awslambda/
Amazon Lambda
Copyright (c) 2013 Amazon. All rights reserved.
Lambda runtime implemention
nakov / secp256k1-example.js
Last active Jul 18, 2022
ECDSA in JavaScript: secp256k1-based sign / verify / recoverPubKey
View secp256k1-example.js
let elliptic = require('elliptic');
let sha3 = require('js-sha3');
let ec = new'secp256k1');
// let keyPair = ec.genKeyPair();
let keyPair = ec.keyFromPrivate("97ddae0f3a25b92268175400149d65d6887b9cefaf28ea2c078e05cdc15a3c0a");
let privKey = keyPair.getPrivate("hex");
let pubKey = keyPair.getPublic();
console.log(`Private key: ${privKey}`);
console.log("Public key :", pubKey.encode("hex").substr(2));
althonos / setup.cfg
Last active Jul 18, 2022
A `setup.cfg` template for my Python projects
View setup.cfg
name = {name}
version = file: {name}/_version.txt
author = Martin Larralde
author_email =
url ={name}
description = {description}
long_description = file:
rluts /
Last active Jul 11, 2022
Token authorization middleware for Django Channels 2
from channels.auth import AuthMiddlewareStack
from rest_framework.authtoken.models import Token
from django.contrib.auth.models import AnonymousUser
from django.db import close_old_connections
class TokenAuthMiddleware:
Token authorization middleware for Django Channels 2

Font Face

A mixin for writing @font-face rules in SASS.


Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
n1ru4l / index.js
Created Aug 7, 2017
Fetch blob and convert to base64
View index.js
export const fetchAsBlob = url => fetch(url)
.then(response => response.blob());
export const convertBlobToBase64 = blob => new Promise((resolve, reject) => {
const reader = new FileReader;
reader.onerror = reject;
reader.onload = () => {
codephillip /
Created Aug 2, 2017
ListCreateAPIView in django rest framework with different serializer for the GET and POST
from rest_framework import generics, status
from rest_framework.response import Response
from rack.models import RackItem
from rack.serializers import RackItemSerializer, NewRackItemSerializer
class ListCreateRackItem(generics.ListCreateAPIView):
model = RackItem
davidwhitman / Preferences.kt
Last active Jul 21, 2022
Android SharedPreferences helper class for Kotlin. Easy-to-use delegated properties, automatic database creation, and listening for property changes.
View Preferences.kt
import android.content.Context
import android.content.SharedPreferences
import kotlin.reflect.KProperty
* Represents a single [SharedPreferences] file.
* Usage:
* ```kotlin