Skip to content

Instantly share code, notes, and snippets.

@ErnestoRB
ErnestoRB / compose.yaml
Created October 11, 2023 21:45
Oracle Database Express on Docker Compose
services:
database:
image: container-registry.oracle.com/database/express:latest
environment:
- ORACLE_PWD=PRUEBA123
volumes:
- ./data:/opt/oracle/oradata
ports:
- "1521:1521"
@ErnestoRB
ErnestoRB / ssh-agent.ps1
Created August 3, 2023 04:37
Change to OpenSSH on Windows git and add ssh-key to agent
# https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement
# By default the ssh-agent service is disabled. Configure it to start automatically.
# Make sure you're running as an Administrator.
Get-Service ssh-agent | Set-Service -StartupType Automatic
# Start the service
Start-Service ssh-agent
# This should return a status of Running
Get-Service ssh-agent
@ErnestoRB
ErnestoRB / compose.yaml
Created January 28, 2023 06:02
Interactive docker compose container
spigot:
build: .
stdin_open: true
tty: true
container_name: spigot
@ErnestoRB
ErnestoRB / utils.js
Created January 2, 2023 01:55
Draw image to specified width (node-canvas)
function draw(ctx, x,y, image, width, height){
ctx.save()
ctx.translate(x, y)
ctx.scale(width / image.width, height / image.height)
ctx.drawImage(image, 0, 0)
ctx.restore()
}
@ErnestoRB
ErnestoRB / menu.php
Last active October 25, 2022 16:33
Get current file last modified date php / Obtener ultima fecha de modificacion archivo actual
<div>
<?php
$nombre_archivo = __FILE__;
if (file_exists($nombre_archivo)) {
echo "La última modificación de $nombre_archivo fue: " . date("F d Y H:i:s.", filemtime($nombre_archivo) - (5* 60 *60) );
}
?>
</div>
@ErnestoRB
ErnestoRB / index.php
Created October 22, 2022 04:40
Get last modified post datetime PHP Wordpress
<?php
$last_date = get_lastpostmodified('blog'); // obtiene la fecha de la ultima modificacion a un post
$last_time = strtotime($last_date); // convierte a numeros para poderla formatear
echo "La última fecha de modificación fue el ". date("j / M / Y \a \l\a\s H:i:s", $last_time); // formatea
?>
@ErnestoRB
ErnestoRB / playername_to_UUID.js
Created July 3, 2022 05:05
Generate Minecraft OfflinePlayer UUID
const { exit } = require("process");
const createHash = require("crypto").createHash;
// Reads from cli
if (process.argv.length < 3) {
process.stdout.write("\n");
exit(1);
}
@ErnestoRB
ErnestoRB / pom.xml
Created June 10, 2022 04:06
Include all files into java packages with Maven
...
<build>
...
<resources>
...
<resource>
<directory>src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
@ErnestoRB
ErnestoRB / dec_to_hex.ts
Created April 14, 2022 00:15
Typescript decimal to hexadecimal conversion
function conversion(decimal: number): string {
let resultado: string = "";
const arreglo: number[] = [];
do {
arreglo.push(decimal % 16);
decimal = Math.floor(decimal / 16);
} while (decimal !== 0);
for (const digito of arreglo.reverse()) {
switch (digito) {
case 10: