Skip to content

Instantly share code, notes, and snippets.

@hggh
hggh / main.cpp
Created June 4, 2022 09:31
ESP32-S2 deep sleep with bme280
#include <Arduino.h>
#include <Wire.h>
#include <WiFi.h>
#include <MQTT.h>
#include <SparkFunBME280.h>
#include <esp_wifi.h>
#include "esp_sleep.h"
@hggh
hggh / fastledwithmqtt.ino
Created March 12, 2016 23:33
FastLED Crashes MQTT
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include "FastLED.h"
// UPDATE
const char* ssid = ".....";
const char* password = "....";
const char* mqtt_server = "192.168.0.1";
#!/bin/bash
unknown_os ()
{
echo "Unfortunately, your operating system distribution and version are not supported by this script."
echo "Please email support@packagecloud.io and we will be happy to help."
exit 1
}
curl_check ()
@hggh
hggh / INSTALL.md
Last active August 29, 2015 14:04
Puppetboard Debian Packages
@hggh
hggh / haproxy_curconn_
Created May 17, 2014 12:03
haproxy curconns with instance support
#!/usr/bin/env perl
# haproxy_curconn_l1 symlink in etc/munin/plugins
use strict;
use IO::Socket::UNIX;
my $ha_name;
if ($0 =~m /haproxy_maxconn_(.*)/ ) {
$ha_name = $1;
}
@hggh
hggh / crontab-checker.rb
Created March 20, 2014 09:40
crontab checker in ruby
#!/usr/bin/ruby
require 'cron-spec'
File.read("/tmp/cron").split("\n").each do |line|
next if line =~ /^#/ or line =~ /^$/
data = line.split(" ")
cron_time = data[0..4].join(" ")
@hggh
hggh / graylog2.drl
Created February 10, 2014 20:45
Graylog2 Drools Rule File
import org.graylog2.plugin.Message
rule "delete message 1"
when
m : Message( message matches "^PHP Deprecated: getChildren.*" && getField("facility") == "php-error-logs")
then
m.setFilterOut(true);
end
@hggh
hggh / ldirectord.cf
Created December 27, 2013 08:57
Graylog2 Server <=> Ldirectord <=> ipvsadm (LVS)
virtual=1.1.1.1:12201
real=10.10.10.100:12201 masq
real=110.10.10.200:12201 masq
protocol=udp
scheduler=rr
checkport=12900
request="/system"
service=http
httpmethod=GET
receive="graylog2-server"
@hggh
hggh / graylog2.md
Last active January 6, 2023 12:18
Graylog2 Debian Packages

WARNING

These packages are obsolete! Please use the official packages from http://www.Graylog2.org

=================================================

@hggh
hggh / deploy.rb
Created October 17, 2012 18:21
Capistrano recipe for repositories with sub directories
require 'capistrano/recipes/deploy/strategy/remote_cache'
module ::Capistrano
module Deploy
module Strategy
class RemoteCache < Remote
def copy_repository_cache
logger.trace "copying the cached version to #{configuration[:release_path]}"
if copy_exclude.empty?
directory = File.join(repository_cache, 'symfony')
run "cp -RPp #{directory} #{configuration[:release_path]} && #{mark}"