Skip to content

Instantly share code, notes, and snippets.

@oleurud
oleurud / command
Created February 4, 2020 09:33
run loop in cli
for i in $(seq 1 100); do echo "hi ${i}"; echo "hi again ${i}"; done
@oleurud
oleurud / tags
Created August 1, 2019 09:40
[set dataset tags] #cartoframes #python
USERNAME = ''
APIKEY = ''
TABLE = ''
from carto.auth import APIKeyAuthClient
auth_client = APIKeyAuthClient(
base_url='https://{}.carto.com'.format(USERNAME),
api_key=APIKEY
@oleurud
oleurud / cartoframes install and tests reminder
Last active January 30, 2020 16:50
[Python env 101] #python #jupyter
pip install -e .
pip install jupyter pytest pytest-mock
pytest or pytest test/test_context.py::TestCartoContext::test_cartocontext_write
@oleurud
oleurud / parallel.js
Last active March 28, 2019 09:56
[async / await parallel] #js
function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function a() {
await timeout(3000);
console.log('a')
return 'a'
}
@oleurud
oleurud / local-mongo-replicaset-with-docker
Last active November 16, 2023 16:57
[Local mongo replicaset with docker] #docker #mongo
# pull the official mongo docker container
docker pull mongo
# create network
docker network create my-mongo-cluster
# create mongos
docker run -d --net my-mongo-cluster -p 27017:27017 --name mongo1 mongo mongod --replSet my-mongo-set --port 27017
docker run -d --net my-mongo-cluster -p 27018:27018 --name mongo2 mongo mongod --replSet my-mongo-set --port 27018
docker run -d --net my-mongo-cluster -p 27019:27019 --name mongo3 mongo mongod --replSet my-mongo-set --port 27019
@oleurud
oleurud / Enter in running docker container
Last active July 9, 2018 08:51
Enter in running docker container #docker
docker exec -it [container] bash
@oleurud
oleurud / Run command inside a docker container
Last active July 9, 2018 08:50
Run command inside a docker container #docker
docker exec -it {docker image} {command}
Example:
docker exec -it mongo mongo
docker exec -it mysql mysql --host=localhost --port={port} --user={user} --password={password} {dbName}