Skip to content

Instantly share code, notes, and snippets.

@3v1n0
3v1n0 / vscode-unused-workspace-storage-cleanup.sh
Last active April 19, 2024 14:51
VSCode unused workspaceStorage cleanup
#!/bin/bash
CONFIG_PATH=~/.config/Code
for i in $CONFIG_PATH/User/workspaceStorage/*; do
if [ -f $i/workspace.json ]; then
folder="$(python3 -c "import sys, json; print(json.load(open(sys.argv[1], 'r'))['folder'])" $i/workspace.json 2>/dev/null | sed 's#^file://##;s/+/ /g;s/%\(..\)/\\x\1/g;')"
if [ -n "$folder" ] && [ ! -d "$folder" ]; then
echo "Removing workspace $(basename $i) for deleted folder $folder of size $(du -sh $i|cut -f1)"
@scriptdev
scriptdev / .php
Created October 2, 2021 00:31
OCULTAR CAMPOS DA LINHA NO FORMULÁRIO
<?php
// OCULTA CAMPOS DA LINHA NO FORMULÁRIO
BootstrapFormBuilder::hideField(self::$formName, 'nome_campo');
// MOSTRA CAMPOS DA LINHA NO FORMULÁRIO
BootstrapFormBuilder::showField(self::$formName, 'nome_campo');
// OCULTA CAMPOS DA LISTA NO TFIELDLIST
BootstrapFormBuilder::hideField(self::$formName, 'nome_campo[]');
@scriptdev
scriptdev / .php
Created October 6, 2021 02:18
ENVIO DE MENSAGEM NO WHATSAPP WEB
<?php
/*
Olá.. Neste tutorial eu vou mostrar como enviar mensagens da aplicação feita no Adianti Builder/FW para o Whatsapp Web.
Umas das dúvidas que eu tinha sobre o envio da mensagem era sobre a inclusão de figuras “Emoji” dentro da mensagem..
Pensei em por códigos unicodes das figuras, etc.. para depois converter usando alguma função PHP, etc..
O Bruno Constantino deu uma ótima dica de por a figura direto na string da variável.. ou seja, dentro da própria mensagem..
simples assim.. e funcionou!
Segue um exemplo:
*/
@ezklap
ezklap / iplog.py
Last active April 19, 2024 14:51
Apex Legends IP logger
from scapy.all import *
import time
from pynput.keyboard import Key, KeyCode, Listener
import socket
'''
A python 3 script that captures the game servers IP address written for Apex Legends
you can use this for any game just look at the UDP port via wireshark and change it
on the script.
Matchmaking issue : I wrote a python script that helped me log the game servers IP addresses i was connecting to, as I had noticed 2 out of 3 matches in ranked mode I was connecting to LAGY servers , turns out Apex Matchmaking connected me to servers on the other side of the planet (400+ ms pings) and not close to the region I had selected in the game's settings.
@charlesaloaye
charlesaloaye / gist:d5234275c8ed0bb4510ffaa9670d80aa
Last active April 19, 2024 14:49
2024 JETBRAINS ACTIVATION CODE | PHPSTORM | PYCHARM | Expires October 14, 2024
I2A0QUY8VU-eyJsaWNlbnNlSWQiOiJJMkEwUVVZOFZVIiwibGljZW5zZWVOYW1lIjoiVU5JVkVSU0lEQURFIEVTVEFEVUFMIERFIENBTVBJTkFTIiwiYXNzaWduZWVOYW1lIjoiVGFvYmFv77yaSkVU5YWo5a625qG25r+AIOa0u+W3peS9nOWupCAgcmVuIHpodW4gZGlhbiBtaW5n77yBIiwiYXNzaWduZWVFbWFpbCI6IlJvYmJ5X1dlbmlnZXJAb3V0bG9vay5jb20iLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiJGb3IgZWR1Y2F0aW9uYWwgdXNlIG9ubHkiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IkRQTiIsInBhaWRVcFRvIjoiMjAyNC0xMC0xNCIsImV4dGVuZGVkIjpmYWxzZX0seyJjb2RlIjoiREIiLCJwYWlkVXBUbyI6IjIwMjQtMTAtMTQiLCJleHRlbmRlZCI6ZmFsc2V9LHsiY29kZSI6IlBTIiwicGFpZFVwVG8iOiIyMDI0LTEwLTE0IiwiZXh0ZW5kZWQiOmZhbHNlfSx7ImNvZGUiOiJJSSIsInBhaWRVcFRvIjoiMjAyNC0xMC0xNCIsImV4dGVuZGVkIjpmYWxzZX0seyJjb2RlIjoiUlNDIiwicGFpZFVwVG8iOiIyMDI0LTEwLTE0IiwiZXh0ZW5kZWQiOnRydWV9LHsiY29kZSI6IkdPIiwicGFpZFVwVG8iOiIyMDI0LTEwLTE0IiwiZXh0ZW5kZWQiOmZhbHNlfSx7ImNvZGUiOiJETSIsInBhaWRVcFRvIjoiMjAyNC0xMC0xNCIsImV4dGVuZGVkIjpmYWxzZX0seyJjb2RlIjoiUlNGIiwicGFpZFVwVG8iOiIyMDI0LTEwLTE0IiwiZXh0ZW5kZWQiOnRydWV9LHsiY29kZSI6IkRTIiwicGFpZFVwVG8iOiIyMDI0LTEwL
@scriptdev
scriptdev / .php
Last active April 19, 2024 14:49
OCULTAR BOTÃO NO FORMULÁRIO
<?php
$this->btn_salvar->style = 'display:none';
$btn_exemplo->id = 'ID_BOTAO';
// OCULTAR O BContainer
$btn_exemplo->id = 'bcontainer_660328013cc90';
"""
This is based on https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm,
with the requirement that the maximum norm is used for distance calculations.
The algorithm is as follows, described for R^2, but it is easily extensible to
arbitrary dimensions >2:
- given points p_1, ..., p_n, we start by constructing our funnel
by calculating
dp_1 = (p_2 - p_1)
x_1_top = (dp_1_y + epsilon) / dp_1_x
@MeetBhingradiya
MeetBhingradiya / useStore.tsx
Last active April 19, 2024 14:48
NextJS LocalStorage and SessionStoreage API
// #Best Next Storage API Hook that Resolves RHE(React-Hydration-Error) in NextJS
// ? Easy to use
import React from "react";
interface useStore_Type {
Key?: string
Value?: any
}
interface useStore_Return_Type {
@wojteklu
wojteklu / clean_code.md
Last active April 19, 2024 14:46
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@greyhoundforty
greyhoundforty / functions.zsh
Created April 19, 2024 14:39
Random-functions
# usage: get_ubuntu_images VPC_REGION
function get_ubuntu_images() {
ibmcloud login -r "$@" -q >/dev/null 2>&1
vpc_region=$(ibmcloud target --output json | jq -r '.region.name')
printf "%b" "\e[1;34mGetting Ubuntu images in ${vpc_region}:.\e[0m"
printf '\n'
ibmcloud is images --visibility public --output json | jq -r '.[] | select(.status=="available") | select(.operating_system.architecture=="amd64") | select(.name | startswith("ibm-ubuntu")) | .name,.id'
}
# usage: get_windows_images VPC_REGION