Skip to content

Instantly share code, notes, and snippets.

@leonirlopes
leonirlopes / mask.php
Created April 20, 2018 19:32
Máscara PHP para CNPJ, CPF, Data e qualquer outra coisa
<?php
// PHP Máscara CNPJ, CPF, Data e qualquer outra coisa
// http://blog.clares.com.br/php-mascara-cnpj-cpf-data-e-qualquer-outra-coisa/
// ver em funcionamento ~~> https://ideone.com/wP7zN2
function mask($val, $mask)
{
$maskared = '';
$k = 0;
#!/bin/bash
iatest=$(expr index "$-" i)
#######################################################
# SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me
#######################################################
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
@reallytiredofclowns
reallytiredofclowns / discuitstats.py
Last active April 18, 2024 19:20
Discuit activity summary script
# to do: error checking/resumption code (can use pagination cursor of post to determine when script paused?)
# clean up repetition
# timing issue: if fetching by latest, someone can make a comment
# that puts a post out of the date limits before the looping
# has a chance to fetch the post
# do a second sweep after hitting the date limit?
# would have to store the script's start time and figure out
# when it halts due to hitting the lower date limit and
# reprocess comments according to that...
@jaxgeller
jaxgeller / linuxtools.sh
Created September 15, 2015 21:05
Install linux tools ubuntu
apt-get update && apt-get upgrade -y && \
apt-get install -y \
linux-tools-common
linux-tools-generic
linux-cloud-tools-generic
linux-tools-`uname -r`
linux-cloud-tools-`uname -r`
@baudneo
baudneo / Proxmox email relay.md
Last active April 18, 2024 19:18 — forked from tomdaley92/README.md
Proxmox - Email Alerts Setup (gmail)

Proxmox - Email Alerts Setup (gmail)

  1. SSH into proxmox node and become root user. Run the following commands to download extra software dependencies we'll need.

    apt update
    apt install -y libsasl2-modules mailutils
  2. Enable 2FA for the gmail account that will be used by going to security settings

@vratiu
vratiu / .bash_aliases
Last active April 18, 2024 19:18
Git shell coloring
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@mywarr
mywarr / AccessDump.py
Last active April 18, 2024 19:14
use mdbtools to convert .mdb to .sqlite and .csv
#!/usr/bin/env python
#
# AccessDump.py
# A simple script to dump the contents of a Microsoft Access Database.
# It depends upon the mdbtools suite:
# http://sourceforge.net/projects/mdbtools/
import sys, subprocess, os
DATABASE = sys.argv[1]
@steve-todorov
steve-todorov / gist:3671626
Created September 8, 2012 03:41
PHP Array key search for matching string.
<?php
/**
* Search through an array for a matching key.
*
* Examples:
* <code>
* $array = array(
* "database.name" => "my_db_name",
* "database.host" => "myhost.com",
@tecoholic
tecoholic / wireshark_http_extractor.py
Created February 6, 2019 07:56
Extract the flow of requests and responses from a Wireshark dump JSON exported file
import sys
import json
from urllib.parse import urlparse, parse_qs
def parse_multimap(ordered_pairs):
"""JSON loads object_pairs_hook, which creates a list of values when
duplicate keys are found in the JSON file being parsed