Skip to content

Instantly share code, notes, and snippets.

@stravant
stravant / reloader.gd
Last active May 13, 2024 16:27
Simple plugin auto-reloader for Godot plugin development
################################################################################
## stravant's Godot plugin auto-reloader ##
## For ease of plugin development ##
## MIT licensed ##
## ##
## Call preload("./reloader.gd").new() in your EditorPlugin component's ##
## _enter_tree method to enable automatic reloading whenever you save changes ##
## to any of the plugin files for a tighter plugin rapid prototyping loop. ##
## ##
## Source: https://gist.github.com/stravant/7aec484bb5e34e3a6196faaa13159ac3 ##
@igorcaldeira
igorcaldeira / maskContent.js
Created May 10, 2024 00:53
JS Function to format a string based on mask (with imask)
// how to use :)
// mask: "(00) 0 0000-0000"
// input: "31999699601"
// result: "(31) 9 9969-9606"
export const maskContent = (mask, input) => {
const m = IMask.createMask({
mask,
});
@bonza-labs
bonza-labs / caching_wrapper.js
Created September 15, 2011 23:34
Javascript cache wrapping
var $w = function(string) { return string.split(' '); };
var asInts = function(arr) {
var results=[];
for(var i=0, m=arr.length; i<m; i++) results.push(parseInt(arr[i], 10));
return results;
};
Array.prototype.map = function(func) {
@tdcosta100
tdcosta100 / WSL2GUIXvnc-en.md
Last active May 13, 2024 16:22
A tutorial to use GUI in WSL2 replacing original XServer by Xvnc, allowing WSL to work like native Linux, including login screen

WSL2 with GUI using Xvnc

In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, UVNC, etc, all of them might work flawlessly).

The key component we need to install is tigervnc-standalone-server.

For this setup, I will use Ubuntu 20.04 LTS (Focal Fossa, unfortunately 22.04 does not work), and install GNOME Desktop. Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the Sample screenshots section for examples.

So let's go. First, we need a working WSL2 installation.

@umayr
umayr / recover-deleted-branch.sh
Created April 1, 2016 11:41
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@davepcallan
davepcallan / FindSparseColumnCandidates.sql
Created May 11, 2024 10:24
SQL Server SQL script to find sparse column candidates
USE TestDB
GO
DECLARE @DatabaseName VARCHAR(100)
DECLARE @SchemaName VARCHAR(100)
DECLARE @TableName VARCHAR(100)
DECLARE @ColumnName VARCHAR(100)
DECLARE @FullyQualifiedTableName VARCHAR(500)
--Create Temp Table to Save Results
@qcasey
qcasey / README.md
Last active May 13, 2024 16:21 — forked from mill1000/README.md
Headless A2DP Audio Streaming on Ubuntu / Debian for non-raspbian SBCs (ODROID, Orange Pi, Armbian, etc)

About

This gist will show how to setup a generic SBC Debian / Ubuntu install as a headless Bluetooth A2DP audio sink. This will allow your phone, laptop or other Bluetooth device to play audio wirelessly through a Rasperry Pi.

Motivation

This is forked from another gist specific to the Raspberry Pi on Stretch. A required package isn't in Ubuntu's repos, so in this gist we build it from scratch.

Tested to be working on Armbian/Ubuntu/Debian images of the Orange Pi Zero, ODROID XU4, ODROID N2, and Atomic Pi.

Prerequisites

@yudhastyawan
yudhastyawan / c_penjumlahan.f90
Created May 24, 2021 12:49
embed Fortran in Python using Cython
module penjumlahan_interface
use iso_c_binding, only: c_double
use penjumlahan_module, only: penjumlahan
implicit none
contains
subroutine c_penjumlahan(a, b, c) bind(c)
real(c_double), intent(in) :: a, b
real(c_double), intent(out) :: c
call penjumlahan(a, b, c)
@Te-k
Te-k / pdf_metadata.md
Created November 26, 2020 10:31
How to remove metadata from PDFs

Many tools do not fully remove metadata, but just remove the link with in the metadata table. The data are thus still available in the PDF file itself.

While a lot of people rely on Exiftool to remove metadata, it actually does the same in PDFs. If you remove metadata with exiftool -all= some.pdf, you can always restore the data with exiftool -pdf-update:all= some.pdf.

There are several options to remove PDF metadata safely:

Option 1 : Exiftool with qpdf

  • Remove metadata with exiftool : exiftool -all= some.pdf
  • Then remove ununsed objects with qpdf : qpdf --linearize some.pdf - &gt; some.cleaned.pdf

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment