Skip to content

Instantly share code, notes, and snippets.

View itsalb3rt's full-sized avatar
🐋

Albert E. Hidalgo Taveras itsalb3rt

🐋
View GitHub Profile
@itsalb3rt
itsalb3rt / OracleOpenPort80Centos.md
Created October 15, 2021 03:28 — forked from jbaranski/OracleOpenPort80Centos.md
Open Port 80 Oracle Cloud Compute Instance (CentOS)

Open Port 80 Oracle Cloud Compute Instance (CentOS)

FYI This was harder than it needed to be:

  1. Looking at your instance info, find VNIC section, click "Public Subnet".
  2. Click on your security list.
  3. Add a new entry with the following options:
  • "Stateless" = No, "Source" = 0.0.0.0/0, "IP Protocol" = TCP, "Source Port Range" = All, "Destination Port Range" = 80
  1. SSH to your instance.
  2. While SSH'ed in your instance, run command firewall-cmd --permanent --add-service=http.
  3. While SSH'ed in your instance, run command firewall-cmd --reload.
  4. Now start Apache, NGINX, or whatever server you need to on port 80. You can now access from the internet.
@itsalb3rt
itsalb3rt / download-file.js
Created November 23, 2020 23:57 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@itsalb3rt
itsalb3rt / index.js
Created August 1, 2020 23:35
Object deep comparation
/**
* Deep object comparation
*
* https://dmitripavlutin.com/how-to-compare-objects-in-javascript/
*/
export default {
methods: {
deepEqual (object1, object2) {
const keys1 = Object.keys(object1)
const keys2 = Object.keys(object2)
@itsalb3rt
itsalb3rt / markdown-details-collapsible.md
Created May 26, 2020 00:21 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@itsalb3rt
itsalb3rt / index.js
Created May 18, 2020 15:57
Send Authorization header for get audio file or something
const fetchAudioFile = async (url, authorizationToken) => {
const result = await fetch(url, {
headers: {
Authorization: authorizationToken
},
});
const blob = await result.blob();
return URL.createObjectURL(blob)
}

Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

This guide will walk you through the steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest.

Prerequisites

This guide assumes that you are using the following setup:

You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot).

@itsalb3rt
itsalb3rt / group-objects-by-property.md
Created December 30, 2019 14:13 — forked from JamieMason/group-objects-by-property.md
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@itsalb3rt
itsalb3rt / gist:029a5e40aed74b1b515b56893c8a8a77
Created November 3, 2019 03:20 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@itsalb3rt
itsalb3rt / cryptographically_secure_random_strings.php
Created October 28, 2019 21:31 — forked from raveren/cryptographically_secure_random_strings.php
Generate cryptographically secure random strings. Based on Kohana's Text::random() method and this answer:http://stackoverflow.com/a/13733588/179104
function random_text( $type = 'alnum', $length = 8 )
{
switch ( $type ) {
case 'alnum':
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'alpha':
$pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'hexdec':
@itsalb3rt
itsalb3rt / index.js
Created October 12, 2019 22:36
replace all occurrences with special characters
console.log( 'my string {{ID}} and other {{ID}}'.replace(/{{ID}}/gi,1));