Skip to content

Instantly share code, notes, and snippets.

View if1live's full-sized avatar
💭
I may be slow to respond.

byunghoo.yu if1live

💭
I may be slow to respond.
View GitHub Profile
@evadne
evadne / lecture.md
Last active October 4, 2023 23:24
How to Sell Elixir (2023)

How to Sell Elixir AGAIN (2023)

Presented by Evadne Wu at Code BEAM Lite in Stockholm, Sweden on 12 May 2023

Synopsis

We have celebrated 10 years of Elixir and also nearly 25 years of Erlang since the open source release in December 1998.

Most of the libraries that were needed to make the ecosystem viable have been built, talks given, books written, conferences held and training sessions provided. A new generation of companies have been built on top of the Elixir / Erlang ecosystem. In all measures, we have achieved further reach and maturity than 5 years ago.

@TheLeftExit
TheLeftExit / cswinloop.cs
Created February 14, 2023 17:23
C# window message loop generated by ChatGPT
using System;
using System.Runtime.InteropServices;
public static class Program
{
[DllImport("user32.dll")]
private static extern bool RegisterClassEx(ref WNDCLASSEX wcex);
[DllImport("user32.dll")]
private static extern IntPtr CreateWindowEx(
@mcxiaoke
mcxiaoke / PacketOpcodes.java
Created July 23, 2022 15:05
2.8.5x Packet Opcodes
package emu.grasscutter.net.packet;
import java.util.HashSet;
public class PacketOpcodes {
// Empty
public static final int NONE = 0;
// Opcodes
public static final int AbilityChangeNotify = 1155;
@Yuhanawa
Yuhanawa / WinAPI.cs
Last active August 17, 2024 07:03
C# WinAPI
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using static Prefer.WinAPI.Enum;
namespace Prefer.WinAPI
{
#region enum
@shadeglare
shadeglare / UnionSerialization.cs
Last active June 27, 2024 03:25
Serialize and deserialize a generic union type with System.Text.Json
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
using Hexarc.Annotations;
namespace Hexarc.Union
@erikkinding
erikkinding / fsharp_osx_dotnet_core.md
Last active August 17, 2024 06:56
Debug F# in Visual Studio Code on OSX (and Linux?) targeting dotnet core

I thought I'd share some simple steps you can follow if you wan't to build, run and debug an F# program on OSX using dotnet core 2.0. I guess these steps would also work if you're running Linux, with some minor modifications.

  1. Install dotnet sdk for OSX: https://www.microsoft.com/net/learn/get-started/macos

  2. Install Visual Studio Code for OSX: https://code.visualstudio.com/

  3. Install C# (yes, C#) extension for OSX: https://code.visualstudio.com/docs/languages/csharp

  4. Create a new console application project using dotnet cli: dotnet new console -lang F# -n HelloWorld

@iMilnb
iMilnb / README.md
Last active January 18, 2024 08:08
AWS Terraform configuration: Stream CloudWatch Logs to ElasticSearch

Rationale

This snippet is a sample showing how to implement CloudWatch Logs streaming to ElasticSearch using terraform. I wrote this gist because I didn't found a clear, end-to-end example on how to achieve this task. In particular, I understood the resource "aws_lambda_permission" "cloudwatch_allow" part by reading a couple of bug reports plus this stackoverflow post.

The js file is actually the Lambda function automatically created by AWS when creating this pipeline through the web console. I only added a endpoint variable handling so it is configurable from terraform.

@kosamari
kosamari / _ServiceWorker_for_github_pages.md
Last active April 1, 2024 05:44
ServiceWorker for github pages.

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.

@irokhes
irokhes / fake-date-sinon-node-js
Created June 4, 2016 13:22
Fake a date in node.js for testing with sinon
clock = sinon.useFakeTimers(new Date(2016,11,1).getTime());
new Date(); //=> return the fake Date 'Sat Nov 01 2016 00:00:00'
clock.restore();
new Date(); //=> will return the real time again (now)
@TarasOsiris
TarasOsiris / ShowToastUnityAndroid.cs
Created April 15, 2016 12:52
Shows toast on Android
public static void ShowToast(string text)
{
if (Application.platform == RuntimePlatform.Android)
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
activity.Call("runOnUiThread", new AndroidJavaRunnable(
()=>
{