Skip to content

Instantly share code, notes, and snippets.

View skarllot's full-sized avatar
💭
I may be slow to respond.

Fabrício Godoy skarllot

💭
I may be slow to respond.
View GitHub Profile
@skarllot
skarllot / meta-data
Created June 17, 2015 19:47
Cloud init
instance-id: server1
local-hostname: server1.example.com
network-interfaces: |
iface ens160 inet static
address 192.168.1.10
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
@skarllot
skarllot / proxy-balancer.conf
Last active August 29, 2015 14:22
Apache proxy balancer
<VirtualHost *:443>
ProxyPass / balancer://webcluster/
ProxyPassReverse / balancer://webcluster/
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/; secure; HttpOnly" env=BALANCER_ROUTE_CHANGED
# Non SSL
# Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/; HttpOnly" env=BALANCER_ROUTE_CHANGED
</VirtualHost>
<Proxy balancer://webcluster>
@skarllot
skarllot / zabbix-agent.xml
Created May 25, 2015 15:25
FirewallD service to Zabbix Agent
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>Zabbix-Agent</short>
<description>Zabbix Agent listening port</description>
<port protocol="tcp" port="10050" />
</service>
@skarllot
skarllot / pdf-text-replace.sh
Created May 22, 2015 19:44
Replace text into PDF files
# CAM-PDF install
cpan
> install CAM::PDF
# Replace text
changepagestring.pl -o -v input.pdf srctext dsttext output.pdf
# Ref: http://search.cpan.org/dist/CAM-PDF/bin/changepagestring.pl
@skarllot
skarllot / centos7-cleanup.sh
Last active November 16, 2019 10:20
CentOS 7 minimal installation cleanup (remove unwanted services)
# Remove Postfix
systemctl stop postfix
systemctl disable postfix
yum remove postfix
# Remove Avahi
systemctl stop avahi-daemon.socket avahi-daemon.service
systemctl disable avahi-daemon.socket avahi-daemon.service
yum remove avahi-autoipd avahi-libs avahi
@skarllot
skarllot / shadow_copy.ps1
Created May 20, 2015 21:21
Create volume shadow copy on Powershell cli for Windows Core servers
#Enable Volume Shadow copy
clear
$Continue = Read-Host "Enable Volume Shadowcopy (Y/N)?"
while("Y","N" -notcontains $Continue){$Continue = Read-Host "Enable Volume Shadowcopy (Y/N)?"}
if ($Continue -eq "Y") {
#Enable Shadows
vssadmin add shadowstorage /for=C: /on=C: /maxsize=8128MB
vssadmin add shadowstorage /for=D: /on=D: /maxsize=8128MB
#Create Shadows
@skarllot
skarllot / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@skarllot
skarllot / carp-quagga-stop.patch
Last active August 29, 2015 14:15
pfSense patch files
diff --git a/etc/rc.carpbackup b/etc/rc.carpbackup
index 76cdfac..73ed0d7 100755
--- a/etc/rc.carpbackup
+++ b/etc/rc.carpbackup
@@ -50,5 +50,9 @@ if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-client'
}
}
+if (file_exists("/usr/local/etc/rc.d/quagga.sh")) {
+ // used to sleep(10); here, as apparently it worked around some issue w/2.0. w/2.1, it breaks things on systems with a significant number of CARP IPs.
@skarllot
skarllot / lockfile.sh
Created February 19, 2015 19:39
Locking for Bash scripts
#!/bin/bash
# See: http://www.kfirlavi.com/blog/2012/11/06/elegant-locking-of-bash-program/
readonly PROGNAME=$(basename "$0")
readonly LOCKFILE_DIR=/tmp
readonly LOCK_FD=200
lock() {
local prefix=$1
local fd=${2:-$LOCK_FD}
@skarllot
skarllot / test-rdtsc.c
Last active August 29, 2015 14:15
Test time stamp counter
// http://security.stackexchange.com/a/34552
#include <stdio.h>
#if defined(__i386__)
static __inline__ unsigned long long rdtsc(void)
{
unsigned long long int x;
__asm__ __volatile__ (".byte 0x0f, 0x31" : "=A" (x));