Skip to content

Instantly share code, notes, and snippets.

@duncansmart
duncansmart / ExpressionUtil.cs
Created April 4, 2011 09:08
Type-safe GetMethod: get a MethodInfo without a magic string
using System;
using System.Reflection;
using System.Linq.Expressions;
class ExpressionUtil
{
// Returns the MethodInfo of the given lambda. Use instead of Type.GetMethod("name", paramTypes).
public static MethodInfo GetMethod<T>(Expression<Action<T>> lambda)
{
var call = lambda.Body as MethodCallExpression;
@jimfleming
jimfleming / UnityDiffuseLightmap.shader
Last active June 21, 2023 00:44
Example depicting applying Unity lightmapping data to a simple diffuse shader.
Shader "Diffuse Lightmap" {
Properties {
_MainTex ("Texture 1", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
Pass {
@csharpforevermore
csharpforevermore / AuthoHotKeyList.txt
Created April 27, 2014 15:50
AutoHotKey Key List
Key Name Resulting Keystroke
{F1} - {F24} Function keys. For example: {F12} is the F12 key.
{!} !
{#} #
{+} +
{^} ^
{{} {
{}} }
{Enter} ENTER key on the main keyboard
{Escape} or {Esc} ESCAPE
@bjoern-r
bjoern-r / Huawei_E3372_openwrt.md
Last active November 15, 2024 08:20
How to use a Huawei E3372 on OpenWRT

HOWTO use a Huawei E3372 on OpenWRT

This modem is also sold as a MegaFon M150-2 USB dongle

Needed Software

Install the needed packages via opkg tool

opkg update
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
public static class TaskTupleExtensions
{
#region (Task<T1>)
public static TaskAwaiter<T1> GetAwaiter<T1>(this ValueTuple<Task<T1>> tasks)
{
@apkd
apkd / Comment.cs
Last active August 3, 2023 20:01
Double-click the text area to edit. https://tryfinally.dev/unity-comment-component
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Callbacks;
#endif
using System;
using System.Linq;
using UnityEngine;
using S = UnityEngine.SerializeField;
/// <summary>
@apkd
apkd / reencode.bat
Last active August 9, 2022 11:47
Quickly re-encodes a video file to .mp4. Add it to your PATH (along with ffmpeg).
@echo off
IF "%1"=="" (
echo Usage: reencode path_to_file [optional_crf]
goto eof
)
SET crf="23"
IF NOT "%2"=="" (
SET crf=%2