Skip to content

Instantly share code, notes, and snippets.

@BenHurMartins
BenHurMartins / index.js
Last active May 1, 2024 17:22
Double or Single Tap
import { useEffect, useState } from "react";
import { Pressable, StyleSheet, Text, View } from "react-native";
let timer = null;
const TIMEOUT = 500
const debounce = (onSingle, onDouble) => {
if (timer) {
clearTimeout(timer);
timer = null;
onDouble();
@qskwood
qskwood / wget-warc-generator
Last active May 1, 2024 17:21
This script uses wget to generate a WARC that can be read by a player like OpenWayback and places it into a directory. It also handles creation and use of CDX indexes for de-duplication.
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "Must only have two arguments, the URL and the collection" >&2
exit 1
fi
if [[ ! -d "/var/spool/openwayback/files2/${2}" ]]; then
mkdir "/var/spool/openwayback/files2/${2}"
fi
@dhh
dhh / linux-setup.sh
Last active May 1, 2024 17:20
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
const title_text = "𝗜'𝗺 𝗜𝘇𝘂𝗺𝗶...!!";
const body_text = "𝐄𝐘𝐏𝐙";
const source_url = "https://github.com/sataniceypz/Izumi-v2";
large_thumb = false; // use true for larger thumbnail
const logo = "https://i.imgur.com/4AKWozV.jpeg";
var audios = ["https://i.imgur.com/tceIGIW.mp4","https://i.imgur.com/v1bYXlb.mp4","https://i.imgur.com/cGJ1Gyi.mp4","https://i.imgur.com/6HXfyVr.mp4","https://i.imgur.com/dPjoh3s.mp4","https://i.imgur.com/pbtSy0M.mp4","https://i.imgur.com/sDwfg29.mp4","https://i.imgur.com/8vhaz82.mp4"];
// ===================================================================================
// EZRA-XD MENTION AUDIO SENDER
//
@joaopfsilva
joaopfsilva / iban.js
Created September 27, 2019 07:40
IBAN validator
// https://github.com/arhs/iban.js
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports'], factory);
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports);
} else {
// Browser globals
@Vertecedoc4545
Vertecedoc4545 / Hyprland-Ubuntu.md
Last active May 1, 2024 17:12
Ubuntu 23.04 Build and Install instructions for Hyprland

Building on Ubuntu 23.04

You have 2 options, use the script descrived bellow or follow the instrutions

script in this gist if you want the source code

wget https://gist.githubusercontent.com/Vertecedoc4545/6e54487f07a1888b656b656c0cdd9764/raw/2c5e8ccb428fc331307e2f653cab88174c051310/build-ubuntu-23.sh
chmod +x build-ubuntu-23.sh
./build-ubuntu-23.sh

Disable:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Enable:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

@portiss
portiss / reverseString.js
Created February 5, 2024 09:14
Reverse a string
function reverseString(str) {
return str.split('').reverse().join('');
}
@portiss
portiss / isBalancedTree.js
Created February 5, 2024 09:12
isBalancedTree
function isBalancedTree(node) {
if (node) {
const keepSearch = h(node.right) - h(node.left) <= 1
if (keepSearch) {
return balancedTree(node.right) && balancedTree(node.left)
}
else return false
}
}
@portiss
portiss / flattenArrays.js
Created February 5, 2024 09:11
Implement JS flatMap
function flatten(ary, ret = []) {
return ary.reduce((ret, entry) => {
(Array.isArray(entry))? flatten(entry, ret) : ret.push(entry)
return ret
}, ret)
}
console.log(flatten([[[0], [1]], [[2], [3]], [[4], [5]]]))