Skip to content

Instantly share code, notes, and snippets.

View colinkiama's full-sized avatar

Colin Kiama colinkiama

View GitHub Profile
@ImranR98
ImranR98 / eOSUDS.sh
Last active March 23, 2023 06:33
elementaryOS 6 has great dark themes, but they only apply to "curated" appcenter apps. This script forces the system theme to work with regular Debian packages as well as non-curated Flatpak apps. It also optionally changes the wallpaper based on the theme. It also supports changing themes for the Mailspring email app (both .deb and Snap versions).
#!/usr/bin/bash
# =======================================
# eOS-Universal-Dark-Style
# =======================================
# elementaryOS 6 has great dark themes, but they only apply to "curated" appcenter apps
# This script forces the system theme to work with regular Debian packages as well as non-curated Flatpak apps
# It also optionally changes the wallpaper based on the theme
@sindresorhus
sindresorhus / esm-package.md
Last active July 15, 2024 20:29
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
import math
from functools import lru_cache
@lru_cache(3)
def fibonacci(n):
"""" Finds fibonacci number for index supplied
Recursive function to find the fibonacci number for a certain index
where F{n} = F{n-1} + F{n-2}.
This function utilises lru_cache to cache recently computed results
in order for faster calculations at the next iteration.
@dragon788
dragon788 / win10_binary_fission.md
Last active April 19, 2024 09:26
Making the Windows 10 "chubby" install.wim compatible with a FAT32 USB so a UEFI bootable USB can be created from Linux/macOS/ChromeOS

MAGIC aka Making Anything Gruelingly "Impossible" Coherent

Whatever operating system you are using to create the USB, you will need to have a Windows 10 ISO, either from Microsoft or your system manufacturer and have a USB drive 8GB or larger (or one with at least 5GB of free space and using the FAT32 filesystem, but using a fresh and empty one is best).

TL;DR

#macOS/Linux
# First try the `bootiso` program, it has options for splitting the WIM for you!
# https://jsamr.github.io/bootiso/
# You need to already have 7zip aka `p7zip` on macOS and Linux, and `wimlib` macOS via `brew` or `wimtools` on Linux
@user5145
user5145 / flatpak install
Last active January 26, 2024 21:42
how to build, install and remove flatpak applications from cli
1. Store in a repository
flatpak-builder --force-clean build-dir --repo=/path/to/local/repo your.application.Client.yml
2. Install from the repository
flatpak --user install localrepo your.application.Client
3. Install the repository
flatpak --user remote-add --no-gpg-verify local-repo /path/to/repo
4. Store in a folder
@astamicu
astamicu / Remove videos from Youtube Watch Later playlist.md
Last active July 14, 2024 18:28
Script to remove all videos from Youtube Watch Later playlist

UPDATED 22.11.2022

It's been two years since the last update, so here's the updated working script as per the comments below.

Thanks to BryanHaley for this.

setInterval(function () {
    video = document.getElementsByTagName('ytd-playlist-video-renderer')[0];

 video.querySelector('#primary button[aria-label="Action menu"]').click();
@TingPing
TingPing / meson.tmLanguage
Created February 7, 2017 20:26
Syntax Highlighting for Meson
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Patrick Griffis</string>
<key>fileTypes</key>
<array>
<string>meson.build</string>
<string>meson_options.txt</string>
@wagonli
wagonli / DeviceTypeHelper.cs
Last active September 10, 2019 22:32
Detect device type on Universal Windows Platform (UWP)
using Windows.System.Profile;
using Windows.UI.ViewManagement;
namespace Wagonli.Tools
{
public static class DeviceTypeHelper
{
public static DeviceFormFactorType GetDeviceFormFactorType()
{
switch (AnalyticsInfo.VersionInfo.DeviceFamily)
@naotaco
naotaco / detect_orientation.cs
Created October 3, 2015 05:12
Detect current screen orientation on UWP application.
private void Page_Loaded(object sender, RoutedEventArgs e)
{
DisplayInformation.GetForCurrentView().OrientationChanged += MainPage_OrientationChanged;
}
private void MainPage_OrientationChanged(DisplayInformation info, object args)
{
Debug.WriteLine("orientation: " + info.CurrentOrientation);
}
@callumlocke
callumlocke / scale-canvas.ts
Last active June 12, 2024 15:31
How to fix a canvas so it will look good on retina/high-DPI screens.
/*
UPDATED for 2023 - Now much simpler. The old tricks are no longer needed.
The following code makes an 800×600 canvas that is always as sharp as possible for the device.
You still draw on it as if it's the logical size (800×600 in this case), but everything just
looks sharper on high-DPI screens. Regular non-sharp screens are not affected.
*/
const width = 800