Skip to content

Instantly share code, notes, and snippets.

@awerlang
awerlang / event-emitter.js
Created December 13, 2016 23:43
sample event emitter / observable
require('symbol-observable')
var $$observable = Symbol.observable
var rxjs = require("rxjs")
var Observable = rxjs.Observable
var Subject = rxjs.Subject
var o = new Subject()
var EventEmitter = class {
next(item) {
if (typeof this.observer === 'function') {
// from: https://github.com/devongovett/pdfkit/issues/29#issuecomment-103121102
/**
* Parses an input String with the help of the "marked"-package and writes the corresponding elements to the supplied document
* @param doc - the PDFDocument to write to
* @param input - the input String
* @returns {object} - the document for chaining
*/
PDFDocument.parseMarkdown = function (doc, input){
// Array of markdown parts as objects
@awerlang
awerlang / no-obj.js
Created December 6, 2017 14:56
memory leaks - #nodejspoa
// não precisa de um objeto ou estado a ser guardado
(function () {
function callMeMaybe() {
setTimeout(() => {
console.log('Node.js POA @ Umbler ' + x);
callMeMaybe();
}, 1000);
}
callMeMaybe();
@awerlang
awerlang / Dockerfile
Created December 21, 2017 16:04
Export git repo and build for Docker
FROM rust:1.22.1
WORKDIR /usr/src
RUN git clone --branch 2.9.4 https://github.com/pornel/dssim.git
WORKDIR /usr/src/dssim
RUN cargo build --release
ENTRYPOINT [ "/usr/src/dssim/target/release/dssim" ]
@awerlang
awerlang / lambda.js
Created April 7, 2018 18:18
aws lambda node.js
'use strict';
var net = require('net');
var repl = require('repl');
var util = require('util');
var awslambda = require('./build/Release/awslambda');
const BASE_CONTEXT = Object.freeze({
logGroupName : process.env['AWS_LAMBDA_LOG_GROUP_NAME'],
logStreamName : process.env['AWS_LAMBDA_LOG_STREAM_NAME'],
functionName : process.env['AWS_LAMBDA_FUNCTION_NAME'],
@awerlang
awerlang / config.md
Created January 15, 2020 19:21 — forked from 0XDE57/config.md
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable.

I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".

@awerlang
awerlang / bash-cheatsheet.sh
Created March 30, 2020 21:55 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@awerlang
awerlang / README
Last active June 24, 2024 15:50
A zypper wrapper that maximizes network throughput
zypper-download
===============
Downloads packages using any amount of available openSUSE mirrors.
Installation
------------
Copy both files to the following locations:
@awerlang
awerlang / clientrc.example
Last active May 14, 2020 22:34 — forked from streetturtle/sp
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
# copy to ~/.config/spotify/clientrc and fill these settings
# generate from https://developer.spotify.com/dashboard/applications
SP_CLIENT_ID=""
SP_CLIENT_SECRET=""
@awerlang
awerlang / bwrap-sample
Created May 18, 2020 03:20
Sample bubblewrap script
#!/usr/bin/env bash
# Use bubblewrap to run /bin/sh reusing the host OS binaries (/usr), but with
# separate /tmp, /home, /var, /run, and /etc. For /etc we just inherit the
# host's resolv.conf, and set up "stub" passwd/group files. Not sharing
# /home for example is intentional. If you wanted to, you could design
# a bwrap-using program that shared individual parts of /home, perhaps
# public content.
#
# Another way to build on this example is to remove --share-net to disable
# networking.