Skip to content

Instantly share code, notes, and snippets.

@wafe
wafe / convertTime.js
Created November 9, 2023 06:49 — forked from g1eb/convertTime.js
Convert seconds to a human readable representation
export function convertTime(seconds) {
var seconds = parseInt(seconds, 10)
var hours = Math.floor(seconds / 3600)
var minutes = Math.floor((seconds - (hours * 3600)) / 60)
var seconds = seconds - (hours * 3600) - (minutes * 60)
if ( !!hours ) {
if ( !!minutes ) {
return `${hours}h ${minutes}m ${seconds}s`
} else {
return `${hours}h ${seconds}s`
@wafe
wafe / excel_xml_spreadsheet_example.md
Created January 4, 2023 03:47 — forked from ilyazub/excel_xml_spreadsheet_example.md
Excel 2003 XML Spreadsheet example

Excel 2003 XML Spreadsheet example

Example

image

spreadsheet.xml

Solved errors

Problem During Load because of wrong ss:ExpandedRowCount.

@wafe
wafe / MongoQueue.php
Created February 2, 2020 14:22
Jenssegers/Mongodb attempts bug fixed
<?php
# vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Queue/MongoQueue.php
namespace Jenssegers\Mongodb\Queue;
use Carbon\Carbon;
use Illuminate\Queue\DatabaseQueue;
use Jenssegers\Mongodb\Connection;
use MongoDB\Operation\FindOneAndUpdate;
class MongoQueue extends DatabaseQueue
@wafe
wafe / 한글과유니코드.md
Created August 9, 2019 06:14 — forked from Pusnow/한글과유니코드.md
한글과 유니코드

한글과 유니코드

유니코드에서 한글을 어떻게 다루는지를 정리하였다.

유니코드

  • 유니코드(Unicode)는 전 세계의 모든 문자를 컴퓨터에서 일관되게 표현하고 다룰 수 있도록 설계된 산업 표준 (위키 백과)
  • 단순히 문자마다 번호를 붙임
  • 계속 업데이트되며 현재는 Unicode Version 9.0.0 이 최신이다.

UTF

  • 유니코드를 실제 파일 등에 어떻게 기록할 것인지를 표준화한 것이다.
@wafe
wafe / Import-PfxCertificate.ps1
Last active April 28, 2020 20:56 — forked from deadlydog/Import-PfxCertificate.ps1
PowerShell script that imports a .pfx certificate file. To install pfx certificate on IIS
param($PfxFilePath, $Password)
$absolutePfxFilePath = Resolve-Path -Path $PfxFilePath
Write-Output "Importing store certificate '$absolutePfxFilePath'..."
Add-Type -AssemblyName System.Security
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($absolutePfxFilePath, $Password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags] "MachineKeySet, PersistKeySet")
$store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", LocalMachine
$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::"ReadWrite")

Keybase proof

I hereby claim:

  • I am wafe on github.
  • I am heejoonlee (https://keybase.io/heejoonlee) on keybase.
  • I have a public key whose fingerprint is 4FCF EF86 AB85 BD2B 445A 9546 B30B 9758 B00A 0AE2

To claim this, I am signing this object:

@wafe
wafe / code.cs
Last active December 29, 2016 14:09
dotnet 4.5 System.Uri Problem
string url1 = "http://localhost/contents/?registered_date_from=2016-12-26T15%3A00%3A00.000Z&registered_date_to=2016-12-27T15%3A00%3A00.000Z&keywords=%EA%B3%84%ED%9A%8D%EC%84%9C";
string url2 = "http://localhost/contents/?registered_date_from=2016-12-26T15%3A00%3A00.000Z&registered_date_to=2016-12-27T15%3A00%3A00.000Z";
var uri1 = new Uri(url1);
var uri2 = new Uri(url2);
Console.WriteLine(uri1.PathAndQuery);
Console.WriteLine(uri2.PathAndQuery);
/* 쿼리 스트링의 구성에 따라서(현상으로는 UTF-8 한글이 인코딩된 쿼리스트링이
@wafe
wafe / C# php Serializer.cs
Last active July 25, 2016 12:37 — forked from xiangwan/C php Serializer.cs
C# php Serializer
/// <summary>
/// Serializer Class.
/// </summary>
public class PhpSerializer
{
//types:
// N = null
// s = string
// i = int
@wafe
wafe / InitLogMethod.cs
Last active April 22, 2016 03:37
log4net 로그 XML 읽어서 초기화하는 예시
void InitLog(string log4netConfigXmlPath, string logFilePath)
{
XmlDocument doc = new XmlDocument();
doc.Load(log4netConfigXmlPath);
// log4net 설정 XML 에서 "FileLog" 라는 이름의 appender 를 찾아서 설정으로 받은
// 로그 파일 경로를 변경해준다. log4net 설정 XML을 만들 때 주의.
XmlAttribute filePathAttr = (XmlAttribute)doc.SelectSingleNode("/log4net/appender[@name='FileLog']/file/@value");
filePathAttr.Value = logFilePath;
@wafe
wafe / gist:0e13c84487094ead3b60
Created July 10, 2015 12:14
php not defined exception class
<?php
try
{
throw new Exception('an exception');
}
catch (NotDefinedExceptionClass $eae)
{
echo $eae->getMessage();
}