Skip to content

Instantly share code, notes, and snippets.

View saki7's full-sized avatar

Nana Sakisaka saki7

  • Tokyo, Japan
View GitHub Profile
@saki7
saki7 / index.js
Created July 7, 2018 04:58
AWS Lambda script to set static asset (image, audio, etc.) "Cache-Control" metadata in S3
const aws = require('aws-sdk')
const s3 = new aws.S3({ apiVersion: '2006-03-01' })
const svar_key = 'cache_control_script_version'
const svar_val = 7
exports.handler = async (event, context) => {
// console.log('Received event:', JSON.stringify(event, null, 2))
@saki7
saki7 / Relight.cs
Created April 27, 2018 10:46 — forked from ronyx69/Relight.cs
Source code for Relight mod. Rebalanced and customizable lighting and tonemapping. UI / saving and preset system by Simon Royer.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICities;
using UnityEngine;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Xml.Serialization;
@saki7
saki7 / keybase.md
Created November 16, 2017 09:59
keybase.md

Keybase proof

I hereby claim:

  • I am saki7 on github.
  • I am saki7 (https://keybase.io/saki7) on keybase.
  • I have a public key whose fingerprint is DB0D 58DC 0E8B 8BD3 0A21 370A 21D5 6F72 EEB1 77D3

To claim this, I am signing this object:

@saki7
saki7 / crypt_unlock.sh
Created July 7, 2017 14:12 — forked from gusennan/crypt_unlock.sh
initramfs-hook for unlocking LUKS-encrypted LVM partition
#!/bin/sh
PREREQ="dropbear"
prereqs() {
echo "$PREREQ"
}
case "$1" in
prereqs)
@saki7
saki7 / cdt-stackoverflow-project-generator.rb
Last active September 25, 2017 02:36
Project generator for Eclipse CDT bug #512297
# This is a project generator script for the Eclipse CDT bug 512297.
# For details, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=512297
# Note: You need Ruby 2.3 or above.
# This script is distributed under public domain.
require 'fileutils'
ROOT_PATH = "cdt-stackoverflow"
LIB_PATH = "#{ROOT_PATH}/sample-library"
@saki7
saki7 / public_suffix.cpp
Last active February 25, 2022 11:43
Public Suffix List (https://publicsuffix.org/) をパースするC++のコードの一例
#include "syn/bridge.hpp"
#include "syn/public_suffix.hpp"
#include <saya/logger.hpp>
#include <boost/range/algorithm/unique.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/algorithm_ext/erase.hpp>
#include <boost/algorithm/cxx11/any_of.hpp>
#include <boost/algorithm/string/join.hpp>
@saki7
saki7 / ImageList.js
Created March 6, 2016 04:33
どこかのサイトで紹介されていた、ページ内の画像一覧をまとめて表示するブックマークスニペット
javascript:(function(){function a(){pageImage=new b;pageImage.getImageUrl();if(!pageImage.newImages.length){alert("画像は見つかりませんでした");return}pageImage.createImage();pageImage.getBoxLayout();pageImage.createImageList();pageImage.openWindow()}function b(){this.newImages=new Array;this.box=new Object}b.prototype.getImageUrl=function(){var a=document.getElementsByTagName("img");if(a.length){for(var b=0;b<a.length;b++){this.newImages[b]={};this.newImages[b].src=a[b].src}}this.getBackgroundImageUrl();this.removeOverlap()};b.prototype.getBackgroundImageUrl=function(){var a=document.getElementsByTagName("*");for(var b=0,c,d,e;b<a.length;b++){c=document.defaultView.getComputedStyle(a[b],"").getPropertyValue("background-image");if(c!="none"){e=this.newImages.length;d=c.replace(/url\(\s*(['"]?)(.+)\1\s*\)/,"$2");this.newImages[e]={};this.newImages[e].src=d}}};b.prototype.removeOverlap=function(){var a=this.newImages;for(var b=0;b<a.length-2;b++){for(var c=a.length-1;c>b;c--){if(a[b].src==a[c].src){a.splice(c,1)}}}};b.proto
@saki7
saki7 / Custom.css
Last active August 29, 2015 14:01
エロ動画サイトで画像を全部消して埋め込み動画を探すためのユーザーCSS
img {
content: url("data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==") !important;
background: blue !important;
}
* {
background-image: none !important;
}
@saki7
saki7 / m.rb
Last active December 17, 2015 04:28
m.rb ― 辞書に読みがなが登録されていない単語でも読みがなが取れるクラス Yomigana を追加したMeCabのラッパーモジュール
# coding: utf-8
require 'MeCab'
# require 'lanx/str'
# Lanx::Str::Normalizer.katakana は、tr("ぁ-ん", "ァ-ン")してるだけです。自前で用意して下さい。
module Lanx
module M
UNK_FEATURE = '未知語'
@saki7
saki7 / gist:4054780
Created November 11, 2012 12:32
<C-g> git blame
function! s:git_commit_count_from_hash(filename,hash) "{{{
let lines = split(system(printf('git log --pretty=oneline %s'
\ ,a:filename)),"\n")
if len(lines) > 0
let commit_count = 0
for line in lines
let commit_count += 1
let line_split = split(line,' ')
let dict = {