Skip to content

Instantly share code, notes, and snippets.

View eagle26's full-sized avatar
💪
Giving the extra mile!!

Jose Rivera eagle26

💪
Giving the extra mile!!
View GitHub Profile
@eagle26
eagle26 / positionStack.php
Created November 4, 2021 23:46
PositionStack script to convert a free-text address or place to location data.
/**
* Class positionStack
* Forward Geocoding
* A simple class that uses the "positionstack" API to convert a free-text address or place to location data.
* To get an API token visit "https://positionstack.com/"
*/
class positionStack{
const API_KEY = 'YOUR_API_KEY';
const API_URL = 'http://api.positionstack.com/v1/forward';
const SECURE_API_URL = 'https://api.positionstack.com/v1/forward';
@eagle26
eagle26 / fail2ban-clean-db
Last active June 19, 2019 22:05 — forked from mitchellkrogza/fail2ban-reset-log-db.sh
Bash script to reset Fail2Ban - clears / truncates log file and deletes the sqlite database - stops and restarts service during this process.
#!/bin/bash
# Bash Script by https://gist.github.com/mitchellkrogza
# ************************************************************
# This script clears the log file and database of Fail2Ban
# This resets Fail2Ban to a completely clean state
# Useful to use after you have finished testing all your jails
# and completed your initial setup of Fail2Ban and are now
# putting the server into LIVE mode
# ************************************************************
@eagle26
eagle26 / entropy.js
Last active February 7, 2019 17:01 — forked from jabney/entropy.js
Javascript implementation of a Shannon entropy calculation in bits per symbol
// entropy.js MIT License © 2014 James Abney http://github.com/jabney
// Calculate the Shannon entropy of a string in bits per symbol.
(function(shannon) {
'use strict';
// Create a dictionary of character frequencies and iterate over it.
function process(s, evaluator) {
var h = Object.create(null), k;
s.split('').forEach(function(c) {