Skip to content

Instantly share code, notes, and snippets.

View mattn's full-sized avatar
🍛
I love curry 🍛

mattn mattn

🍛
I love curry 🍛
View GitHub Profile
module Users/is/dev-env/go/project1
go 1.21.0
require golang.org/x/sync v0.3.0
#include <windows.h>
typedef unsigned char byte;
typedef unsigned short uint16;
typedef unsigned int uint32;
void* get_proc_addr(byte *base, byte *name)
{
byte *pe_header = base+*(uint32*)(base+0x3c);
byte *exports = base+*(uint32*)(pe_header+0x78);
let s:endpoint = 'http://services.gingersoftware.com/Ginger/correct/json/GingerTheText'
let s:apikey = '6ae0c3a0-afdc-4532-a810-82ded0054236'
function! s:ginger(text)
let res = webapi#json#decode(webapi#http#get(s:endpoint, {
\ 'lang': 'US',
\ 'clientVersion': '2.0',
\ 'apiKey': s:apikey,
\ 'text': a:text}).content)
let i = 0
let correct = ''
@mattn
mattn / ssh-env.bat
Created March 12, 2010 11:20
windowsではssh-askpassが使えないのでsetxで環境変数に設定しちゃうぞバッチファイル
@echo off
if "%1" == "-f" goto doit
if "%1" == "-s" goto session
if not "%SSH_AGENT_PID%" == "" goto end
goto doit
:session
for /f "eol=; tokens=1,2 delims==;" %%1 in ('ssh-agent.exe') do (
if "%%1" == "SSH_AUTH_SOCK" setx SSH_AUTH_SOCK %%2 & set SSH_AUTH_SOCK=%%2
if "%%1" == "SSH_AGENT_PID" setx SSH_AGENT_PID %%2 & set SSH_AGENT_PID=%%2
import "websocket-polyfill"
import {
nip19,
relayInit,
generatePrivateKey,
getPublicKey,
getEventHash,
signEvent
} from 'nostr-tools'
export default function (server: Server, ctx: AppContext) {
server.app.bsky.actor.getProfile({
auth: authOptionalVerifier,
handler: async ({ auth, params }) => {
const { actor } = params
const requester = auth.credentials.did
const { db, services } = ctx
const actorService = services.actor(db)
const actorRes = await actorService.getActor(actor, true)
//
// gorun - Script-like runner for Go source files.
//
// https://wiki.ubuntu.com/gorun
//
// Copyright (c) 2011 Canonical Ltd.
//
// Written by Gustavo Niemeyer <gustavo.niemeyer@canonical.com>
//
package main
@rem /* vim:set ft=go:
@echo off
setlocal
set fn=%RANDOM%.go
set fp=%TEMP%\%fn%
more +10 "%~f0" > "%fp%"
(cd "%TEMP%" & go run %fn%)
del "%fp%"
goto :eof
*/
// A string-like object that points to a sized piece of memory.
//
// Functions or methods may use const StringPiece& parameters to accept either
// a "const char*" or a "string" value that will be implicitly converted to
// a StringPiece. The implicit conversion means that it is often appropriate
// to include this .h file in other files rather than forward-declaring
// StringPiece as would be appropriate for most other Google classes.
//
// Systematic usage of StringPiece is encouraged as it will reduce unnecessary
// conversions from "const char*" to "string" and back again.
@mattn
mattn / README.md
Last active February 3, 2023 02:23
$ ab -k -c 10 -n 10000 http://127.0.0.1:3000/

Node

Requests per second:    10137.73 [#/sec] (mean)

Go