This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from pydub import AudioSegment | |
from typing import Tuple | |
def segmento_audio_a_array_numpy( | |
segmento_audio: AudioSegment, | |
) -> Tuple[np.ndarray, int]: | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find /var/log -type f -iregex '.*[^\.][^0-9]+$' -not -iregex '.*gz$' 2> /dev/null | xargs tail -n0 -f | ccze -A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`. | |
# Please modify the CONSTANT variables to fit your configurations. | |
# The script will start with config set by $PUMA_CONFIG_FILE by default | |
PUMA_CONFIG_FILE=config/puma.rb | |
PUMA_PID_FILE=tmp/pids/puma.pid | |
PUMA_SOCKET=tmp/sockets/puma.sock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_keys_multi(array $array) | |
{ | |
$keys = array(); | |
foreach ($array as $key => $value) { | |
$keys[] = $key; | |
if (is_array($array[$key])) { | |
$keys = array_merge($keys, array_keys_multi($array[$key])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Just copy and paste the lines below (all at once, it won't work line by line!) | |
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY! | |
function abort { | |
echo "$1" | |
exit 1 | |
} | |
set -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Code snippet to extract the icon from an exe file on a Linux system -- tested on Debian Wheezy | |
// Install icoutils on your system e.g. sudo apt-get install icoutils | |
// Web process must have write privileges to /tmp | |
///** Config **/// | |
$input_file = '/path/to/program.exe'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
iptables -N SSH_CHECK | |
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j SSH_CHECK | |
iptables -A SSH_CHECK -m recent --set --name SSH | |
iptables -A SSH_CHECK -m recent --update --seconds 60 --hitcount 4 --name SSH -j DROP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
tar -cvpzf /backup/backup$(date +%d-%m-%Y).tar.gz --exclude=backup --exclude=bin --exclude=boot --exclude=dev --exclude=lib --exclude=lost+found --exclude=media --exclude=mnt --exclude=opt --exclude=proc --exclude=sbin --exclude=selinux --exclude=srv --exclude=sys --exclude=tmp --exclude=usr --exclude=var/backup --exclude=var/backups --exclude=var/cache --exclude=var/crash --exclude=var/lib --exclude=var/local --exclude=var/lock --exclude=var/log --exclude=var/mail --exclude=var/opt --exclude=var/run --exclude=var/spool --exclude=var/tmp --exclude=var/vmail / | |
mysqldump -u root -p --all-databases | gzip > /backup/backup-database_$(date '+%m-%d-%Y').sql.gz | |
cd /backup/ | |
for i in $(ls backup*); do dropbox_upload.sh upload $i /backup/*; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('form').validate( | |
{ | |
rules: { | |
numero: { | |
required: true | |
}, | |
descricao: { | |
minlength: 3, | |
email: true, | |
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- first try HTML5 playback: if serving as XML, expand `controls` to `controls="controls"` and autoplay likewise --> | |
<!-- warning: playback does not work on iOS3 if you include the poster attribute! fixed in iOS4.0 --> | |
<video width="640" height="360" controls> | |
<!-- MP4 must be first for iPad! --> | |
<source src="__VIDEO__.MP4" type="video/mp4" /><!-- Safari / iOS video --> | |
<source src="__VIDEO__.OGV" type="video/ogg" /><!-- Firefox / Opera / Chrome10 --> | |
<!-- fallback to Flash: --> | |
<object width="640" height="360" type="application/x-shockwave-flash" data="__FLASH__.SWF"> | |
<!-- Firefox uses the `data` attribute above, IE/Safari uses the param below --> | |
<param name="movie" value="__FLASH__.SWF" /> |
NewerOlder