Skip to content

Instantly share code, notes, and snippets.

View Semedi's full-sized avatar
🎮
+

Sergio Semedi Barranco Semedi

🎮
+
View GitHub Profile
@Semedi
Semedi / scrap.py
Last active May 18, 2021 22:30
simple scrapping example (dependencies: selenium)
from selenium import webdriver
from selenium.common.exceptions import ElementClickInterceptedException
from selenium.common.exceptions import StaleElementReferenceException
import time
import json
# from selenium.webdriver.firefox.options import Options
BASE_URL = 'https://guiadentistas.es/'
NPAGES = 402
#!/usr/bin/env python3
API_KEY = ""
API_SECRET = ""
import time, base64, hashlib, hmac, urllib.request, json
api_nonce = bytes(str(int(time.time()*1000)), "utf-8")
api_request = urllib.request.Request("https://api.kraken.com/0/private/GetWebSocketsToken", b"nonce=%s" % api_nonce)
api_request.add_header("API-Key", API_KEY)
@Semedi
Semedi / yarn2influx
Last active January 21, 2020 15:34
yarn to influx example script
#!/bin/bash
# Config
NAME="yarn"
column=( ["1"]="id" ["2"]="name" ["6"]="state" ["7"]="final" ["8"]="progress" )
output=""
# code:
IFS=$'\n'
for application in $(yarn application -list -appStates ALL 2> /dev/null | tail -n+3);do
@Semedi
Semedi / proxy.sh
Created January 13, 2020 07:28
small script, connect to a proxy (Ubuntu/Debian)
#!/bin/bash
# MODIFY with YOUR SHELL FILE:
INIT_FILE=".yourshellfile"
PROXY='x.x.x.x'
PROXY_PORT=X
DIRECTORY="$HOME/.orange_proxy"
clear_proxy(){
sed -i '/.orange_proxy/d' $HOME/$INIT_FILE
@Semedi
Semedi / raw_petition_poc.c
Created October 26, 2019 11:23
simple mechanism for a custom server reading key|[pairs] flat values, ex: server|id=0,uri=www.google.es,config=none
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct
{
char * key;
char * pairs;
} epfiot_petition;
@Semedi
Semedi / hive_to_glue
Created May 7, 2019 16:17
basic script for building terraform aws::glue resources
#!/usr/bin/python3
import sys
import os
def is_bool(s):
return s == 'true' or s == 'false'
def is_digit(s):
return s.isdigit()
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# In this example testing cloudera-quickstart image
IMAGE="/home/semedi/mount/cloudera-quickstart-vm-5.13.0-0-kvm.qcow2"
#!/bin/bash
# example for 700GB:
# BLOCK_SIZE=10
# off_n=(2500000 35000 17000)
# size=(14848 524288 1048576)
#
# 0 >= i <= 2
# Sum(i) = off_n(i) * size(i) * BLOCK_SIZE = 700gb
import time
# This gist have only aim to provide a kind of fast cheatsheet for python3.
# In the file we will find some useful methods and example about how to use them.
# you can include any dirty trick of vanilla python3 that you use daily or whatever you like
# Only python3 vanilla imports are allowed
# Main purpose is not to have basic stuff like syntax or operators, instead of that
# try to use them in a custom example
# i3 config file (v4)
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
# Set mod key (Mod1=<Alt>, Mod4=<Super>)
set $mod Mod4
# set default desktop layout (default is tiling)
# workspace_layout tabbed <stacking|tabbed>
# Configure border style <normal|1pixel|pixel xx|none|pixel>