Skip to content

Instantly share code, notes, and snippets.

View jweyrich's full-sized avatar
:octocat:
Making some lives easier and happier!

Jardel Weyrich jweyrich

:octocat:
Making some lives easier and happier!
View GitHub Profile
@jweyrich
jweyrich / uninstall_citrix_receiver.sh
Last active January 27, 2021 06:55
Citrix Receiver uninstaller for macOS
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
launchctl stop /Library/LaunchAgents/com.citrix.AuthManager_Mac.plist
launchctl stop /Library/LaunchAgents/com.citrix.ReceiverHelper.plist
launchctl stop /Library/LaunchAgents/com.citrix.ServiceRecords.plist
@jweyrich
jweyrich / aws_elb_log_parser.awk
Created May 10, 2017 22:01
AWS ELB Log Parser
#!/usr/bin/awk -f
#
# AUTHOR: Jardel Weyrich <jweyrich at gmail dot com>
# REQUIRES: awk >= 4.0.0 (macOS awk won't work as of macOS 10.12.4)
#
#
# ELB log format - REFERENCE: http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/access-log-collection.html
#
# 1 timestamp
@jweyrich
jweyrich / nginx.conf
Last active February 9, 2017 13:35
Nginx - Redirect some traffic from HTTP to HTTPS
set $needs_https_redir 1;
# Do not force HTTPS if the client is directly connecting to this server via
# HTTPS.
if ($scheme = 'https') {
set $needs_https_redir 0;
}
# Do not force HTTPS if the client is indireclty connecting to this server via
# HTTPS and the gateway tells us that through the X-Forwarded-Proto header.
@jweyrich
jweyrich / Program.cs
Last active November 10, 2017 18:19
Cannot implicitly convert type 'Demo.RestoreOperation' to 'Demo.IBaseOperation<Demo.IBaseOperationReport>'. An explicit conversion exists (are you missing a cast?)
using System;
using System.Collections.Generic;
namespace Demo
{
public interface IBaseOperationReport
{
List<string> ErrorMessages { get; }
bool HasErrorMessages { get; }
@jweyrich
jweyrich / demo-node-s3.js
Created August 16, 2016 17:29
Demo - Uploading a file to S3 using the AWS SDK for Node.js
//
// Author: Jardel Weyrich <jardel at teltecsolutions dot com dot br>
// Date: 2016-08-16
//
var AWS = require('aws-sdk');
var s3 = new AWS.S3();
var path = require('path');
var fs = require('fs');
@jweyrich
jweyrich / 0001-pesec-Fix-search-for-stack-cookies.patch
Last active July 20, 2016 17:15
pesec: Fix search for stack cookies.
From 2b192e6bb31bbe45245230c92e5164269da254e8 Mon Sep 17 00:00:00 2001
From: Jardel Weyrich <[email protected]>
Date: Wed, 20 Jul 2016 10:24:06 -0300
Subject: pesec: Fix search for stack cookies.
---
include/utils.h | 1 +
src/pesec.c | 16 ++++++++--------
src/utils.c | 13 +++++++++++++
3 files changed, 22 insertions(+), 8 deletions(-)
@jweyrich
jweyrich / letsencrypt-auto-renew.sh
Created July 5, 2016 13:37
Let's Encrypt Certificates Auto Renew
#!/bin/bash
#
# AUTHOR : Jardel Weyrich <[email protected]>
# DESCRIPTION: Renew expiring certificates that were already issued via letsencrypt
# and reside in `/etc/letsencrypt/live/$DOMAIN/`.
# The domain authentication is done via WEBROOT. It starts an instance
# of `lighttpd` that serves files on `/var/www`, do the renew process using
# `letsencrypt-auto`, and then stops the `lighttpd` instance.
# The updated certificates are then moved to `/etc/haproxy/certs/$DOMAIN.pem`
@jweyrich
jweyrich / zabbix_telegram_notifier.py
Created May 5, 2016 13:37
Telegram Notifier for Zabbix
#!/usr/bin/env python
#
# Dependencies:
# $ pip install python-telegram-bot --upgrade
#
import sys, telegram
BOT_TOKEN='CHANGEME'
DESTINATION=int(sys.argv[1])
@jweyrich
jweyrich / glassfish
Last active November 2, 2018 08:50
/etc/init.d/glassfish - Glassfish init.d script (tested on Ubuntu 14.04.4 LTS)
#! /bin/sh
### BEGIN INIT INFO
# Provides: glassfish
# Required-Start: $local_fs $remote_fs $syslog $network
# Required-Stop: $local_fs $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Glassfish at boot time
# Description: Enable service provided by Glassfish
### END INIT INFO
@jweyrich
jweyrich / arithmetic-expression-evaluator.cpp
Last active March 23, 2021 09:26
Simple arithmetic expression evaluator written in C++
//
// ORIGINAL CODE: http://stackoverflow.com/questions/17806760/binary-expression-tree-c
//
#include <cassert>
#include <iostream>
template <typename ExpressionT>
struct expression
{