Skip to content

Instantly share code, notes, and snippets.

View DevJulianSalas's full-sized avatar
🏠
Working from home

Julian Salas DevJulianSalas

🏠
Working from home
View GitHub Profile
@DevJulianSalas
DevJulianSalas / macdevice.ino
Last active February 7, 2019 16:42
Código para obtener la mac device
#include <ESP8266WiFi.h>
void setup(){
Serial.begin(9600);
delay(500);
Serial.println();
Serial.print("MAC: ");
Serial.println(WiFi.macAddress());
@DevJulianSalas
DevJulianSalas / package.json
Last active May 19, 2018 17:57
A starting point package.json to vuejs projects
{
"name": "",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
@DevJulianSalas
DevJulianSalas / deque.py
Last active February 9, 2018 04:18
Keep the last fews elements from a list
#Give a list with N elements need to get 3 last elements from a list
# [1,4,2,4,1,2,3,5,6,3]
# The first solution that comes my head is iter about it and use append, pop or delete but
# there is a more elegant solution with a collection "datatypes" is an awesome feature.
import collections
numbers_list = [1,4,2,4,1,2,3,5,6,3]
last_three_numbers = collections.deque(numbers_list, 3)
@DevJulianSalas
DevJulianSalas / unpacking.py
Created February 6, 2018 16:32
Unpacking tuples
"""
Reference Python cookbook
If you have tuples an awesome feature is unpacking from python, sometimes you need to unpacking tuples without know the index.
x,y,z = (1,2)
This raise an error about
ValueError: need more than 2 values to unpack
This is because you are unpacking more than values that expect.
@DevJulianSalas
DevJulianSalas / Querys.sql
Last active February 2, 2018 15:34
Queys to SQL engine
-- To know if x column have elements repeated
SELECT `name_column`, COUNT(1) as CNT
FROM `name_column`
GROUP BY `n`
HAVING COUNT(1) >1;
---
@DevJulianSalas
DevJulianSalas / Jenkinsfile
Last active May 28, 2021 19:10
A Jenkinsfile pipeline to run ci/cd in Node-react environment from gitlab push events. This is to gitlab repo generating a toke from user with permissons
pipeline {
agent { dockerfile true }
environment{
user=credentials('here-your-credential-from-jenkins-credentials') // To get credentials go credentials jenkins link and copy id credential.
}
options {
gitLabConnection('xxx') // Here go your connection with gitlab, you can set up it jenkins credentials, dont forget install plugin gitlab to jenkins
gitlabBuilds(builds: ['install', 'test', 'build','pre-deploy'])
}
triggers {
@DevJulianSalas
DevJulianSalas / Vagrantfile
Last active January 12, 2018 14:09
Basic Vagrantfile setup to run ubuntu xenial with some port and shared folder configuration.
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
vb.memory = "700"
@DevJulianSalas
DevJulianSalas / CommandsEtcd.MD
Last active October 22, 2017 15:54
Usefull comands to etcd a key-value store data for distruibuted systems

List commands

  1. etcdctl ls service List all keys from directory
@DevJulianSalas
DevJulianSalas / CommandsEtcd.md
Created October 22, 2017 13:58
Usefull comands to etcd a key-value store data for distruibuted systems

d

@DevJulianSalas
DevJulianSalas / docker-compose.yml
Created September 7, 2017 02:05
Simple set up docker network as bridge to docker containers in docker-compose.
version: 'Here your version'
services:
webserver:
networks:
name_network_here:
ipv4_address: '172.25.1.10'
ciserver:
networks: