Skip to content

Instantly share code, notes, and snippets.

@ceving
ceving / Web Component for Copyright Years.md
Last active March 28, 2024 20:20
Web Component for Copyright Years
@carlodaniele
carlodaniele / media-hacks.php
Last active March 28, 2024 20:19
An example WP plugin which adds functionalities to the WordPress Media Library
<?php
/**
* @package Media_hacks
* @version 1.0
*/
/*
Plugin Name: Media hacks
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele
@OrionReed
OrionReed / DOM3D.js
Last active March 28, 2024 20:18
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@alghanmi
alghanmi / curl_example.cpp
Created May 5, 2014 20:12
cURL C++ Example
#include <iostream>
#include <string>
#include <curl/curl.h>
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
import pandas as pd
from hashlib import sha256
from pandas.util import hash_pandas_object
from functools import lru_cache
class HashableDataFrame(pd.DataFrame):
def __init__(self, obj):
super().__init__(obj)
@andrebrait
andrebrait / keychron_linux.md
Last active March 28, 2024 20:14
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

@sbyx
sbyx / notify-or-do-something-when-an-appliance-like-a-dishwasher-or-washing-machine-finishes.yaml
Last active March 28, 2024 20:12
Home Assistant Blueprint: Notify or do something when an appliance like a dishwasher or washing machine finishes
blueprint:
name: Appliance has finished
description: Do something when an appliance (like a washing machine or dishwasher)
has finished as detected by a power sensor.
domain: automation
input:
power_sensor:
name: Power Sensor
description: Power sensor entity (e.g. from a smart plug device).
selector:
@PurpleVibe32
PurpleVibe32 / vmwk17key.txt
Last active March 28, 2024 20:09
Free VMware Workstation Pro 17 full license keys
Install VMWare Workstation PRO 17 (Read it right. PRO!)
Also, these keys might also work with VMWare Fusion 13 PRO. Just tested it.
Sub to me on youtube pls - PurpleVibe32
if you want more keys - call my bot on telegram. @purector_bot (THE BOT WONT REPLY ANYMORE) - Or: https://cdn.discordapp.com/attachments/1040615179894935645/1074016373228978277/keys.zip - the password in the zip is 102me.
---
This gist can get off at any time.
PLEASE, DONT COPY THIS. IF YOU FORK IT, DONT EDIT IT.
*If you have a problem comment and people will try to help you!
*No virus
import Cocoa
import MediaPlayer
let bundle = CFBundleCreate(kCFAllocatorDefault, NSURL(fileURLWithPath: "/System/Library/PrivateFrameworks/MediaRemote.framework"))
let MRMediaRemoteRegisterForNowPlayingNotificationsPointer = CFBundleGetFunctionPointerForName(
bundle, "MRMediaRemoteRegisterForNowPlayingNotifications" as CFString
)
typealias MRMediaRemoteRegisterForNowPlayingNotificationsFunction = @convention(c) (DispatchQueue) -> Void
let MRMediaRemoteRegisterForNowPlayingNotifications = unsafeBitCast(MRMediaRemoteRegisterForNowPlayingNotificationsPointer, to: MRMediaRemoteRegisterForNowPlayingNotificationsFunction.self)