Skip to content

Instantly share code, notes, and snippets.

Avatar
😅
I have no idea what I'm doing

Eduardo Mínguez e-minguez

😅
I have no idea what I'm doing
View GitHub Profile
View index.html
<!doctype html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex">
<title>~</title>
<script>WebFontConfig={google:{families:['Lato:300:latin']}};</script>
<script src="https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js" async></script>
View ssh tricks
Host azbastion
HostName emingueztestb.eastus2.cloudapp.azure.com
User edu
StrictHostKeyChecking no
ProxyCommand none
CheckHostIP no
IdentityFile ~/.ssh/id_rsa_azure
Host azmaster? azinfranode? aznode??
ProxyCommand ssh azbastion -W $(sed -e "s/az//" <<< "%h"):%p
@e-minguez
e-minguez / pcsensor2mqtt
Last active Sep 10, 2018
pcsensor2mqtt
View pcsensor2mqtt
#!/bin/bash
MQTT_HOST=${MQTT_HOST:-localhost}
MQTT_ID=${MQTT_ID:-n54l}
MQTT_TOPIC=${MQTT_TOPIC:-n54l/input/temp}
MQTT_OPTIONS=${MQTT_OPTIONS:-"-V mqttv311"}
# Raw message to MQTT
# https://github.com/shakemid/pcsensor-temper
TEMP=$(/home/edu/bin/pcsensor -c | awk '{ print $4 }')
/usr/bin/mosquitto_pub -h ${MQTT_HOST} -i ${MQTT_ID} -t ${MQTT_TOPIC} ${MQTT_OPTIONS} -m "${TEMP}"
View cura help
# Cura app image
sudo dnf install -y libglvnd-devel
# Create a file
/home/edu/.local/share/applications/cura.desktop
[Desktop Entry]
Name=Cura
GenericName=3D Printing Software
Comment=Cura converts 3D models into paths for a 3D printer. It prepares your print for maximum accuracy, minimum printing time and good reliability with many extra features that make your print come out great.
Exec=/home/edu/bin/cura %F
TryExec=/home/edu/bin/cura
@e-minguez
e-minguez / notify.sh
Last active Oct 23, 2017
Home Assistant dashbutton hostapd script
View notify.sh
#!/bin/bash
# Use it with /usr/sbin/hostapd_cli -i wlan1 -a /root/hostapd/notify.sh -B
HASS="http://192.168.1.2:8123"
SCOTTEX="xx:xx:xx:xx:xx:xx"
FAIRY="yy:yy:yy:yy:yy:yy"
CURL="/usr/bin/curl -s"
MAC=$3
if [[ $2 == "AP-STA-CONNECTED" ]]
then
@e-minguez
e-minguez / controller_id.yaml
Last active Oct 26, 2017
Get the hostname of the controller running in OCP
View controller_id.yaml
---
- hosts: masters
gather_facts: no
become: true
tasks:
- name: Get controller ID in all masters
shell: |
journalctl -b -u atomic-openshift-master-controllers.service --output cat | grep "Attempting to acquire controller lease as" | tail -1 | awk '{ print $11 }' | sed 's/,//'
changed_when: False
register: masterid
@e-minguez
e-minguez / brightness_gnome.sh
Last active Dec 21, 2017
Plugin for argos to regulate external screen brightness using xrand
View brightness_gnome.sh
#!/usr/bin/env bash
STEPS="0.1"
MONITORS="DP-2-1 DP-2-2"
echo "|iconName=weather-clear"
echo "---"
for i in $(seq 1.0 -${STEPS} ${STEPS})
do
@e-minguez
e-minguez / temperature.1m.sh
Created Dec 5, 2017
argos plugin for home assistant temperature
View temperature.1m.sh
HASS="http://x.x.x.x:8123"
CURL="curl -s -X GET -H 'Content-Type: application/json' ${HASS}/api/states"
TI=$(${CURL}/sensor.temperature | jq -r '.state')
TO=$(${CURL}/sensor.temperature_outside | jq -r '.state')
HO=$(${CURL}/sensor.humidity_outside | jq -r '.state')
echo "${TI}º |"
echo "---"
echo "${TO}º outside"
View x230.ks
#version=DEVEL
# Network installation
url --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
#url --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-$releasever&arch=$basearch
repo --name=fedora
repo --name=updates
# System authorization information
auth --enableshadow --passalgo=sha512
@e-minguez
e-minguez / fix_ocp_katacoda.py
Last active Jan 8, 2018
fix_ocp_katacoda.py
View fix_ocp_katacoda.py
#!/usr/bin/env python
import ruamel.yaml
import os
import socket
import fcntl
import struct
# https://stackoverflow.com/questions/24196932/how-can-i-get-the-ip-address-of-eth0-in-python/30990617
def get_ip_address(ifname):
You can’t perform that action at this time.