Skip to content

Instantly share code, notes, and snippets.

View arman-hpp's full-sized avatar
😊
Focusing

Arman Hasanpour arman-hpp

😊
Focusing
View GitHub Profile
@arman-hpp
arman-hpp / PropertyIgnoreSerializerContractResolver.cs
Created December 9, 2020 04:02
PropertyIgnoreSerializerContractResolver
using System.Collections.Generic;
using System.Reflection;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace ConsoleApp1
{
public class PropertyIgnoreSerializerContractResolver : DefaultContractResolver
{
private readonly HashSet<string> _ignores;
@arman-hpp
arman-hpp / CertInstaller.cs
Created March 21, 2022 08:26
CertInstaller.cs
using System;
using System.Security.Cryptography.X509Certificates;
namespace CertInstaller
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(@"Certificate Installer v1.0");
@arman-hpp
arman-hpp / DelphiParseJson.pas
Created April 24, 2023 06:57
Delphi Parse Json
DecodeJsonUnicodeBytes(const unicodeByteStr: String): String;
var
LJSONObject: TJSONValue;
begin
try
LJSONObject := TJSONObject.ParseJSONValue(TEncoding.UTF8.GetBytes('{"alias":"'+unicodeByteStr+'"}'), 0, true);
Result := LJSONObject.GetValue<String>('alias');
finally
LJSONObject.Free;
end;
@arman-hpp
arman-hpp / ReducePicture.cs
Created October 6, 2024 07:22
PicReducer
private static byte[] ReducePicture(string inputPath, int percentage, int quality = 75)
{
using (var originalImage = Image.FromFile(inputPath))
{
var newWidth = originalImage.Width * percentage / 100;
var newHeight = originalImage.Height * percentage / 100;
using (var resizedImage = new Bitmap(newWidth, newHeight))
{
using (var graphics = Graphics.FromImage(resizedImage))