Skip to content

Instantly share code, notes, and snippets.

View junosuarez's full-sized avatar
💭
hi hello

juno suárez junosuarez

💭
hi hello
View GitHub Profile
@kennwhite
kennwhite / Enable sudo TouchID.md
Last active May 16, 2023 11:37
How to run a macOS app as admin using TouchID/password dialog box.

(This isn't specific to Wireshark)

sudo vi /etc/pam.d/sudo

Add to the end BEGINNING of the file:

auth sufficient pam_tid.so

Test with a trivial sudo command, and you should get a TouchID prompt:

@brycebaril
brycebaril / output.md
Last active February 23, 2020 22:35
process.nextTick vs setImmediate

@mafintosh asks: "Does anyone have a good code example of when to use setImmediate instead of nextTick?"

https://twitter.com/mafintosh/status/624590818125352960

The answer is "generally anywhere outside of core".

process.nextTick is barely asynchronous. Flow-wise it is asynchronous, but it will trigger before any other asynchronous events can (timers, io, etc.) and thus can starve the event loop.

In this script I show a starved event loop where I just synchronously block, use nextTick and setImmediate

@beaugunderson
beaugunderson / cool-modules.md
Last active February 2, 2023 19:58
cool modules from nodeconf

from streams session

  • end-of-stream - specify a callback to be called when a stream ends (which is surpsingly hard to get right)
  • duplexify - compose a Duplex stream from a Readable and a Writable stream
  • pump - pipe streams together and close all of them if one of them closes
  • pumpify - combine an array of streams into a single duplex stream using pump and duplexify
  • through2 - tools for making Transform streams
  • from2 - tools for making Readable streams

from "participatory modules" session

@pcreux
pcreux / pipable.rb
Last active June 12, 2018 17:08
*nix has pipes, Elixir has pipes, Ruby deserves pipes.
# Elixir has pipes `|>`. Let's try to implement those in Ruby.
#
# I want to write this:
#
# email.body | RemoveSignature | HighlightMentions | :html_safe
#
# instead of:
#
# HighlightMentions.call(RemoveSignature.call(email.body)).html_safe
#
@sindresorhus
sindresorhus / np.sh
Last active December 11, 2022 21:26
shell function for publishing node modules with some goodies
# npm publish with goodies
# prerequisite: `npm install -g trash`
# `np` with an optional argument `patch`/`minor`/`major`/`<version>`
# defaults to `patch`
np() {
trash node_modules &>/dev/null;
git pull --rebase &&
npm install &&
npm test &&
npm version ${1:-patch} &&
@othiym23
othiym23 / yay-area-node-meetup-proposal.md
Last active December 28, 2015 06:09
How make better Bay Area Node meetups?

Goals

  1. Capture some of the benefit of NodeConf, JSConf or RealTimeConf on a sustainable, regular basis.
  2. Get enough of a quorum of Bay Area Node.js leadership involved to appeal to other people to attend and get involved themselves. This includes not just visible leadership, but valuable less-visible contributors like jlord, Dave Pacheco, Emily Tanaka-Delgado, and Daniel Erickson.
  3. Provide an in-person forum to work through Node issues and improve and broaden the community.
  4. Foster broader leadership by getting more people more involved.
  5. Spread the organizational load among a wider crew of people so no one individual gets burnt out, more people get experience with running events, and we all are able to have fun.
  6. If there is to be a bias when making speaker selections, have it be towards bringing in new speakers and creating a safe space for speakers to present new material.
  7. Keep it fast-moving, entertaining, and concise -- have 2-hour (tops) meetups and then allow people to do social s
@yocontra
yocontra / CommandEncoder.java
Created September 23, 2013 22:50
Command Encoder for Brookstone Rover 2.0 TCP Protocol
package com.wificar.component;
import android.util.Log;
import com.wificar.WificarActivity;
import com.wificar.util.BlowFish;
import com.wificar.util.ByteUtility;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.http.util.ByteArrayBuffer;
@igrigorik
igrigorik / github.bash
Last active December 22, 2023 23:55
Open GitHub URL for current directory/repo...
alias gh="open \`git remote -v | grep git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"
;; based on http://talks.golang.org/2012/concurrency.slide#50
(ns robpike
(:require [cljs.core.async :as async :refer [<! >! chan close!]])
(:require-macros [cljs.core.async.macros :as m :refer [go alt!]]))
(defn timeout [ms]
(let [c (chan)]
(js/setTimeout (fn [] (close! c)) ms)
c))
@dominictarr
dominictarr / level-atomic-data.js
Last active December 17, 2015 05:39
level-atomic-data
//datomic clone
var log = db.sublevel('log')
var audit = db.sublevel('audit')
//var sha1sum = require('sha1sum')
//initialize current sha
db.pre(function (op, add) {
var ts = timestamp() //or get timestamp from a transactor service
//save this value at this timestamp.
add({