Skip to content

Instantly share code, notes, and snippets.

View 13xforever's full-sized avatar
💮
わたしは あの路で死んだ花

Ilya 13xforever

💮
わたしは あの路で死んだ花
View GitHub Profile
var stats = document.getElementsByClassName('stats-both');
var firstOnlyStats = document.getElementsByClassName('stats-firstonly');
var total = parseInt(stats[stats.length-2].textContent, 10) + parseInt(firstOnlyStats[firstOnlyStats.length-2].textContent, 10);
for (var i = 0; i < stats.length; i++)
{
var num = parseInt(stats[i].textContent, 10);
var numBoth = parseInt(firstOnlyStats[i].textContent, 10) + num;
if (!isNaN(num))
{
var percent = ""+Math.round(num*100/total);
@13xforever
13xforever / Organize-Content.ps1
Last active October 16, 2020 20:51
Renames and moves PSN PKGs into folders
#!/bin/pwsh
if ($PSVersionTable.PSVersion.Major -lt 6)
{
Write-Host "This script requires PowerShell 6.0 or newer"
Write-Host "Trying to restart..."
&pwsh $PSCommandPath
}
$content_id_matcher = [regex]'(?<content_id>(?<service_id>(?<service_letters>\w\w)(?<service_number>\d{4}))-(?<product_id>(?<product_letters>\w{4})(?<product_number>\d{5}))_(?<part>\d\d)-(?<label>\w{16}))'
$pkgs = @(Get-ChildItem *.pkg)

Keybase proof

I hereby claim:

  • I am 13xforever on github.
  • I am 13xforever (https://keybase.io/13xforever) on keybase.
  • I have a public key ASBv7cQQnzNQ64fyBFomr7-8ujat1BjLf5wvCM7Ujh46KAo

To claim this, I am signing this object:

internal static class Program
{
private static readonly SemaphoreSlim InstanceCheck = new SemaphoreSlim(0, 1);
private static readonly SemaphoreSlim ShutdownCheck = new SemaphoreSlim(0, 1);
internal static async Task Main(string[] args)
{
var thread = new Thread(() =>
{
using (var instanceLock = new Mutex(false, @"Global\mutex name"))
@13xforever
13xforever / IXMLDOMDocument.d.ts
Last active April 18, 2018 08:17
TypeScript typings for IXMLDOMDocument and IXMLDOMSchemaCollection ActiveX objects
declare module ActiveX {
export interface IXMLDOMNode {
attributes: IXMLDOMNamedNodeMap;
baseName?: string;
childNodes: IXMLDOMNodeList;
dataType?: string;
definition?: IXMLDOMNode;
firstChild: IXMLDOMNode;
lastChild: IXMLDOMNode;
namespaceURI?: string;
if ([System.Environment]::OSVersion.Version.Major -lt 6) { throw "Unsupported OS" }
$aeroEnablerSource = @'
using System;
using System.Runtime.InteropServices;
namespace CustomInterop
{
[Flags]
public enum DWM_BB
@13xforever
13xforever / hotspot_conf_decoder.cs
Created October 20, 2016 10:21
Nintendo Zone hotspot.conf Decoder
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace hotspot_conf_decoder
{
class Program
{
@13xforever
13xforever / KeyValuePair.cs
Last active December 18, 2015 02:39
KeyValuePair constuction helper
public static class KeyValuePair
{
public static KeyValuePair<TKey, TValue> Create<TKey, TValue>(TKey key, TValue value)
{
return new KeyValuePair<TKey, TValue>(key, value);
}
}
@13xforever
13xforever / GitInfo.cs
Created June 19, 2012 12:20
Getting last commit with changes in specified subfolder in git repository
internal class GitInfo : VcsInfoRetriever
{
public override VcsInfoData Execute(string localPath)
{
string relativePath;
var repoPath = FindRepoRoot(localPath, ".git\\index", out relativePath);
if (repoPath == null) return null;
using (var repo = new Repository(repoPath))
{
@13xforever
13xforever / StringLiteralDecoder.cs
Created March 27, 2011 11:33
Utility class to decode strings with literals in it
/*
This class should decode everything that is described in Chapter 2.4.4.4 Character literals of C# Language Specification.
See http://msdn.microsoft.com/en-us/library/aa691087.aspx for details.
I actually have test cases in the project in case you wondered, but feel free to test it for yourself.
It's free to use without limitations, but you must not expect any warranty or support for this code either.
*/