Skip to content

Instantly share code, notes, and snippets.

View 20chan's full-sized avatar
🎸
rockin'

20chan 20chan

🎸
rockin'
View GitHub Profile
@20chan
20chan / tests.py
Created August 29, 2017 07:42
테스트!
import unittest
from lexer import parse
from builder import build
from machine import execute
from tok import Token, TokenType
import node
class LexerTest(unittest.TestCase):
def test_integer(self):
self.assertEqual(parse('1'), [Token('1', TokenType.INTEGER)])
@20chan
20chan / 글자.cs
Created September 9, 2017 18:14
한글 처리 C# 클래스
public struct 글자
{
/// <summary>
/// 한글여부(H, NH)
/// </summary>
public string 한글인가;
/// <summary>
/// 분석 한글
/// </summary>
public char 원래글자;
@20chan
20chan / struct-list-reference-test.cs
Created September 14, 2017 05:36
C# list of structures reference testing
using System;
using System.Collections.Generic;
namespace struct_reference
{
class Program
{
static void Main(string[] args)
{
Point p1 = new Point(10, 10);
@20chan
20chan / MachineCodeSharp.cs
Created September 20, 2017 16:28
Execute machine code in C#
using System;
using System.Runtime.InteropServices;
namespace AssemblySharp
{
class Program
{
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
@20chan
20chan / expression.cs
Created September 21, 2017 05:43
Execute expression using JIT, compiled expression, lambda in C#
using System;
using System.Linq.Expressions;
using System.Runtime.InteropServices;
namespace AssemblySharp
{
public static class Program
{
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
@20chan
20chan / AsyncMain.cs
Created September 26, 2017 08:05
Test async main in C#
class Program
{
static async Task Main(string[] args)
{
var t = new AsyncTest();
await t.DoTest();
}
}
class AsyncTest
Line line = new Line()
{
Stroke = new SolidColorBrush(Colors.Blue),
StrokeThickness = 3,
X1 = 0,
X2 = 300,
Y1 = 0,
Y2 = 200
};
@20chan
20chan / Anti-Anti-Decompile.cs
Created October 30, 2017 07:09
anti decompile patch for .net executable file
private void AntiReflector(string path)
{
FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Write);
stream.Seek(0xf4, SeekOrigin.Begin);
stream.WriteByte(11);
stream.Flush();
stream.Close();
MessageBox.Show("적용 완료!", "Anti-Reflector", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void AntiAntiReflector(string path)
@20chan
20chan / fibonacci.cs
Created December 29, 2017 03:05
Calculating nth Fibonacci number with Generic class
using System;
namespace fibonacci_test
{
class Program
{
static int Fib(int n)
{
if (n <= 1) return 1;
return Fib(n - 2) + Fib(n - 1);
@20chan
20chan / Streem.cs
Created January 9, 2018 06:29
Stream based programming DSL in C#
using System;
using System.Linq;
using System.IO;
namespace Streem
{
class Program
{
static void Main(string[] args)
{