Skip to content

Instantly share code, notes, and snippets.

@junwin
junwin / gist:4731525
Created February 7, 2013 15:13
Simple C# worker thread that processes a queue of string data items (XML, JSON )
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Collections;
namespace workerthread
{
@heyjohnmurray
heyjohnmurray / React accessing child properties
Created November 22, 2015 06:28
In React you can access the inner HTML or the value of a nested component using this.props.children
var App = React.createClass({
render: function() {
// notice that we have the "Button" and "Heart" components
return <Button>I <Heart /> React</Button>
}
});
var Button = React.createClass({
render: function() {
// notice that this.props.children gave us the value of both the "Button" and the "Heart" component
// To subscribe to an event, pass this JSON text to the client through the WebSocket:
{
"body": {
"eventName": "NameOfEvent" // Replace with an event name listed below
},
"header": {
"requestId": "xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxx", // UUID
"messagePurpose": "subscribe",
"version": 1, // Protocol version (currently 1 as-of 1.0.2)
@kafene
kafene / gpg-wkd.md
Last active November 11, 2024 21:10
Setting up WKD for self-hosted automatic key discovery

I just got this working so I figured I'd share what I found, since there's hardly any information about this anywhere online except an RFC, the GPG mailing list and one tutorial from the GnuPG blog.

You can use automatic key discovery with WKD (Web key directory) to make it easy for users to import your key, in GPG since version 2.1.12. Since this feature is fairly new, it isn't yet available in the current LTS release of Ubuntu (16.04; xenial), however it is available in Debian stable (stretch).

I couldn't add a DNS CERT or DANE / OPENPGPKEY record through my email service (which also hosts my nameservers). I tried making the PKA record - a foo._pka.example.com TXT record but GPG doesn't seem to recognize it and fails; I'm still investigating why.

So the last option for self-hosted auto-discovery was WKD.

First thing I had to do was add an email address to my key. My primary UID is just my name so the key represents my identity rather

@aras-p
aras-p / test.txt
Last active November 2, 2022 23:26
Markdeep Admonition style blocks?
Right now I can do this in Markdeep source:
------------------
Just a test paragraph, move along...
<div class="note">
Just a note. Don't mind me.
</div>
<div class="warn">
@micycle1
micycle1 / a.md
Last active November 7, 2024 13:56
Downloading full-size media from DeviantArt

For direct image URL, the image quality is much lower than the original upload (the resolution and size of the original upload can be found in the right sidebar). This is not the case few years ago when the original image was accessible through right click, but on 2017, Wix acquired DeviantArt, and has been migrating the images to their own image hosting system from the original DeviantArt system. They linked most of the direct images to a stripped-down version of the original images; hence the bad image quality. Below are the three different formats of direct image URLs I found:

  • URL with /v1/fill inside: this means that the image went through Wix's encoding system and is modified to a specific size and quality. In this case, you remove ?token= and its values, add /intermediary in front of /f/ in the URL, and change the image settings right after /v1/fill/ to w_5100,h_5100,bl,q_100. The definitions of the values can be found in [Wix's Image Service](https://support.wi

Adding Dependencies

Introduction

Adding Dependencies allows you to access hooks, tools and apis provided by other mods. Depending on other's code allows you to spend lesser time on writing your code, and more time on refining it. A commonly used dependency in fabric is Fabric API.

Adding the repository

Open your build.gradle file and add the required maven repositories

repositories {
    maven {
 name = "Example"
@Pandapip1
Pandapip1 / CooldownButton.cs
Last active July 4, 2023 11:12 — forked from amsam0/CooldownButton.cs
CooldownButton for Among Us mods (with example)
// Credits to https://gist.github.com/gabriel-nsiqueira/827dea0a1cdc2210db6f9a045ec4ce0a and https://gist.github.com/naturecodevoid/1c61786e6a95d7d093f495b6e67aad29 for the original code.
using HarmonyLib;
using Reactor.Extensions;
using Reactor.Unstrip;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Reactor.Button
@4wk-
4wk- / README.md
Last active November 10, 2024 17:26
Clean uninstall then reinstall of WSL on Windows 10, with systemD support

Uninstall then reinstall WSL on Windows 10 (clean way)

Background

I've been using wsl (version 2) with genie mod for years without issue, but one day, Windows 10 finally catch up on wsl Windows 11 features and gives us a way to use systemD natively.

I wanted to use the new "right way" to enable systemD on Windows Subsystem for Linux (without genie), and I also had a (probably related) infinite Windows RemoteApp error poping in.

Fixing it

A - Uninstall wsl and related stuff

  1. In powershell (as admin)