Skip to content

Instantly share code, notes, and snippets.

@phipex
phipex / install-docker.md
Created September 18, 2023 18:29 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@phipex
phipex / pg-cursor iterator example.js
Last active June 23, 2021 20:42 — forked from zachsa/pg-cursor iterator example.js
Example of how to create a row iterator using pg-cursor
const createIterator = async (sql, batchSize = 100) => {
const client = await pool.connect()
const cursor = client.query(new Cursor(sql))
return (async function getRows(client, cursor, batchSize) {
let done = false
// Get next rows
const rows = await new Promise((resolve, reject) =>
cursor.read(
@phipex
phipex / proxy.js
Created July 8, 2020 22:05 — forked from beradrian/proxy.js
CORS proxy with node-http-proxy
/** If you want to use the local development environment with the dev backend,
* this will create a proxy so you won't run into CORS issues.
* It accepts the following command line parameters:
* - port the port where the proxy will listen
* - target the DEV backend target to contact.
* Example: If you set the port to 3000 and target to https://dev.nibo.ai then
* your actual "resourceBaseUrl" in NiboSettings should be http://localhost:3000/api/v1
*/
// Define the command line options
const optionDefinitions = [
@phipex
phipex / git-branch-simplify.md
Created August 9, 2018 22:17 — forked from datagrok/git-branch-simplify.md
How to simplify the graph produced by git log --graph

Ideas for improvements to git log --graph

I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.

Make the graph for --topo-order less wiggly

Imagine a long-running development branch periodically merges from master. The git log --graph --all --topo-order is not as simple as it could be, as of git version 1.7.10.4.

It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.

<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is based on the javascript.lang file of GtkSourceView.
It has additional Typescript keywords defined.
Author: Johannes Bergmann
Copyright (C) 2014 Johannes Bergmann
###

Start Kafka service

The following commands will start a container with Kafka and Zookeeper running on mapped ports 2181 (Zookeeper) and 9092 (Kafka).

docker pull spotify/kafka
docker run -d -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=kafka --env ADVERTISED_PORT=9092 --name kafka spotify/kafka

Why Spotify?

ADVERTISTED_HOST was set to kafka, which will allow other containers to be able to run Producers and Consumers.

@phipex
phipex / saltstack.sh
Created June 8, 2018 21:48 — forked from michaelkarrer81/saltstack.sh
[Saltstack Cheat Sheet] #saltstack
# ============
# COMMON TASKS
# ============
# Update Online Tools
salt -G "minion_roles:ONLINE" cmd.run 'cd /opt/online/online_tools;git pull'
salt -G "minion_roles:BACKUP" cmd.run 'cd /opt/online/online_tools;git pull'
# Check Release Tag of Online Core
salt -G "minion_roles:ONLINE" cmd.run 'git -C /opt/online/online_o8r166 describe --tags --exact-match --match o8r*'
@phipex
phipex / tutorialDockerCentos7.md
Created April 12, 2018 00:48 — forked from edgardo001/tutorialDockerCentos7.md
Tutorial realizado con Docker en Centos 7

Instalar docker en centos 7

$> sudo yum update -y
$> sudo yum install docker
$> sudo systemctl start docker

para que este disponible cuando se inicia la maquina

$&gt; sudo systemctl enable docker
@phipex
phipex / node-and-npm-in-30-seconds.sh
Created September 18, 2017 20:47 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh

#How you get Sail.js running on Openshift#

This instruction is tested with:

  • Sails.js v0.9.16
  • Node.js 0.10 on Openshift ( 05 May 2014)

###1) package.json

If you use the package.json build by sails new Projectname than you have to add a few fields for openshift – so the server can start you app automatically. Sails uses Grunt to build minify css/js and so on. Openshift dont have grunt installed so you have to add this also.