Skip to content

Instantly share code, notes, and snippets.

View TheSnowfield's full-sized avatar
🍣
I love sushi and raw salmon. (●ˇ∀ˇ●) yummy~

TheSnowfield TheSnowfield

🍣
I love sushi and raw salmon. (●ˇ∀ˇ●) yummy~
View GitHub Profile
@TheSnowfield
TheSnowfield / remove.js
Last active December 1, 2022 10:31
remove grayscale
// ==UserScript==
// @name Fuck Grayscale
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
/*
* Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
*
* Based on sun8i-h3-orangepi-one.dts, which is:
* Copyright (C) 2016 Hans de Goede <hdegoede@redhat.com>
*
* This file is dual-licensed: you can use it either under the terms
* of the GPL or the X11 license, at your option. Note that this dual
* licensing only applies to this file, and not this project as a
* whole.
@TheSnowfield
TheSnowfield / FuturedSocket.cs
Last active May 20, 2022 09:19
C# async/await Socket
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
internal class FuturedSocket : IDisposable
{
/// <summary>
/// Inner socket
@TheSnowfield
TheSnowfield / rpi-configure-locales.md
Created March 15, 2022 07:26 — forked from tomysmile/rpi-configure-locales.md
Raspberry Pi: Reconfigure Locales

Reconfigure your RPi Locales

First you need to install the locales you want:

sudo dpkg-reconfigure locales

Then refresh your current environment:

@TheSnowfield
TheSnowfield / pocketchip.kmp
Created March 15, 2022 06:41 — forked from thiemok/pocketchip.kmp
Pocketchip keymap for headless boot - fixed for zsh
keymaps 0-2,4-5,8,12
altgr keycode 2 = F1
altgr keycode 3 = F2
altgr keycode 4 = F3
altgr keycode 5 = F4
altgr keycode 6 = F5
altgr keycode 7 = F6
altgr keycode 8 = F7
altgr keycode 9 = F8
altgr keycode 10 = F9
@TheSnowfield
TheSnowfield / SandBox.cs
Last active February 14, 2024 04:56
Dynamically run C# code in the same context
public class SandBox
{
private ScriptState<object> _globalState;
public SandBox()
{
// Create initial script
var script = CSharpScript.Create(string.Empty, ScriptOptions.Default);
{
// Create an empty state
@TheSnowfield
TheSnowfield / compile code.md
Last active February 1, 2022 08:25
compile code in runtime
/// <summary>
/// Run code
/// </summary>
/// <returns></returns>
public static async Task<MessageBuilder> OnRunPlainCode(MessageChain message)
{
    var codeTemplate = @"
namespace DynamicCodeExecution {
    public static class Runnable {
@TheSnowfield
TheSnowfield / braille pattern.md
Last active January 30, 2022 09:25
Braille character in JavaScript

Code snippet

function braille_pattern(blocks)
{
    if(!(blocks instanceof Array) || blocks.length > 8 || blocks.length < 0) 
        throw new TypeError("Only accept an array in max of 8 elements with 0/1 or true/false.");

    // value table
 const table = [1, 2, 4, 64, 8, 16, 32, 128];

Here is an example that shows you how to create a wear tile use Xamarin.

Prepare the library

  • Create a Xamarin binding library AndroidX.Wear.Tiles.
  • Download the latest androidx.wear.tiles pre-release from maven (current is 1.0.0-alpha11).
    Place the aar file into Jar in your solution, set Build Action to LibraryProjectZip in the property.
  • Download the latest androidx.wear.tiles tiles-proto pre-release from maven (current is 1.0.0-alpha11).
    Place the jar file into Jar folder of your solution, set Build Action to EmbeddedReferenceJar in the property.
  • Add Xamarin.Google.Guava.ListenableFuture NuGet package to this binding solution.
  • Edit the Metadata.xml. (I have fixed some bindings)
@TheSnowfield
TheSnowfield / gist:8d181ec877f4aae4d4cbd89e57222e35
Created April 28, 2020 02:46
gitlab-ce docker compose file for windows
# Gitlab-ce Docker Compose File
version: '3'
services:
web:
image: gitlab/gitlab-ce:latest
container_name: '容器名稱'
restart: always
hostname: '網站地址'