Skip to content

Instantly share code, notes, and snippets.

View IlanVivanco's full-sized avatar
💡
Coding!

Ilán Vivanco IlanVivanco

💡
Coding!
View GitHub Profile
@IlanVivanco
IlanVivanco / clean_slack.py
Last active January 27, 2022 08:18
Deletes files older than N days. You can also filter them by size. Forked from https://gist.github.com/jackcarter/d86808449f0d95060a40
# Idea taken from https://gist.github.com/jackcarter/d86808449f0d95060a40
import time
import codecs
import requests
reader = codecs.getreader("utf-8")
# Obtain your's by creating a Slack app on https://api.slack.com/apps?new_app=1 and assign that to your workspace.
# Within this new app, go to "OAuth & Permissions" and in the section "Scopes > User Token Scopes" add the "files:read" and "files:write" Oauth scopes.
# Finally, you can now go to the top of the page and install the app to the workspace. After that you'll get the User OAuth Token that you can use on the script.
@IlanVivanco
IlanVivanco / BulmaModal.js
Last active April 5, 2021 14:21
Basic Javascript example for Bulma modals.
class BulmaModal {
constructor(modalButton) {
const target = modalButton.dataset.target;
if (target) {
this.button = modalButton;
this.modal = document.querySelector(target);
this.html = document.querySelector("html");
this.openEvent();
@IlanVivanco
IlanVivanco / .htaccess
Last active March 20, 2023 17:07
Rewrite local images to remote server.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^camunda\.test$
RewriteRule ^wp-content/uploads/(.*)$ https://camunda.com/wp-content/uploads/$1 [NC,L]
</IfModule>
@IlanVivanco
IlanVivanco / dotenv.sh
Last active April 8, 2021 17:50
Load environment variables from dotenv file in Bash
dotenv () {
set -a
[ -f .env ] && . .env
set +a
}
dotenv
# Create secure key
ssh-keygen -t rsa -b 4096 -C "key_identifier"
# Upload key to server
ssh-copy-id -i ~/.ssh/id_rsa.pub user@host.com
REM WSL symlink guide here https://dev.to/themartes_/how-to-make-wsl2-even-faster-with-fast-git-28p8
REM ---------------------
REM Now when we have our script we need to run it every time we boot into our machine. We also need to do that with the highest privileges because you need to be an admin to make a symlink from network drive to your base drive.
REM So go ahead and search for Task Scheduler. On the left sidebar you will see Task Scheduler Library. Click on it and on the right sidebar click on Create Task....
REM Now make sure you'll give a name to your task, then write a little description and Check "Run with highest privileges". Also make sure you'll change Configure for: To Windows10
REM Next click on Triggers tab and add new trigger. This will look fairly simple, Just make sure it's like this, and click OK.
REM Next click on Actions add New and Select the .bat script we created earlier with the following code:
REM ---------------------
@echo off
@IlanVivanco
IlanVivanco / settings.json
Last active August 18, 2020 17:57
Windows Terminal Settings
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
"initialCols": 120,
"initialRows": 30,
"copyOnSelect": true,
"profiles": {
"defaults": {
"acrylicOpacity": 0.85,
"cursorColor": "#CCC",
@IlanVivanco
IlanVivanco / wp_debug_snippet.php
Last active June 8, 2021 14:24
WP debug snippets
<?php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
// Logs the nmae of the function
error_log( '>>> IN ' . __FUNCTION__ );
@IlanVivanco
IlanVivanco / download.sh
Last active April 14, 2020 13:30
Download images from URL from list
while read -r url name ; do
wget -O $name $url
done < images.txt
@IlanVivanco
IlanVivanco / data.js
Last active March 16, 2021 13:29
Get certain data from element page
‎‎​let data = [];
$('[id^=form_19]').each((i, e) => {
let elm = $(e).find('> form');
data.push(elm.data('formId'))
});
copy(data);