This file contains hidden or 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
alarm: slave_down | |
on: system.cpu | |
calc: $now - $last_collected_t | |
units: seconds ago | |
every: 10s | |
warn: $this > (($status >= $WARNING) ? ($update_every) : ( 5 * $update_every)) | |
crit: $this > (($status == $CRITICAL) ? ($update_every) : (60 * $update_every)) | |
info: number of seconds since the last successful data collection | |
to: sysadmin |
This file contains hidden or 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
# Entrar no servidor e fora da pasta do projeto | |
$ git init --bare repo | |
Criar hooks post-receive | |
$ cd repo/hooks | |
$ nano post-receive | |
## Adicionar no arquivo |
This file contains hidden or 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
#ifndef __dbg_h__ | |
#define __dbg_h__ | |
#include <stdio.h> | |
#include <errno.h> | |
#include <string.h> | |
#ifdef NDEBUG | |
#define debug(M, ...) | |
#else |
This file contains hidden or 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
function filter_by_value ($array, $index, $value){ | |
if(is_array($array) && count($array)>0) | |
{ | |
foreach(array_keys($array) as $key){ | |
$temp[$key] = $array[$key][$index]; | |
if ($temp[$key] == $value){ | |
$newarray[$key] = $array[$key]; | |
} |
This file contains hidden or 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 | |
#Wget Phantomjs | |
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 | |
#Extract files | |
tar -xf phantomjs-2.1.1-linux-x86_64.tar.bz2 | |
#Change to dir | |
cd phantomjs-2.1.1-linux-x86_64 |
This file contains hidden or 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
~// WARNING: The command DOES NOT WORK if you don't have root access to yout network device. Prepend sudo if you are not root. \\~ | |
Use TCPDUMP to Monitor HTTP Traffic | |
1. To monitor HTTP traffic including request and response headers and message body: | |
tcpdump -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' | |
2. To monitor HTTP traffic including request and response headers and message body from a particular source: | |
tcpdump -A -s 0 'src example.com and tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' |
This file contains hidden or 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
function varpost($endpoint, $data){ | |
$ch = curl_init($endpoint); | |
curl_setopt_array($ch, array( | |
CURLOPT_POST => TRUE, | |
CURLOPT_RETURNTRANSFER => TRUE, | |
CURLOPT_HTTPHEADER => array( | |
'Content-Type: application/json' | |
), | |
CURLOPT_POSTFIELDS => json_encode($data) | |
)); |
This file contains hidden or 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
du -sh dir/ | sort -hr | head -n10 |
This file contains hidden or 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
defmodule R do | |
def reload! do | |
Mix.Task.reenable "compile.elixir" | |
Application.stop(Mix.Project.config[:app]) | |
Mix.Task.run "compile.elixir" | |
Application.start(Mix.Project.config[:app], :permanent) | |
end | |
end |
This file contains hidden or 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
defmodule Palindromes do | |
def run do | |
["amor", "roma", "phoenix", "mora", "elixir"] | |
|> Enum.group_by(&canonicalize/1) | |
|> IO.inspect | |
end | |
defp canonicalize(word) do | |
word | |
|> String.graphemes |
NewerOlder