Skip to content

Instantly share code, notes, and snippets.

View mmizutani's full-sized avatar

Minoru Mizutani mmizutani

  • Tokyo
  • 05:16 (UTC +09:00)
View GitHub Profile
@mmizutani
mmizutani / ocr.sh
Created June 29, 2023 05:18 — forked from doraTeX/ocr.sh
A shell script to perform OCR on images/PDFs using macOS built-in OCR engine
#!/bin/bash
SCRIPTNAME=$(basename "$0")
function realpath () {
f=$@;
if [ -d "$f" ]; then
base="";
dir="$f";
else
base="/$(basename "$f")";
@mmizutani
mmizutani / llama-home.md
Created May 15, 2023 19:12 — forked from rain-1/llama-home.md
How to run Llama 13B with a 6GB graphics card

This worked on 14/May/23. The instructions will probably require updating in the future.

llama is a text prediction model similar to GPT-2, and the version of GPT-3 that has not been fine tuned yet. It is also possible to run fine tuned versions (like alpaca or vicuna with this. I think. Those versions are more focused on answering questions)

Note: I have been told that this does not support multiple GPUs. It can only use a single GPU.

It is possible to run LLama 13B with a 6GB graphics card now! (e.g. a RTX 2060). Thanks to the amazing work involved in llama.cpp. The latest change is CUDA/cuBLAS which allows you pick an arbitrary number of the transformer layers to be run on the GPU. This is perfect for low VRAM.

  • Clone llama.cpp from git, I am on commit 08737ef720f0510c7ec2aa84d7f70c691073c35d.
@mmizutani
mmizutani / template_injection.yara
Created March 16, 2023 23:45 — forked from JohnLaTwC/template_injection.yara
Word OXML Template Injection
rule gen_injected_template_Word
{
meta:
description = "Detects injected templates in DOCX"
author = "John Lambert @JohnLaTwC"
date = "2020-05-03"
hash1 = "a3eca35d14b0e020444186a5faaba5997994a47af08580521f808b1bb83d6063"
hash2 = "a275dfa95393148bb9e0ddf5346f9fedcc9c87fa2ec3ce1ec875843664c37c89"
hash3 = "ed4835e5fd10bbd2be04c5ea9eb2b8e750aff2ef235de6e0f18d369469f69c83"
file_protocol_hash1 = "ac6c1df3895af63b864bb33bf30cb31059e247443ddb8f23517849362ec94f08 (settings.xml.rels)"
@mmizutani
mmizutani / gist:b451b43384a085a13e85a80998719356
Created September 5, 2022 02:00 — forked from ansonK/gist:e01f1559ae078bb8b4a8
Manually set Rails 4 session cookie for tests
#
# Manually set the contents of an encrypted session cookie
#
# Uses the same encryption keys as the Rails app using devise
#
# Based off http://big-elephants.com/2014-01/handling-rails-4-sessions-with-go/
# Verified against https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/cookies.rb
#
class TestSession
@mmizutani
mmizutani / envoy-schema.json
Last active February 26, 2023 06:06 — forked from linux-china/envoy-schema.json
Envoy configuration json schema for Json and Yaml based on Envoy v1.20.1 (e9f36d2)
{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"node": {
"properties": {
"id": {
"type": "string",
"description": "An opaque node identifier for the Envoy node. This also provides the local\n service node name. It should be set if any of the following features are\n used: :ref:`statsd <arch_overview_statistics>`, :ref:`CDS\n <config_cluster_manager_cds>`, and :ref:`HTTP tracing\n <arch_overview_tracing>`, either in this message or via\n :option:`--service-node`."
},
"cluster": {
@mmizutani
mmizutani / bug_report.rb
Created September 16, 2021 09:59 — forked from blimmer/bug_report.rb
ActiveRecord 5 Bug Report - marshal slow loading
# frozen_string_literal: true
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
@mmizutani
mmizutani / legal.md
Created September 14, 2021 10:14 — forked from CLAassistant/cookies.md
Legal Terms
@mmizutani
mmizutani / SearchAndReplaceInText.cs
Created December 14, 2020 01:42 — forked from shimondoodkin/SearchAndReplaceInText.cs
search and replace in an Open XML word document.
/*
references:
WindowsBase
Open XML Format SDK 2.5 - from NuGet
*/
using System;
using System.Collections.Generic;
using System.Linq;
@mmizutani
mmizutani / kubectl.md
Created June 6, 2020 22:45 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no