Skip to content

Instantly share code, notes, and snippets.

package kikaha.mojo;
import java.io.*;
import java.net.URL;
import java.security.CodeSource;
import java.util.HashSet;
import java.util.Set;
import com.amazonaws.auth.*;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.codedeploy.*;
@roneigebert
roneigebert / Instruções SWAP Linux
Last active October 5, 2020 19:47
Configurar SWAP
1. Executar os comandos:
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
mkswap /var/swap.1
chmod 600 /var/swap.1
swapon /var/swap.1
2. Editar o /etc/fstab adicionando a linha:
/var/swap.1 none swap sw 0 0
3. Comandos p/ verificar:
@roneigebert
roneigebert / AttachTgToAsgAfterDeploy.sh
Last active April 6, 2021 15:18
Attach TG to ASG after deploy + monitoring
#!/bin/sh
get_instance_region() {
echo $(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | awk -F '"' '/\"region\"/ { print $4 }')
}
get_instance_id() {
curl -s http://169.254.169.254/latest/meta-data/instance-id
return $?
}
<profiles>
<profile>
<id>run-app</id>
<properties>
<config.skip.tests>true</config.skip.tests>
</properties>
<build>
<plugins>
<plugin>
<groupId>io.skullabs.kikaha</groupId>
@roneigebert
roneigebert / query-params.js
Last active March 30, 2019 22:24
JS utilities
// Get query parameters with js
var QueryParameters = {
all: function() {
var result = {}
location.search.substr(1).split("&").forEach(function (item) {
var keyValue = item.split("=")
result[keyValue[0]] = decodeURIComponent(keyValue[1])
})
app.factory('utils', function() {
return {
validCpf: function(cpf) {
if ( !cpf || cpf.length != 11
|| cpf == "00000000000"
|| cpf == "11111111111"
|| cpf == "22222222222"
|| cpf == "33333333333"
|| cpf == "44444444444"
|| cpf == "55555555555"
character_set_client: utf8
character_set_connection: utf8
character_set_database: utf8
character_set_filesystem: binary
character_set_results: utf8
character_set_server: utf8
collation_connection: utf8_unicode_ci
collation_server: utf8_unicode_ci
init_connect: set time_zone = '-03:00';
@roneigebert
roneigebert / Csv.php
Last active June 14, 2016 18:33
Php Csv
<?php
class Csv{
private $output;
private $delimiter;
function __construct($file_name, $delimiter = ';'){
$this->output = fopen('php://output', 'w');
$this->delimiter = $delimiter;
#!/usr/bin/python
from BaseHTTPServer import BaseHTTPRequestHandler
import SocketServer
import logging
PORT = 80
class ServerHandler(BaseHTTPRequestHandler):
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName host-origem-na-porta-80.com.br
ProxyPass / http://host-de-destino:8080/
ProxyPassReverse / http://host-de-destino:8080/
</VirtualHost>