Skip to content

Instantly share code, notes, and snippets.

Josmar Dias josmardias

Block or report user

Report or block josmardias

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View iterWrap.js
(async () => {
// logs to just to make sure that stuff is really asynchronous
// setInterval(() => console.log('--'), 200)
function iterWrap(iter) {
return {
take: (n = 100) => {
function* limitedGenerator() {
for(let i = 0; i < n; i++) {
@josmardias
josmardias / setTimeout-nashorn.js
Last active Mar 1, 2019 — forked from salomvary/settimeout-nashorn.js
setTimeout polyfill for Nashorn
View setTimeout-nashorn.js
// https://gist.github.com/josmardias/20493bd205e24e31c0a406472330515a
// at least one timeout needs to be set, larger then your code bootstrap
// or Nashorn will run forever
// preferably, put a timeout 0 after your code bootstrap
(function(context) {
'use strict';
var Timer = Java.type('java.util.Timer');
var Phaser = Java.type('java.util.concurrent.Phaser');
@josmardias
josmardias / create_postgres_docker.sh
Last active Aug 29, 2015
create postgres docker container
View create_postgres_docker.sh
#!/usr/bin/env bash
VOLUME_NAME="test-postgres-data"
CONTAINER_NAME="test-postgres9.4"
PGPASSWORD="password"
DATABASE="test"
(
echo -e "\ncreating persistent volume...\n";
docker create -v /var/lib/postgresql/data --name $VOLUME_NAME busybox
@josmardias
josmardias / .bashrc
Last active Aug 29, 2015
Prevent multiple entries on ~/.bashrc
View .bashrc
# fix multiple entries when .bashrc is sourced multiple times
if [ -z "$ORIGINAL_PATH" ]; then
export ORIGINAL_PATH="$PATH"
fi
if [ -z "$ORIGINAL_MANPATH" ]; then
export ORIGINAL_MANPATH="$MANPATH"
fi
if [ -z "$ORIGINAL_INFOPATH" ]; then
export ORIGINAL_INFOPATH="$INFOPATH"
fi
@josmardias
josmardias / classes_howto.js
Last active Aug 29, 2015
How to create objects from the same "class" in javascript.
View classes_howto.js
console.log("----------------------------------------------------------");
console.log("-- first of all, in JS, functions can be used as is, or called from objects");
var myf = function () {
return 1;
};
// as function
console.log(myf());
//as object method
@josmardias
josmardias / odeskteam Fedora 20
Last active Jan 3, 2016
How to install odeskteam in Fedora 20
View odeskteam Fedora 20
1) Install ATrpms repository (http://atrpms.net/)
sudo rpm --import http://packages.atrpms.net/RPM-GPG-KEY.atrpms
echo '
[atrpms]
name=Fedora Core $releasever - $basearch - ATrpms
baseurl=http://dl.atrpms.net/f$releasever-$basearch/atrpms/stable
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
gpgcheck=1' | sudo tee /etc/yum.repos.d/atrpms.repo
View gist:6029662
$ curl -L http://bootstrap.saltstack.org | sudo sh -s -- -D -M -N git v0.15.3
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 256 100 256 0 0 288 0 --:--:-- --:--:-- --:--:-- 1273
0 256 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0 * INFO: PIPED THROUGH sh -- Version 1.5.5
* INFO: System Information:
* INFO: CPU: GenuineIntel
* INFO: CPU Arch: x86_64
* INFO: OS Name: Linux
You can’t perform that action at this time.