Skip to content

Instantly share code, notes, and snippets.

The following promtpt was used to generate HTML/CSS code for a live stream webpage:

Write an html page. Add a h1 element for the title. The title should be centered in the top of the screen. Add a videos grid at the left of the screen. The videos grid should cover 80% of the horizontal space of the screen. In the remaining 20% add a chat where each message is a p element. The chat height should be fixed and a scroll bar should be added when needed. Fixed at the bottom of the chat add a text input and a button that allows to add new messages. 

When there is only one video in the videos grid, it should cover the whole grid. When there a two videos these should cover half of the grid each one, when there are three or more videos these should be rendered in a 3x3 grid.

Use a nice font with light gray background.

And here's what ChatGPT replied:

youtube-dl -x --audio-format mp3 --add-metadata https://music.youtube.com/watch?v=2TwNwTXUNRw
@nuxero
nuxero / convertToGif.sh
Created July 12, 2019 17:31
Script for creating gifs from videos
#!/bin/bash
if [ -z $1 ] | [ -z $2 ] | [ -z $3 ]; then
echo "Usage: convertToGif.sh file.mp4 640:480 outputfile"
exit 1
fi
ffmpeg -i $1 -vf scale=$2 $3.gif -hide_banner
@nuxero
nuxero / 00_force_https.config
Created April 10, 2018 22:32
Force https using ebextensions
files:
"/tmp/nginx_https_rw.sh":
owner: root
group: root
mode: "000644"
content: |
#! /bin/bash
CONFIGURED=`grep -c "return 301 https" /etc/nginx/sites-available/elasticbeanstalk-nginx-docker-proxy.conf`
@nuxero
nuxero / delete
Last active February 23, 2018 16:40
delete all tables postgresql
CREATE OR REPLACE FUNCTION delete_tables(username IN VARCHAR) RETURNS void AS $$
DECLARE
statements CURSOR FOR
SELECT tablename FROM pg_tables
WHERE tableowner = username AND schemaname = 'public';
BEGIN
FOR stmt IN statements LOOP
EXECUTE 'DROP TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;';
END LOOP;
END;
@nuxero
nuxero / truncate
Created February 21, 2018 17:55
truncate all tables postgresql
CREATE OR REPLACE FUNCTION truncate_tables(username IN VARCHAR) RETURNS void AS $$
DECLARE
statements CURSOR FOR
SELECT tablename FROM pg_tables
WHERE tableowner = username AND schemaname = 'public';
BEGIN
FOR stmt IN statements LOOP
EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;';
END LOOP;
END;

Systemd

sample.service file you have to copy it to /etc/systemd/system

Set it to auto start

sudo systemctl enable sample.service

Troubleshoot

@nuxero
nuxero / gist:914658220977f8e5279b1de912b4184a
Created November 28, 2017 17:29 — forked from Maarten-Wijnants/gist:ec4a3e9e65504e7e67a0873dca353871
Ubuntu 14.04 Asterisk server installation
https://www.odoo.com/apps/modules/8.0/crm_voip/
# Install asterisk server on Ubuntu 14.04
# 1. Install dependencies
sudo apt-get update
sudo apt-get install wget
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install ncurses-dev
@nuxero
nuxero / node-ubuntu-upstart-service.md
Created November 4, 2017 13:29 — forked from willrstern/node-ubuntu-upstart-service.md
Run Node.js App as Ubuntu Upstart Service

###The Issue With Forever Forever is great for running node services, with a minor setback: the word "forever" doesn't apply to system reboots.

###The solution, run node apps as a system service logged in as root

vim /etc/init/node-app.conf

Contents for node-app.conf

@nuxero
nuxero / self-signed.sh
Last active June 5, 2020 17:03
A script for generate self signed certs
openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")