Skip to content

Instantly share code, notes, and snippets.

View gravataLonga's full-sized avatar
🤓
Zig Nerding

Jonathan Fontes gravataLonga

🤓
Zig Nerding
View GitHub Profile
@gravataLonga
gravataLonga / main_test.go
Created October 28, 2022 22:15
Testing Overlapping date
package main
import (
"fmt"
"testing"
)
func TestOverlappingDate(t *testing.T) {
tests := []struct {
beginDateA string
@gravataLonga
gravataLonga / sodium.php
Last active December 16, 2020 15:47
sodium short usage
<?php
// Symmetric Encription
$msg = "ola";
$key = random_bytes(SODIUM_CRYPTO_SECRETBOX_KEYBYTES);
$nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
$cypher_text = sodium_crypto_secretbox($msg, $nonce, $key);
$plain_text = sodium_crypto_secretbox_open($cypher_text, $nonce, $key);
@gravataLonga
gravataLonga / hashes.js
Last active February 16, 2021 14:13
Library to handle Hash of URL.
let hashes = function () {
let _this = this;
let _SEPERATOR_KEY_VALUE = ":";
let _SEPERATOR_PAIR = "|";
this._OLD_HASHES = {};
@gravataLonga
gravataLonga / attemp.txt
Created July 4, 2019 13:03
attempped 301 brute force
103.115.42.179 - - [04/Jul/2019:13:40:43 +0100] "GET / 301
103.115.42.179 - - [04/Jul/2019:13:40:43 +0100] "GET /robots.txt 301
103.115.42.179 - - [04/Jul/2019:13:40:44 +0100] "POST /App2f2e3eb2.php 301
103.115.42.179 - - [04/Jul/2019:13:40:44 +0100] "GET /webdav/ 301
103.115.42.179 - - [04/Jul/2019:13:40:45 +0100] "GET /help.php 301
103.115.42.179 - - [04/Jul/2019:13:40:45 +0100] "GET /java.php 301
103.115.42.179 - - [04/Jul/2019:13:40:45 +0100] "GET /_query.php 301
103.115.42.179 - - [04/Jul/2019:13:40:46 +0100] "GET /test.php 301
103.115.42.179 - - [04/Jul/2019:13:40:46 +0100] "GET /db_cts.php 301
103.115.42.179 - - [04/Jul/2019:13:40:47 +0100] "GET /db_pma.php 301
@gravataLonga
gravataLonga / tips.txt
Created February 13, 2019 21:30
Proxy all conections to remote server with SSH
ssh -D 0.0.0.0:8888 user@remoteserver
@gravataLonga
gravataLonga / TableResult.js
Last active August 13, 2018 15:36
Table Result - Create a table on the fly with js
/**
* Usage:
* On the template, create the following html.
* <table class="table" data-table="dates" data-empty=".is-empty"><thead><tr><th data-key="Id"></th><th data-key="Media.0.LowRs|Media.0.HigRs" data-type="image"></tr></thead></table>
* <div class="is-empty" style="display:none;">The result was empty</div>
*
* Then, on the result of callback ajax request, call like TableResult('dates', result); Tadah!!!
* The rest is magic!
*/
(function($) {
@gravataLonga
gravataLonga / secure-my-server.sh
Created June 13, 2018 16:22
Securing my server Script
#!/bin/bash
set -o errexit
# Disclaimer: This is not the most secure configuration possible. This script
# is intended only to be more secure than the default configuration. No
# promises are made about this script preventing your server from getting
# owned or your bike getting stolen. The bad guys are still out to get you.
# And running this script does not excuse you from writing secure application
# code!
@gravataLonga
gravataLonga / compile-go.bash
Created June 11, 2018 11:15
Go Multiple Compile Os
#!/usr/bin/env bash
package=$1
if [[ -z "$package" ]]; then
echo "usage: $0 <package-name>"
exit 1
fi
package_split=(${package//\// })
package_name=${package_split[-1]}
@gravataLonga
gravataLonga / sendemail.php
Created June 11, 2018 11:09
Testing sending email
<?php
function mail_utf8(
$to_name,
$to,
$from_name,
$from,
$reply = '',
$subject = '(No subject)',
$message = ''
)
package main
import (
"log"
"fmt"
"net/smtp"
"bufio"
"os"
"strings"
)