Skip to content

Instantly share code, notes, and snippets.

View tiago-peres's full-sized avatar
🏠
Working from home

Tiago Peres tiago-peres

🏠
Working from home
View GitHub Profile

What is possible?

Slash commands offer a way to integrate your bot commands directly into the Discord UI. However, these commands are still very limited and cannot replace every use-case for now. I'll explain the limitations and possibilities of this new feature a bit here.

Slash Commands work entirely through the Webhook API. Which introduces a number of moderation issues. See the Moderation section below. It also causes some Rate Limit Problems.

Things you can do with slash commands

  • Simple Q/A type commands that just take an input and return an answer
  • Simple commands that have side-effects such as kick/ban/music
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
</head>
<h1>Some places I have visited over the years:</h1>
<div id="folium"></div>
<body>
<py-config>
packages = ["folium"]
library(rayshader)
library(rayrender)
popdata = raster::raster("gpw_v4_population_density_rev11_2020_15_min.tif")
population_mat = rayshader:::flipud(raster_to_matrix(popdata))
above1 = population_mat > 1
above5 = population_mat > 5
above10 = population_mat > 10
@tiago-peres
tiago-peres / multipart.rst
Created March 14, 2022 21:33 — forked from vytas7/multipart.rst
Multipart form handling in Falcon proposal

multipart/form-data handling in Falcon proposal

Design philosophy

Multipart form handling should be performant, straightforward, and leave full control of the parsing process to the user, i.e. no surprising magic such as automatic creation of large files and saving anything there by default (although tools/helpers may exist to assist in that too).

@tiago-peres
tiago-peres / knownpaths.py
Created January 4, 2021 09:34 — forked from mkropat/knownpaths.py
Python wrapper around the SHGetKnownFolderPath Windows Shell function
import ctypes, sys
from ctypes import windll, wintypes
from uuid import UUID
class GUID(ctypes.Structure): # [1]
_fields_ = [
("Data1", wintypes.DWORD),
("Data2", wintypes.WORD),
("Data3", wintypes.WORD),
("Data4", wintypes.BYTE * 8)
@tiago-peres
tiago-peres / node_nginx_ssl.md
Created September 18, 2020 11:22 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@tiago-peres
tiago-peres / devcamper_specs.md
Created September 18, 2020 09:19 — forked from bradtraversy/devcamper_specs.md
Specs for Devcamper Udemy course project

DevCamper Backend API Specifications

Create the backend for a bootcamp directory website. The frontend/UI will be created by another team (future course). The html/css template has been created and can be used as a reference for functionality. All of the functionality below needs to be fully implmented in this project.

Bootcamps

  • List all bootcamps in the database
    • Pagination
    • Select specific fields in result
    • Limit number of results
  • Filter by fields
@tiago-peres
tiago-peres / Windows_Tools_Clean.md
Last active January 7, 2021 13:05 — forked from goncaloperes/Windows_Tools_Clean
Windows Alternative for Clean Up Tools
  1. Disk cleanup.

  2. Open run then use the %TEMP% command and delete every file in there. Windows won't delete anything it needs

  3. Open up run again but this time use the prefetch command and delete everything in this folder. Again, Windows won't delete anything it needs.

  4. If there's memory issues (Windows telling you you're running out of memory when opening a lot of different apps), increase the virtual memory. For example, if you have 4GB of RAM, do 1024 x 4 so that would be 4096 then take that number and multiply by 2 and get 8192 so initial size would be 8192 and max size would be 91992.

  5. Run msconfig, go to boot tab, then advanced options, check the number or processors box and then change the number to the number of processors you have. Also check the max memory box. Uncheck anything in startup you don't need as well.

<?php
// generate private/public key as follows:
// > openssl genrsa -out private.pem 2048
// > openssl rsa -in private.pem -outform PEM -pubout -out public.pem
$data = "String to encrypt";
$privKey = openssl_pkey_get_private('file:///path/to/private.pem');
$encryptedData = "";