Skip to content

Instantly share code, notes, and snippets.

View btorch's full-sized avatar

Marcelo Martins btorch

  • Fortaleza
View GitHub Profile
@adamlaki
adamlaki / .htaccess
Created October 14, 2017 17:59
With the use of the expire module, you can set your assets browser cache time thus on the second download you can disable download of files like your site's favicon.
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 week"
# CSS
ExpiresByType text/css "access plus 2 week"
# Data interchange
ExpiresByType application/json "access plus 0 seconds"
@anthonyeden
anthonyeden / ParadoxPythonExample.py
Last active May 31, 2024 12:46
Paradox Database: Connect & Query in Python
# A sample script to create a temporary copy of a Paradox database, connect to it, and query it.
# Requires PyPyODBC: https://pypi.python.org/pypi/pypyodbc
# Written by Anthony Eden - http://mediarealm.com.au/
import os
import shutil
import pypyodbc
@jdeathe
jdeathe / openssl-self-signed-san-certificate.md
Last active June 24, 2022 03:48
How to generate a self-signed SAN SSL/TLS certificate using openssl

How to generate a self-signed SAN SSL/TLS certificate using openssl

Generating a self-signed certificate is a common task and the command to generate one with openssl is well known and well documented. Generating a certificate that includes subjectAltName is not so straght forward however. The following example demonstrates how to generate a SAN certificate without making a permanent change to the openssl configuration.

Generate a list of all required DNS names, (Note: CN will be discarded).

$ export SAN="DNS:www.domain.localdomain,DNS:domain.localdomain"
@barsv
barsv / logger.ps1
Last active March 14, 2025 02:34
Logging in powershell with log rotation
# all logging settins are here on top
$logFile = "log-$(gc env:computername).log"
$logLevel = "DEBUG" # ("DEBUG","INFO","WARN","ERROR","FATAL")
$logSize = 1mb # 30kb
$logCount = 10
# end of settings
function Write-Log-Line ($line) {
Add-Content $logFile -Value $Line
Write-Host $Line
@kslimani
kslimani / ixgbe_debian.md
Last active April 15, 2025 08:27
Debian ixgbe module compilation
@hollodotme
hollodotme / convert_databases_utf8.php
Last active April 8, 2024 23:13
Converting mysql string data form latin1 to utf8 for utf8 data stored in utf8 tables via latin1 connection
<?php
/**
* Requires php >= 5.5
*
* Use this script to convert utf-8 data in utf-8 mysql tables stored via latin1 connection
* This is a PHP port from: https://gist.github.com/njvack/6113127
*
* @link : http://www.ridesidecar.com/2013/07/30/of-databases-and-character-encodings/
*
* BACKUP YOUR DATABASE BEFORE YOU RUN THIS SCRIPT!
@igorcosta
igorcosta / cpf_cnpj_validator
Created June 26, 2014 19:13
Regex para validar CPF e CNPJ
Para CPF
/^\d{3}\.\d{3}\.\d{3}\-\d{2}$/
Para CNPJ
/^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/
Para ambos ao mesmo tempo
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 11, 2025 17:09
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@phobos182
phobos182 / haproxy.conf
Created July 17, 2012 23:19
LogStash Configuration for HAProxy
input {
syslog {
type => "haproxy-access"
port => 514
}
}
filter {
grok {
type => "haproxy-access"