Skip to content

Instantly share code, notes, and snippets.

View zodman's full-sized avatar
🤗
Code wins arguments!

Andres Vargas zodman

🤗
Code wins arguments!
View GitHub Profile
@zodman
zodman / intro.md
Created June 6, 2020 03:13 — forked from GochoMugo/intro.md
Node.js Debug Package as a Dev-Dependency

The [debug][debug] module for Node.js is one of the most useful utilities when it comes to high-level debugging. The only problem with using it, would that the module eventually becomes a hard dependency in your project. Your project will NOT run if the package is not installed despite the fact that it is only needed in development mode.

One way to work around this to have a dummy function used in place of the real debug function, when users are in production mode.

var debug = process.env.DEBUG ? require("debug")("MyProject:Server") : function() {};

This way, the module is only loaded when the DEBUG environment variable is set. Therefore, the package can be added as a devDependency to the project's package.json rather than as a dependency.

@zodman
zodman / featureflag.js
Created February 26, 2020 22:25
Simple featureflag in nodejs
/*
* Simple featureFlag
* */
const YAML = require('yaml');
const fs = require("fs");
class FeatureFlag {
constructor() {
set $var_cors 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,X-app-language,X-app-version,X-app-countr';
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,X-app-language,X-app-version,X-app-country';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
title my IA Challenge
tags django, keras
description View the slide with "Slide Mode".

Andres Bernardo Vargas Rodriguez

github.com/zodman

#!/bin/bash
# This bash script use the Bamboo REST API in order to trigger a plan tests and wait for it to finish and get a result (failed or success).
# It should have a timeoput and should return success or failure
#This triggers the plan
#set -x
EXECUTEPLAN=$(curl -H "Authorization: Bearer ${bamboo.BEARER_SECRET}" -X POST -d "stage&executeAllStages" https://bamboo.coke.com/rest/api/latest/queue/CDSGLB-CDSDEPDCL.json)
echo "output of plan: "
import requests
import argparse
import os
import time
import pprint
import sys
base_token = os.environ.get("bamboo_BAMBOO_TOKEN")
TOKEN = os.environ.get("BAMBOO_TOKEN", base_token)
@zodman
zodman / importer.py
Created October 3, 2019 13:53
small script to fetch all canadian companies who issued LMIA
mport rows
from collections import OrderedDict
from rows import fields, Table
import tqdm
files = [
("2017Q2-Q1","Descargas/2017Q2_Positive_Employer_EN.csv"),
("2017Q3","Descargas/2017Q3_Positive_Employer-EN.csv"),
("2017Q4","Descargas/2017Q4_Positive_Employer-EN.csv"),
("2018Q1","Descargas/2018Q1_Positive_Employer_EN.csv"),
@zodman
zodman / hrtool.py
Last active August 22, 2019 07:09 — forked from miratcan/hrtool.py
A python script to run hackerrank answers on your local. Just run it in the sample test cases folder that you downloaded from hackerrank.
import re
import glob
import subprocess
from os.path import exists
from sys import exit
INPUT_FOLDER = 'input/'
OUTPUT_FOLDER = 'output/'
@zodman
zodman / calc.py
Created May 23, 2019 21:55
calculate days
import sys
import humanize
hrs = int(sys.argv[1])
days = round(hrs/8.0,1)
weeks = round(hrs/40.0,1)
month= round(days/20.0,1)
print("total days: {}".format( humanize.fractional(days)))
print("total weeks: {}".format(humanize.fractional(weeks)))
@zodman
zodman / gist:c81f343d01435388d9264aa14fa5d638
Created February 8, 2019 19:03 — forked from sdoro/gist:4291961
restart OpenVPN server in CLI pfsense
echo "<?php include('openvpn.inc'); openvpn_resync_all();?>" | php -q