Skip to content

Instantly share code, notes, and snippets.

let a = [1, 2, [3, [4, [5, [6], [7, [8]]]]]];
function brainDeadDeepFlat(arr)
{
return Array.isArray(arr)
? arr.reduce( (arr, e) => arr.concat(brainDeadDeepFlat(e)), [] )
: [arr];
}
function normalBrainDeepFlat(arr)
@razouck
razouck / hosts
Created December 15, 2022 13:13
OpenSUSE default hosts file.
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
#
@razouck
razouck / hosts
Created December 15, 2022 13:11
Windows default hosts file.
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
@razouck
razouck / Home.desktop
Created December 15, 2022 13:10
KDE home desktop entry.
[Desktop Entry]
Encoding=UTF-8
Name=Home
Name[ca]=Inici
Name[ca@valencia]=Inici
Name[cs]=Můj adresář
Name[da]=Hjem
Name[de]=Persönlicher Ordner
Name[el]=Προσωπικός φάκελος
Name[en_GB]=Home
@razouck
razouck / trash.desktop
Created December 15, 2022 13:09
KDE trash bin desktop entry.
[Desktop Entry]
Name=Trash
Name[ar]=المهملات
Name[az]=Səbət
Name[bg]=Кошче
Name[ca]=Paperera
Name[ca@valencia]=Paperera
Name[cs]=Koš
Name[da]=Papirkurv
Name[de]=Papierkorb
@razouck
razouck / volume.sh
Last active April 3, 2022 23:37
Change the volume with Dunst.
#!/bin/bash
notify() {
if [ $1 -gt 60 ]
then
icon="🔊"
elif [ $1 -gt 30 ]
then
😀 😃 😄 😁 😆 😅 🤣 😂 🙂 🙃 😉 😊 😇 🥰 😍 🤩 😘 😗 ☺ 😚 😙 🥲 😋 😛 😜 🤪 😝 🤑 🤗 🤭 🤫 🤔 🤐 🤨 😐 😑 😶 😶‍🌫️ 😏 😒 🙄 😬 😮‍💨 🤥 😌 😔 😪 🤤 😴 😷 🤒 🤕 🤢 🤮 🤧 🥵 🥶 🥴 😵 😵‍💫 🤯 🤠 🥳 🥸 😎 🤓 🧐 😕 😟 🙁 ☹ 😮 😯 😲 😳 🥺 😦 😧 😨 😰 😥 😢 😭 😱 😖 😣 😞 😓 😩 😫 🥱 😤 😡 😠 🤬 😈 👿 💀 ☠ 💩 🤡 👹 👺 👻 👽 👾 🤖 😺 😸 😹 😻 😼 😽 🙀 😿 😾 🙈 🙉 🙊
💋 💌 💘 💝 💖 💗 💓 💞 💕 💟 ❣ 💔 ❤️‍🔥 ❤️‍🩹 ❤ 🧡 💛 💚 💙 💜 🤎 🖤 🤍 💯 💢 💥 💫 💦 💨 🕳 💣 💬 👁️‍🗨️ 🗨 🗯 💭 💤
👋 🤚 🖐 ✋ 🖖 👌 🤌 🤏 ✌ 🤞 🤟 🤘 🤙 👈 👉 👆 🖕 👇 ☝ 👍 👎 ✊ 👊 🤛 🤜 👏 🙌 👐 🤲 🤝 🙏 ✍ 💅 🤳 💪 🦾 🦿 🦵 🦶 👂 🦻 👃 🧠 🫀 🫁 🦷 🦴 👀 👁 👅 👄
👶 🧒 👦 👧 🧑 👱 👨 🧔 🧔‍♂️ 🧔‍♀️ 👨‍🦰 👨‍🦱 👨‍🦳 👨‍🦲 👩 👩‍🦰 🧑‍🦰 👩‍🦱 🧑‍🦱 👩‍🦳 🧑‍🦳 👩‍🦲 🧑‍🦲 👱‍♀️ 👱‍♂️ 🧓 👴 👵 🙍 🙍‍♂️ 🙍‍♀️ 🙎 🙎‍♂️ 🙎‍♀️ 🙅 🙅‍♂️ 🙅‍♀️ 🙆 🙆‍♂️ 🙆‍♀️ 💁 💁‍♂️ 💁‍♀️ 🙋 🙋‍♂️ 🙋‍♀️ 🧏 🧏‍♂️ 🧏‍♀️ 🙇 🙇‍♂️ 🙇‍♀️ 🤦 🤦‍♂️ 🤦‍♀️ 🤷 🤷‍♂️ 🤷‍♀️ 🧑‍⚕️ 👨‍⚕️ 👩‍⚕️ 🧑‍🎓 👨‍🎓 👩‍🎓 🧑‍🏫 👨‍🏫 👩‍🏫 🧑‍⚖️ 👨‍⚖️ 👩‍⚖️ 🧑‍🌾 👨‍🌾 👩‍🌾 🧑‍🍳 👨‍🍳 👩‍🍳 🧑‍🔧 👨‍🔧 👩‍🔧 🧑‍🏭
@razouck
razouck / 50-tablet.conf
Last active August 15, 2020 16:20
Set up for my drawing tablet on linux
Section "InputClass"
Identifier "Tablet"
Driver "wacom"
MatchDevicePath "/dev/input/event*"
MatchUSBID "256c:006e"
EndSection
@razouck
razouck / tagof.js
Last active November 18, 2017 16:33
Returns the type/tag of a given value.
function tagof (value) {
return value != value ? 'NaN' :
Object.prototype.toString.call(value)
.match(/\[object (\w+)\]/)[1]
.toLowerCase();
}
@razouck
razouck / object.js
Last active April 6, 2022 19:14
How to Create an Object in JavaScript
var object;
object = {};
object = new Object();
object = new Object(null);
object = new Object(undefined);
object = Object.create(Object.prototype);
object = Reflect.constructor(Object.prototype);
var prop = 'value';