Skip to content

Instantly share code, notes, and snippets.

View sorashi's full-sized avatar

Dennis Pražák sorashi

View GitHub Profile
@sorashi
sorashi / source.cs
Created March 31, 2020 19:38
Get page source after javascript execution using CefSharp.Offscreen (chromium)
private static Task LoadPageAsync(IWebBrowser browser) {
var tcs = new TaskCompletionSource<bool>();
void Handler(object sender, LoadingStateChangedEventArgs args) {
if (args.IsLoading) return;
browser.LoadingStateChanged -= Handler;
tcs.TrySetResult(true);
}
browser.LoadingStateChanged += Handler;
@sorashi
sorashi / recodex-md.user.js
Last active February 22, 2020 12:04
recodex user script for Tampermonkey/Greasemonkey
// ==UserScript==
// @name ReCodEx Task Markdown to Clipboard
// @description Adds a button to ReCodEx tasks, which allows you to copy the task markdown to clipboard
// @namespace http://sorashi.github.io/
// @version 0.1
// @author sorashi
// @include https://recodex.mff.cuni.cz/app/assignment/*
// @updateURL https://gist.github.com/sorashi/3c133f743f24459bc6cf0a121b7113ef/raw
// @downloadURL https://gist.github.com/sorashi/3c133f743f24459bc6cf0a121b7113ef/raw
// @require https://unpkg.com/turndown/dist/turndown.js
都道府県 English name katakana romaji
北海道 Hokkaido スンマセン sunmasen
青森県 Aomori ブジョホヘンシタ bujohohenshita
岩手県 Iwate オモサゲナガンス omosagenagansu
宮城県 Miyagi ゴメンナー gomennā
秋田県 Akita シカダネァ shikadanæ
山形県 Yamagata ワレガッタナス waregattanasu
福島県 Fukushima ボットナー bottonā
茨城県 Ibaraki スンマセン sunmasen
栃木県 Tochigi イヤーワリーネー iyāwarīnē
@sorashi
sorashi / _readme.md
Last active December 26, 2023 05:01
Windows registry edit that adds Windows command-line (cmd), Powershell and optionally GIT Bash to directory context menu

Registry edit that allows you to add Windows command-line, Powershell and/or GIT Bash to explorer context menu. source

@sorashi
sorashi / netversion.bat
Last active June 9, 2021 03:13
Print installed versions of .NET Framework on Windows (batch script)
@echo off
cd C:\Windows\Microsoft.NET\Framework
for /d %%D in (*) do echo %%~fD
PAUSE
@sorashi
sorashi / readme.md
Last active November 3, 2019 14:55
GPG keychain export and import with ownertrust

How to move PGP keys and ownertrust using GPG to a new computer / machine

Export

gpg -a --export > pubkeys.asc
gpg -a --export-secret-keys > privatekeys.asc
gpg --export-ownertrust > otrust.txt

Import

@sorashi
sorashi / readme.md
Last active September 28, 2018 20:12
Custom AppVeyor webhook for Discord
{
  "embeds": [
    {
      "title": "Build {{buildId}}",
      "url": "{{buildUrl}}",
      "color": {{#passed}}40973{{/passed}}{{^passed}}11672839{{/passed}},
      "footer": {
        "icon_url": "{{#passed}}https://i.imgur.com/Rf4g8v6.png{{/passed}}{{^passed}}https://i.imgur.com/QaERwAW.png{{/passed}}",
 "text": "{{#passed}}Success{{/passed}}{{^passed}}Failure{{/passed}}"
@sorashi
sorashi / color_names.txt
Created August 1, 2017 14:30
Color dictionary, taken from Name that Color http://chir.ag/projects/ntc/
000000|Black
000080|Navy Blue
0000C8|Dark Blue
0000FF|Blue
000741|Stratos
001B1C|Swamp
002387|Resolution Blue
002900|Deep Fir
002E20|Burnham
002FA7|International Klein Blue
@sorashi
sorashi / problem54.csx
Last active May 25, 2017 15:46
This is the solution to problem 54 of Project Euler. Don't look at this if you don't want to see spoilers. The hand ranking uses a lot of LINQ, enjoy 😄
#r "System.Numerics"
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.IO;
using System.Diagnostics;
/*
@sorashi
sorashi / primalityTest.cs
Last active June 9, 2021 03:22
Prime number utilities
public static bool IsPrime(int candidate) {
if ((candidate & 1) == 0)
return candidate == 2;
for (int i = 3; (i * i) <= candidate; i += 2)
if ((candidate % i) == 0)
return false;
return candidate != 1;
}