Skip to content

Instantly share code, notes, and snippets.

View pedoc's full-sized avatar
🎯
Focusing

pedoc pedoc

🎯
Focusing
View GitHub Profile
@pedoc
pedoc / main.cs
Created September 24, 2024 07:57
UrlEncode eq php and java
using System;
using System.Net;
using System.Text;
public class Program
{
public static void Main()
{
Console.WriteLine(PhpLikeUrlHelper.UrlEncode("Hello World! 你好 #$&\'()*+,-./:;=?@[]!\'", Encoding.UTF8));
}
@pedoc
pedoc / tools.yml
Last active May 21, 2022 04:35 — forked from kohenkatz/tools.yml
Opening Windows Terminal and VSCode from SmartGit
# Add these entries to your `tools.yml` to be able to right-click to open
# things in VSCode (files and folders) and Windows Terminal (folders only) and Visual Studio(sln files).
# Make sure to change `YOUR_USERNAME` in the VSCode path.
tools:
- name: Open in VSCode
fileStarter: {command: 'C:\Users\YOUR_USERNAME\AppData\Local\Programs\Microsoft VS Code\Code.exe',
parameters: '"${filePath}"'}
useForOpen: true
waitUntilFinished: false
@pedoc
pedoc / MySqlConnectorConnectionProvider.cs
Created December 29, 2021 05:35
MySqlConnectorConnectionProvider for DevExpress.Xpo
using System;
using System.Data;
using System.Globalization;
using System.Reflection;
using DevExpress.Xpo.DB;
using DevExpress.Xpo.DB.Helpers;
// ReSharper disable InconsistentNaming
namespace SN.Instrument.DataAccess.Xpo.ConnectionProviders
{
public static Func<float,float> Line(PointF a, PointF b)
{
return x =>
{
var k = (b.Y - a.Y) / (b.X - a.X);
return k * (x - a.X) + a.Y;
};
}
@pedoc
pedoc / 16Bytes.cs
Created May 22, 2020 01:44 — forked from ufcpp/16Bytes.cs
A bit accessor for `byte`
// required packages:
// System.Runtime.CompilerServices.Unsafe
// System.Numerics.Vectors
using System;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Runtime.CompilerServices;
private static readonly string[] _base16CharTable = new[]
{
"00", "01", "02", "03", "04", "05", "06", "07",
"08", "09", "0A", "0B", "0C", "0D", "0E", "0F",
"10", "11", "12", "13", "14", "15", "16", "17",
"18", "19", "1A", "1B", "1C", "1D", "1E", "1F",
"20", "21", "22", "23", "24", "25", "26", "27",
"28", "29", "2A", "2B", "2C", "2D", "2E", "2F",
"30", "31", "32", "33", "34", "35", "36", "37",
"38", "39", "3A", "3B", "3C", "3D", "3E", "3F",
@pedoc
pedoc / starUML.md
Created January 2, 2020 07:24 — forked from trandaison/starUML.md
Get full version of StarUML
@pedoc
pedoc / semantic-commit-messages.md
Created January 24, 2019 03:31 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@pedoc
pedoc / BoyerMoore.cs
Created October 24, 2018 10:02 — forked from mjs3339/BoyerMoore.cs
C# High Performance Boyer Moore Byte Array Search Algorithm
public class BoyerMoore
{
private int[] _jumpTable;
private byte[] _pattern;
private int _patternLength;
public BoyerMoore()
{
}
public BoyerMoore(byte[] pattern)
{
@pedoc
pedoc / simulate keyboard input
Created September 20, 2018 12:46
simulate keyboard input
public class Keyboard
{
public void Send(ScanCodeShort a)
{
INPUT[] Inputs = new INPUT[1];
INPUT Input = new INPUT();
Input.type = 1; // 1 = Keyboard Input
Input.U.ki.wScan = a;
Input.U.ki.dwFlags = KEYEVENTF.SCANCODE;
Inputs[0] = Input;