Skip to content

Instantly share code, notes, and snippets.

View leodutra's full-sized avatar
🦙
Llama and other LLMs

Leo Dutra leodutra

🦙
Llama and other LLMs
View GitHub Profile
@max-mapper
max-mapper / readme.md
Last active August 29, 2015 14:07
Node >= 0.10 Streams2 protips

@mafintosh said most of this, I just wrote it down

how to destroy/end streams in node >= 0.10

  • usually you call .destroy() if it has .destroy
  • if it doesnt have .destroy you are out of luck and the stream should upgrade to use e.g. newer through2
  • in request you call .abort() (this should get fixed to use .destroy())
  • .end() tries to end the stream gracefully

what about close

@leodutra
leodutra / leftPad.js
Last active October 6, 2015 19:28
Very fast left pad, anything (JavaScript)
leftPad = function leftPad(value, size, pad) { // very very fast
if (value.length < size) {
size -= value.length;
var res = '';
for(;;) {
if (size & 1) res += pad;
size >>= 1;
if (size) pad += pad;
else break;
}
@leodutra
leodutra / CacheControlFilter.java
Last active November 8, 2015 14:13
Filtro para controle de cache de resources para Servlets 2.3+ (Websphere 5+)
/**/
package com.github.leodutra.filters;
import java.io.IOException;
import java.util.Date;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
@leodutra
leodutra / setup-git-login-pass-cache.sh
Last active April 22, 2016 20:03
Setup Git login, e-mail and password cache | sudo wget -q -O - https://gist.github.com/leodutra/ad82f4d9e86083b5901f/raw | sh -x -
#!/bin/sh
git config --global credential.helper 'cache --timeout=3600'
git config --global user.name "Leo Dutra"
git config --global user.email "leodutra.br@gmail.com"
echo 'git has been set for leodutra.br@gmail.com'
@aemkei
aemkei / LICENSE.txt
Created October 30, 2011 14:15 — forked from 140bytes/LICENSE.txt
hsl2rgb - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@leodutra
leodutra / mad-node-modules.md
Created January 27, 2017 03:34
Awesome and mad Node modules collection

peer-to-peer

  • peerwiki - all of wikipedia on bittorrent
  • simple-peer - send video/voice/data p2p in the browser (with webrtc)
  • torrent-docker - realtime boot of remote docker images over bittorrent
  • torrent-mount - mount a torrent as a filesystem
  • webtorrent - streaming torrent client for node & the browser

browserify

@gabrielmoreira
gabrielmoreira / plugins.js
Created January 24, 2012 18:28
POST: Sofrimento e aprendizado - Arquitetura de aplicações javascript
function Modal(target, options) {
this.target = target ;
this.options = options;
}
Modal.prototype.show = function() {
}
$.fn.modal = function(options) {
... // instanciar e armazenar o plugin --> new Modal($(this), options)
@import url(http://fonts.googleapis.com/css?family=Open+Sans:300,400,700);
$base-font-family: 'Open Sans', sans-serif;
$background-color: #fff;
@import 'media-queries';
// Set a rem font size with pixel fallback
@function calculate-rem($size) {
$rem-size: $size / 16px;
@return $rem-size * 1rem;
@brayoh
brayoh / ThinkAboutMonads.md
Created January 10, 2020 05:46 — forked from cscalfani/ThinkAboutMonads.md
How to think about monads

How to think about Monads

Initially, Monads are the biggest, scariest thing about Functional Programming and especially Haskell. I've used monads for quite some time now, but I didn't have a very good model for what they really are. I read Philip Wadler's paper Monads for functional programming and I still didnt quite see the pattern.

It wasn't until I read the blog post You Could Have Invented Monads! (And Maybe You Already Have.) that I started to see things more clearly.

This is a distillation of those works and most likely an oversimplification in an attempt to make things easier to understand. Nuance can come later. What we need when first learning something is a simple, if inaccurate, model.

This document assumes a beginner's knowledge of pure functional programming and Haskell with some brief encounters of Monads, e.g. [Functors, Applicatives, And

description "No-ip client"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
umask 022
expect fork