Skip to content

Instantly share code, notes, and snippets.

@jean-bonilha
jean-bonilha / getLocalIP.js
Created August 1, 2023 18:12 — forked from hectorguo/getLocalIP.js
Get local IP address through Javascript
/**
* Get Local IP Address
*
* @returns Promise Object
*
* getLocalIP().then((ipAddr) => {
* console.log(ipAddr); // 192.168.0.122
* });
*/
function getLocalIP() {
@jean-bonilha
jean-bonilha / algorithms.txt
Last active May 19, 2023 06:05
List of Algorithms from algoexpert.io 2023-05
Validate Subsequence
Two Number Sum
Sorted Squared Array
Tournament Winner
Non-Constructible Change
Find Closest Value In BST
Branch Sums
Node Depths
Evaluate Expression Tree
Depth-first Search
@jean-bonilha
jean-bonilha / main.go
Last active April 15, 2023 06:11
Microsoft Access with Golang
package main
import (
"database/sql"
"fmt"
"os"
_ "github.com/mattn/go-adodb"
)
package main
import "os"
func makeDirectoryIfNotExists(path string) error {
if _, err := os.Stat(path); os.IsNotExist(err) {
return os.Mkdir(path, os.ModeDir|0755)
}
return nil
}
@jean-bonilha
jean-bonilha / go-anagram.go
Last active April 5, 2022 07:46
Go lang anagram exaple
package main
import (
"fmt"
"sort"
"strings"
)
func isAnagram(a string, b string) bool {
if len(a) != len(b) {
@jean-bonilha
jean-bonilha / active-window.go
Created December 28, 2021 19:41 — forked from obonyojimmy/active-window.go
Go lang get current foreground window
package main
import (
"fmt"
"syscall"
"unsafe"
"golang.org/x/sys/windows"
)
var (
@jean-bonilha
jean-bonilha / api.php
Created September 28, 2021 23:02 — forked from pixelbrackets/api.php
Simple PHP script to test and use cURL
<?php
/**
* Simple request response script
*
* Point you cURL request to this script to see all incoming data
*/
echo '*API*'. PHP_EOL;
@jean-bonilha
jean-bonilha / url_check.php
Created September 28, 2021 23:02 — forked from aalfiann/url_check.php
PHP Curl to check is url exist or not (support redirected url)
<?php
/**
* Determine that url is exists or not
*
* @param $url = The url to check
**/
function url_exists($url) {
$result = false;
$url = filter_var($url, FILTER_VALIDATE_URL);
@jean-bonilha
jean-bonilha / Dockerfile
Last active September 16, 2021 07:57
Build image node:12 with Oracle connection v11.2+
FROM node:14
#INSTALL LIBRIRIES (NEEDED FOR STRONG-ORACLE)
RUN apt-get update \
&& ln -fs /usr/share/zoneinfo/America/Manaus /etc/localtime \
&& apt-get install -y libaio1 \
&& apt-get install -y alien \
&& apt-get install -y wget \
&& apt-get install -y build-essential \
&& apt-get install -y unzip \
@jean-bonilha
jean-bonilha / remove-php-script.sh
Last active October 13, 2020 00:51
A simple script to remove PHP script form html file
#!/bin/bash
TIME=$(date +%s);
FILE=$1
TMPFILENAME="temp.$TIME.$FILE";
sed -e 's/<?php.*?>//g' $FILE > $TMPFILENAME;
sed -e '/<?php/,/?>/d' $TMPFILENAME > "$(basename "$FILE" .php).html";