Skip to content

Instantly share code, notes, and snippets.

View UlisesGascon's full-sized avatar
😎
Focus on FOSS Projects!

Ulises Gascón UlisesGascon

😎
Focus on FOSS Projects!
View GitHub Profile
@UlisesGascon
UlisesGascon / README.md
Created July 21, 2024 15:21
Bash script to create an isolated environment using namespaces and cgroups

Isolate Script

This script creates an isolated environment using Linux namespaces and cgroups, executes a provided Bash script, and then cleans up the environment. It ensures that any changes made within the isolated environment do not affect the host system.

How It Works

  1. Argument Check: The script checks if a Bash script file is provided as an argument.
  2. File Existence Check: It verifies if the provided file exists.
  3. Cgroup Creation: A cgroup is created to limit the number of processes to 50.
  4. Namespace Creation: The script creates new PID and UTS namespaces using unshare.
@UlisesGascon
UlisesGascon / THANKS.md
Created January 6, 2022 19:01
Thank you! 💖

Thanks to all of you for making *.ulisesgascon.com possible

Special Thanks

Nextjs based subdomains

@UlisesGascon
UlisesGascon / example.py
Created October 24, 2022 12:56 — forked from eddieantonio/example.py
Zero-dependency Python 3 and Node IPC using UNIX sockets
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import socket
import json
server_address = '/tmp/example.sock'
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect(server_address)
@UlisesGascon
UlisesGascon / commands_docusaurus_translation.md
Created July 7, 2022 13:44 — forked from FedericoTartarini/commands_docusaurus_translation.md
Source code for the YouTube video - Translate a Docusaurus website in multiple languages with its internationalization (i18n) support.

Initialize a new site

with npx @docusaurus/init@latest init website classic

Configure your site

i18n: {
    defaultLocale: 'en',
    locales: ['en', 'it'],
    localeConfigs: {
      en: {
@UlisesGascon
UlisesGascon / README.MD
Created June 7, 2022 06:30 — forked from lmarkus/README.MD
Extracting / Exporting custom emoji from Slack

Extracting Emoji From Slack!

Slack doesn't provide an easy way to extract custom emoji from a team. (Especially teams with thousands of custom emoji) This Gist walks you through a relatively simple approach to get your emoji out.

If you're an admin of your own team, you can get the list of emoji directly using this API: https://api.slack.com/methods/emoji.list. Once you have it, skip to Step 3

HOWEVER! This gist is intended for people who don't have admin access, nor access tokens for using that list.

Follow along...

@UlisesGascon
UlisesGascon / nvm_zsh.md
Created April 7, 2022 08:16
nvm in zsh always available
  1. git clone https://github.com/lukechilds/zsh-nvm ~/.oh-my-zsh/custom/plugins/zsh-nvm
  2. Add the zsh-nvm plugin to your .zshrc folder

Full guide

@UlisesGascon
UlisesGascon / opencv.sh
Created October 23, 2016 13:37 — forked from priyank/opencv.sh
Script to install OpenCV on Raspberry Pi
export DEBIAN_FRONTEND=noninteractive
sudo apt-get -q -y update
sudo apt-get -q -y install build-essential
sudo apt-get -q -y install cmake
sudo apt-get -q -y install pkg-config
sudo apt-get -q -y install libpng12-0 libpng12-dev libpng++-dev libpng3
sudo apt-get -q -y install libpnglite-dev libpngwriter0-dev libpngwriter0c2
sudo apt-get -q -y install zlib1g-dbg zlib1g zlib1g-dev
sudo apt-get -q -y install pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools
sudo apt-get -q -y install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-progs
@UlisesGascon
UlisesGascon / do_setup.sh
Last active December 23, 2020 09:02
Digital Ocean with Docker Compose a Nodejs
#!/bin/sh
echo "START: Installing dependencies for Node, Docker and Docker Compose in DO"
cd /home
mkdir WORKSPACE
cd WORKSPACE
# Nodejs
# https://github.com/nodesource/distributions/blob/master/README.md
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
@UlisesGascon
UlisesGascon / bootstrap-starter-template.html
Created July 13, 2016 08:59
Bootstrap starter-template with cdnjs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
@UlisesGascon
UlisesGascon / database_magic.md
Created August 20, 2020 06:06
Dump, compare and check db integrity

Database Backup and comparation

Dump Postgres DB

pg_dump --data-only --inserts -h <DB_URL> -U <DB_USER> -f <FILE_NAME_TO_CREATE.sql> <DB_NAME>

Notes:

  • --data-only will dump only data to be inserted (not tables strcuture and relations)
  • --inserts will force to use INSERT statements and not COPY to avoid driver issues later on