Skip to content

Instantly share code, notes, and snippets.

@JavierJF
JavierJF / ExportStartLayout.cs
Last active April 23, 2024 19:11
Setting StartMenu layout using C# - statically
/*!
* GPII Windows 10 Start Menu Layout Setter.
*
* Copyright 2018 Raising the Floor - International
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* The research leading to these results has received funding from the European Union's
* Seventh Framework Programme (FP7/2007-2013)
@arkatsy
arkatsy / zustand-internals.jsx
Last active April 23, 2024 19:11
How zustand works internally
import { useSyncExternalStore } from "react";
// For more on the useSyncExternalStore hook, see https://react.dev/reference/react/useSyncExternalStore
// The code is almost identical to the source code of zustand, without types and some features stripped out.
// Check the links to see the references in the source code.
// The links are referencing the v5 of the library. If you plan on reading the source code yourself v5 is the best way to start.
// The current v4 version contains lot of deprecated code and extra stuff that makes it hard to reason about if you're new to this.
// https://github.com/pmndrs/zustand/blob/fe47d3e6c6671dbfb9856fda52cb5a3a855d97a6/src/vanilla.ts#L57-L94
function createStore(createState) {
@sneakyness
sneakyness / togglePDFDarkMode.js
Created May 24, 2020 09:04
Chrome/Brave PDF Viewer Dark Mode Toggle
// When using in-browser PDF viewer, you can inspect it and run this in the console
// It's using CSS Blending to invert the colors of the PDF
function togglePDFDarkMode() {
var cover = document.createElement("div");
let inversion = `
position: fixed;
pointer-events: none;
top: 0;
left: 0;
width: 100vw;
@manasthakur
manasthakur / plugins.md
Last active April 23, 2024 19:06
Managing plugins in Vim

Managing plugins in Vim: The basics

Let's say the plugin is at a GitHub URL https://github.com/manasthakur/foo. First get the plugin by either cloning it (git clone https://github.com/manasthakur.foo.git) or simply downloading it as a zip (from its GitHub page).

Adding a plugin in Vim is equivalent to adding the plugin's code properly into its runtimepath (includes the $HOME/.vim directory by default). For example, if the layout of a plugin foo is as follows:

foo/autoload/foo.vim
foo/plugin/foo.vim
@piyusht007
piyusht007 / test.html
Created June 11, 2020 10:32
Role checking Cheatsheet in Spring security and Thymeleaf
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<div>
<b>Username:</b>
<div sec:authentication="name">
The value of the "name" property of the authentication object should appear here.
</div>
</div>
<div>
<b>User Roles: </b>
@aabiji
aabiji / yt.py
Created April 7, 2024 15:39
Youtube video downloader
"""
A tiny youtube video downloader.
usage: yt.py [-h] [--only-audio] [--num_retries NUM_RETRIES] [--output OUTPUT] video_url
Built by Abigail Adegbiji on April 7, 2024.
Inspried by this blog post: https://tyrrrz.me/blog/reverse-engineering-youtube-revisited
Note that the get_video_info function will be subject to change when Youtube changes their api.
Also note that ffmpeg and ffmpeg-python are required dependencies.
"""
@ocornut
ocornut / imgui_node_graph_test.cpp
Last active April 23, 2024 19:02
Node graph editor basic demo for ImGui
// Creating a node graph editor for Dear ImGui
// Quick sample, not production code!
// This is quick demo I crafted in a few hours in 2015 showcasing how to use Dear ImGui to create custom stuff,
// which ended up feeding a thread full of better experiments.
// See https://github.com/ocornut/imgui/issues/306 for details
// Fast forward to 2023, see e.g. https://github.com/ocornut/imgui/wiki/Useful-Extensions#node-editors
// Changelog
// - v0.05 (2023-03): fixed for renamed api: AddBezierCurve()->AddBezierCubic().
@silverkorn
silverkorn / ffmpeg-nonfree-build-ubuntu-16.04.sh
Last active April 23, 2024 19:02
An automated script to build FFmpeg non-free on Debian/Ubuntu with as much features as possible. (Including mediainfo for debugging) Raw
# TODO: Verify to link statically some dependencies usually not available in a default instllation of RHEL/CentOS (ex.: libxcb)
###################
## Configuration ##
###################
FFMPEG_CPU_COUNT=$(nproc)
FFMPEG_ENABLE="--enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --enable-gray --enable-openssl --enable-libfreetype"
FFMPEG_HOME=/usr/local/src/ffmpeg
@nmpowell
nmpowell / windows_task_scheduler.py
Last active April 23, 2024 19:00
Python script to interact with existing Windows Task Scheduler tasks.
"""
Python script to interact with existing Windows Task Scheduler tasks.
CLI usage:
python windows_task_scheduler.py {enable|disable|run} -t "TaskName"
import usage:
import windows_task_scheduler as wts
wts.enable_task(task_name='TaskName')
wts.disable_task(task_name='TaskName')