Skip to content

Instantly share code, notes, and snippets.

View kazuph's full-sized avatar

Kazuhiro Homma kazuph

View GitHub Profile
@kohya-ss
kohya-ss / gradio_llm.py
Last active May 2, 2024 05:57
gradioでLLMを利用する簡易クライアント
# Apache License 2.0
# 使用法は gist のコメントを見てください
import argparse
from typing import List, Optional, Union, Iterator
from llama_cpp.llama_chat_format import _convert_completion_to_chat, register_chat_completion_handler
import llama_cpp.llama_types as llama_types
from llama_cpp.llama import LogitsProcessorList, LlamaGrammar
from llama_cpp import Llama, llama_chat_format
import gradio as gr
@korakot
korakot / record.py
Last active April 7, 2024 14:35
Record audio in Colab using getUserMedia({ audio: true })
# all imports
from IPython.display import Javascript
from google.colab import output
from base64 import b64decode
from io import BytesIO
!pip -q install pydub
from pydub import AudioSegment
RECORD = """
const sleep = time => new Promise(resolve => setTimeout(resolve, time))
@hayajo
hayajo / 00.md
Last active October 29, 2020 10:02
TCP/IPとか運用とかsystemdとか #オンシャヘイシャ
@ChocolateMinht
ChocolateMinht / Alamofire.swift
Created January 7, 2015 02:42
Alamofire wrapped in a struct (iOS7 compatibility)
// Alamofire.swift
//
// Copyright (c) 2014 Alamofire (http://alamofire.org)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@mash
mash / Makefile
Last active August 29, 2015 14:06
OUT = ir-state.png ir-learn.png ir-send.png packer.png wifi-morse-setup.png
all: $(OUT)
.SUFFIXES: .png .gv .msc
.gv.png:
dot -Tpng $< -o $@
@ainame
ainame / AMEHTTPRequestTestCase.h
Last active August 29, 2015 14:01
非同期+HTTPリクエストをスタブしたいときに使うと便利なテストクラス
#import <XCTest/XCTest.h>
#import <TKRGuard.h>
#import <OHHTTPStubs.h>
@interface AMEHTTPRequestTestCase : XCTestCase
@property (nonatomic, strong) NSURLRequest *lastRequest;
- (void)stubAllRequestWithResponseFileName:(NSString *)responseFileName statuCode:(NSInteger)statusCode;
@hayajo
hayajo / downcase.ank
Last active August 29, 2015 13:58
ankoを使ってプラグイン機構っぽいのを実装してみた
filter.Add(func(s) {
return strings.ToLower(s)
}, 10)
@yoheia
yoheia / perl_oneliner_example
Last active January 24, 2020 18:12
Perlワンライナー&マルチライナー集
Perl ワンライナーサンプル集
■概要
障害解析のためのログの調査、非互換対応でのソースコードの調査といった
テキスト処理で使った Perl ワンライナーのサンプル集です。
Perl ワンライナーは以下の点が良いと思います。
・Perl は Oracle Database (10g以降) に同梱されている。
 従って、Windows プラットフォームでも使える。
my (@price,@day);
<STDIN> =~ /(\d+) (\d+)/;
$price[$_] = <STDIN> for (0..($1-1));
$day[$_] = <STDIN> for (0..($2-1));
@price = sort {$a <=> $b} @price;
for my $setprice (@day){
my @tmp = grep { $_ <= $setprice - $price[0] } @price;
my $check = 0;
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet