Skip to content

Instantly share code, notes, and snippets.

View gleicon's full-sized avatar

Gleicon Moraes gleicon

View GitHub Profile
@gleicon
gleicon / audit-on-push.yml
Created January 6, 2022 16:55 — forked from LukeMathWalker/audit.yml
GitHub Actions - Rust setup
name: Security audit
on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit:
runs-on: ubuntu-latest
steps:
@gleicon
gleicon / lcd_arduino.ino
Created October 29, 2021 21:28
LCD Keypad 1602 and Arduino backlight bright control using up/down keys
#include <LiquidCrystal.h>
//LCD pin to Arduino
const int pin_RS = 8;
const int pin_EN = 9;
const int pin_d4 = 4;
const int pin_d5 = 5;
const int pin_d6 = 6;
const int pin_d7 = 7;
const int pin_BL = 10;
@gleicon
gleicon / lcd_arduino.ino
Created October 29, 2021 16:30
1602 lcd shield and arduino test
/*
Arduino 2x16 LCD - Detect Buttons
modified on 18 Feb 2019
by Saeed Hosseini @ Electropeak
https://electropeak.com/learn/
*/
#include <LiquidCrystal.h>
//LCD pin to Arduino
const int pin_RS = 8;
const int pin_EN = 9;
@gleicon
gleicon / kafka_inject_from_es.py
Last active April 22, 2021 20:28
es -> kafka
import xmltodict
import json
import sys
import getopt
import time
from datetime import datetime
import collections
from elasticsearch import Elasticsearch
import logging
from kafka import KafkaProducer
@gleicon
gleicon / txsyslogd.py
Created December 21, 2010 12:14
minimalistic syslog daemon written with twisted.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
# launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist
from twisted.internet import reactor, stdio, defer
from twisted.internet.protocol import Protocol, Factory
from twisted.protocols.basic import LineReceiver
import time, re, math, json
@gleicon
gleicon / gDNS.py
Created July 10, 2011 03:31
gevent/dnslib/redis based DNS server
# dns server using dnslib and gevent
# based on https://bitbucket.org/paulc/dnslib/src/80d85555aae4/src/server/gevent_server.py
# set the key as
# set IP:name ip_addr
# set TXT:name txtfield
# fallback on gevent's dns resolver
# gleicon 2011
import gevent
@gleicon
gleicon / detect.swift
Created February 7, 2021 13:33
Swift test to detect light/dark mode
// swiftc detect.swift -o detect
import Cocoa
func detectDarkTheme() {
let isDark = UserDefaults.standard.string(forKey: "AppleInterfaceStyle") == "Dark"
if isDark {
print("Mode is Dark")
} else {
@gleicon
gleicon / zemitter.js
Created June 9, 2011 02:16
ZeroMQ and Node.js pub/sub emitter
// ZeroMQ PUB/SUB + Multicast (PGM) enabled event emitter for node.js
// gleicon - 2011
var util = require("util");
var events = require("events");
var zeromq = require("../node_modules/zeromq"); // check the right path
var sys = require("sys");
function DistEventEmitter(name, remote_node) {
events.EventEmitter.call(this);
@gleicon
gleicon / geocode.py
Created February 10, 2015 22:13
geocoding stuff with google maps visualization python + go, quick and dirt. servemaps serves the /map url which renders a simple map with markers read from a csv file. geocode.py helps if you happen to have a lfile with a list of addresses.
# convert a file from name;address to name address,latitude,longitude
# pip install geopy
from geopy import geocoders
geolocator = geocoders.GoogleV3()
import sys
def geoconvert(file):
f = open(file)
@gleicon
gleicon / README.md
Created August 9, 2017 16:35 — forked from lucindo/README.md
Using Graphite/Grafana to gather Locust.io test data

Using Locust.io with Grafana

On your locust master server:

  • Install and configure Graphite. Follow a good tutorial
  • Install and configure Grafana: tutorial

Use logra.py on your locust test file. See locustfile.py.