Skip to content

Instantly share code, notes, and snippets.

@tksst
tksst / summary.md
Last active March 9, 2024 06:01
UbuntuのAMDドライバによる性能の違い

glmark2 -s 2560x1440で測定

Ubuntu 22.04.4 LTSのデフォルト状態と、AMD Radeon™ & Radeon PRO™ グラフィックス用の Linux® ドライバーを入れた状態で比較

全体結果は デフォルト: 1953、AMDドライバ: 2000 ということで、AMDドライバのほうが2.4%結果が良かった。 個別のベンチマークもほとんどがAMDドライバのほうが良いので、測定誤差などではなさそうに見える。

@tksst
tksst / keybase.md
Last active January 16, 2024 15:57
OpenPGP proofs

Keybase proof

I hereby claim:

  • I am tksst on github.
  • I am tksst (https://keybase.io/tksst) on keybase.
  • I have a public key whose fingerprint is CC61 F0D7 1BE4 C752 AA37 6E79 6F1D 270A DFF4 AD18

To claim this, I am signing this object:

@tksst
tksst / nosleep.cmd
Created August 14, 2023 09:58
Windowsのスリープを妨害するスクリプト
@powershell -NoProfile -ExecutionPolicy Unrestricted "&([ScriptBlock]::Create((cat \"%~f0\" | ?{$_.ReadCount -gt 1}) -join \"`n\"))" %* & goto:eof
$Signature = @'
[DllImport("kernel32.dll")]
public static extern int SetThreadExecutionState(int esFlags);
'@
$Foo = Add-Type -MemberDefinition $Signature -Name "Bar" -Namespace Baz -PassThru
echo "NoSleep started. Press Ctrl+C to exit."
@tksst
tksst / _tmpfs_sync.md
Last active February 23, 2023 03:33
tmpfsをSSDと同期する

高速化のためにtmpfsを使用しつつ、lsyncdでSSDに常時同期して永続化する仕組みを作った。

概要

システム起動時

以下をsystemdによって行う。

  1. /home/user/fooにtmpfsをマウント
  2. /home/user/foo-staticから/home/user/fooにファイルを同期。
@tksst
tksst / clone.sh
Last active June 10, 2023 02:53
GitHub clone script
#!/bin/bash
set -e
set -u
DEFAULT_ORGANIZATION=tksst
function getconf(){
git config --local "$1"|| true
}
@tksst
tksst / tied-to-pr.yml
Created November 20, 2022 08:48
Check if the branch is tied to Pull Request
name: Check if the branch is tied to PR
on:
workflow_call:
outputs:
tied-to-pr:
description: Whether the branch is tied to PR or not
value: ${{ jobs.check-pr.outputs.tied-to-pr }}
jobs:
@tksst
tksst / index.mjs
Created September 6, 2022 14:58
recursiveReaddir.mjs
import fs from "node:fs/promises";
import path from "node:path";
function isNil(it) {
return it === null || it === undefined;
}
function isNotNil(it) {
return it !== null && it !== undefined;
}
@tksst
tksst / recursiveReaddir.ts
Created August 26, 2022 10:21
recursiveReaddir.ts
import fs from "node:fs/promises";
import path from "node:path";
async function* recursiveReaddir(dir: string): AsyncGenerator<string> {
const dirents = await fs.readdir(dir, { withFileTypes: true });
for (const dirent of dirents) {
const joined = path.join(dir, dirent.name);
if (dirent.isDirectory()) {
// eslint-disable-next-line no-await-in-loop
for await (const name of recursiveReaddir(joined)) {
@tksst
tksst / add_pac.cmd
Last active February 20, 2022 01:56
PACファイルを切り替える
@echo off
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /v "DefaultConnectionSettings" /t REG_BINARY /d "4600000016" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "AutoConfigURL" /t REG_SZ /d "http://YOUR_PAC_URL" /f
if errorlevel 1 (
echo error occured
pause
)
typedef struct
{
char *str;
conn_rec *c;
} dump_conn_notes_ctx;
static int foo(void *rec, const char *key, const char *value)
{
dump_conn_notes_ctx *v = rec;