Skip to content

Instantly share code, notes, and snippets.

@amd64bit
amd64bit / example.py
Last active August 29, 2015 14:27 — forked from taka-wang/example.py
install mosquitto 1.4 on raspberry pi
import paho.mqtt.client as mqtt
# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, rc):
print("Connected with result code "+str(rc))
# Subscribing in on_connect() means that if we lose the connection and
# reconnect then subscriptions will be renewed.
client.subscribe("hello/world")
# The callback for when a PUBLISH message is received from the server.
@amd64bit
amd64bit / mosquitto.init.sh
Last active August 29, 2015 14:27 — forked from basuke/mosquitto.init.sh
Amazon Linux Init script for mosquitto MQTT 3.1 broker.
#!/bin/bash
#
# mosquitto This shell script takes care of starting and stopping
# mosquitto (MQTT 3.1 broker) on Amazon Linux.
#
# chkconfig: - 58 74
# description: mosquitto is a MQTT 3.1 broker. \
# http://mosquitto.org/
### BEGIN INIT INFO
@amd64bit
amd64bit / Linux_Nginx_MySQL_PHP5.sh
Created March 9, 2016 03:55 — forked from majimboo/Linux_Nginx_MySQL_PHP5.sh
CentOS 6.5 LEMP (Linux, Nginx, MySQL, PHP5) Stack Install Script with Composer and NodeJS
#!/bin/bash
# Install script for LEMP Web Server on CENTOS 6.5 by Majid Arif Siddiqui
# Init
echo "Initializing..."
sudo yum -y update
sudo yum -y groupinstall "Development Tools"
sudo yum -y install screen
"""
Fade IN/OUT some text..
"""
import sys
import time
import pygame
## Show some text fade in/out
@amd64bit
amd64bit / CentOS_7.2_New_WebServer_Configuration.txt
Created December 13, 2016 09:26 — forked from alkavan/CentOS_7.x_(PHP_7.3_Postgres_10.x).md
CentOS 7.2 New Web Server Configuration (DigitalOcean) +EPEL +IUS +PHP +MongoDB +Sentry +PostgreSQL +MariaDB
# [General/Initial Section]
# Update system
yum update
# Set your timezone
timedatectl set-timezone UTC
# Check date is set correct
date
@amd64bit
amd64bit / MQTTWemosButton.ino
Created November 21, 2017 14:55 — forked from jpwsutton/MQTTWemosButton.ino
MQTT Wemos Button
/***************************************************
MQTT Button on Wemos
James Sutton 2017 - jsutton.co.uk
****************************************************/
#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
/************************* WiFi Access Point *********************************/
@amd64bit
amd64bit / udpserver.py
Created April 20, 2018 04:32 — forked from glegoux/udpserver.py
[Pyhton] Run UDP server via socket server
#!/usr/bin/env python3
#
# udpserver.py
#
# See Gist udpclient.py to send a UDP message.
#
# Run UDP server on 127.0.0.1 port 8000.
#
# usage: python3 udpserver.py
@amd64bit
amd64bit / udpclient.py
Created April 20, 2018 04:34 — forked from glegoux/udpclient.py
[Python] Run UDP client for UDP socket server
#!/usr/bin/env python3
#
# udpclient.py
#
# Required that UDP server runs on 127.0.0.1 port 8000.
# See Gist udpserver.py.
#
# Send UDP message to UDP server.
#
# usage: python3 udpclient.py
#!/bin/sh
echo "==== Disable SELinux ===="
setenforce 0
sed -i "s/^SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
echo "==== Start Yum Update ===="
yum -y update
echo "==== Install nano and wget ===="

mdadm

Glossary:

  • md: multiple devices
command description
cat /proc/mdstat show status of all raids
mdadm --detail /dev/md0 detailed status of raid md0