Skip to content

Instantly share code, notes, and snippets.

Avatar
🤗
Code wins arguments!

Andres Vargas zodman

🤗
Code wins arguments!
View GitHub Profile
@zodman
zodman / bluetooth.ps1
Last active Aug 15, 2020
Enable and disable bluetooth windows by powershell cli ! usefull to sync you airphones
View bluetooth.ps1
[CmdletBinding()] Param (
[Parameter(Mandatory=$true)][ValidateSet('Off', 'On')][string]$BluetoothStatus
)
If ((Get-Service bthserv).Status -eq 'Stopped') { Start-Service bthserv }
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType) {
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
@zodman
zodman / intro.md
Created Jun 6, 2020 — forked from GochoMugo/intro.md
Node.js Debug Package as a Dev-Dependency
View intro.md

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 Feb 26, 2020
Simple featureflag in nodejs
View featureflag.js
/*
* Simple featureFlag
* */
const YAML = require('yaml');
const fs = require("fs");
class FeatureFlag {
constructor() {
View cors.conf
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;
View my IA Challenge.md
title tags description
my IA Challenge
django, keras
View the slide with "Slide Mode".

Andres Bernardo Vargas Rodriguez

github.com/zodman

View bamboorun.sh
#!/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: "
View runbamboo.py
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 Oct 3, 2019
small script to fetch all canadian companies who issued LMIA
View importer.py
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 Aug 22, 2019 — 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.
View hrtool.py
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
calculate days
View calc.py
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)))
You can’t perform that action at this time.