Skip to content

Instantly share code, notes, and snippets.

Isidro Martínez isidroamv

Block or report user

Report or block isidroamv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@isidroamv
isidroamv / migrate_spotify_library.py
Created Apr 17, 2018
Use this script to migrate your spotify library from one account to another
View migrate_spotify_library.py
import requests
old_token = ''
new_token = ''
h = {
'Authorization': 'Bearer ' + old_token
}
tracks = []
index = 0
View threading-loop.py
from threading import Thread
import random
import time
import requests
def send_configurations(n=1, n2=2):
time.sleep(random.randint(1, 10))
print(n)
for n in range(10):
@isidroamv
isidroamv / UsernameToken.py
Created Oct 30, 2017
Make a SOAP Authentication with UsernameToken using python
View UsernameToken.py
from zeep import Client
from zeep.transports import Transport
from zeep.wsse.username import UsernameToken
import json
url = "https://example.com/Service.svc?wsdl"
client = Client(url, wsse=UsernameToken("username", "password"))
reponse = client.service.MyService(request={"CountryCode": "MEX", "ClientCode": 0000})
@isidroamv
isidroamv / stayalive.sh
Last active Dec 8, 2017
Restart process if crash on Linux
View stayalive.sh
#!/bin/bash
# Add this file as a crontab task
# Example: * * * * * bash /opt/dir/task/stayalive.sh
# If the collector is not runing, execute it
if [[ ! `pgrep -f "python main.py"` ]]; then
cd /opt/dir/process && ./process-name
fi
View gist:2bc60af11064723f98e392f018166082
function calculateDistance(rssi) {
var txPower = -59 //hard coded power value. Usually ranges between -59 to -65
if (rssi == 0) {
return -1.0;
}
var ratio = rssi*1.0/txPower;
if (ratio < 1.0) {
@isidroamv
isidroamv / run-command-background.sh
Last active Mar 7, 2017
Run command Background - Linux
View run-command-background.sh
nohup command </dev/null >/dev/null 2>&1 & # completely detached from terminal
@isidroamv
isidroamv / build.sh
Created Dec 6, 2016
Build golang code to LINUX AMD
View build.sh
env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v bitbucket.com/mycompany/my_package
@isidroamv
isidroamv / StackOverflow Q&A
Last active Sep 22, 2016
A SQL query to get Questions and Answers of StackOverflow website. This data is required on the exercise 5 of the book Building Machine Learning Systems With Python
View StackOverflow Q&A
SELECT Id, Body, AcceptedAnswerId, Score, ParentId, CreationDate
FROM Posts
WHERE CreationDate BETWEEN '2014-01-01' AND '2017-01-01'
@isidroamv
isidroamv / gz-reader.go
Last active Oct 21, 2019
Reading a txt gzip file with golang
View gz-reader.go
func ReadGzFile(filename string) ([]byte, error) {
fi, err := os.Open(filename)
if err != nil {
return nil, err
}
defer fi.Close()
fz, err := gzip.NewReader(fi)
if err != nil {
return nil, err
View jsonToStruct.example.go
package main
import "fmt"
import "encoding/json"
type Person1 struct {
Name string
Age string
}
You can’t perform that action at this time.