Skip to content

Instantly share code, notes, and snippets.

Avatar

Nana Sakisaka saki7

  • Tokyo, Japan
View GitHub Profile
@saki7
saki7 / index.js
Created Jul 7, 2018
AWS Lambda script to set static asset (image, audio, etc.) "Cache-Control" metadata in S3
View index.js
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 Apr 27, 2018 — forked from ronyx69/Relight.cs
Source code for Relight mod. Rebalanced and customizable lighting and tonemapping. UI / saving and preset system by Simon Royer.
View Relight.cs
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;
View 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 Jul 7, 2017 — forked from gusennan/crypt_unlock.sh
initramfs-hook for unlocking LUKS-encrypted LVM partition
View crypt_unlock.sh
#!/bin/sh
PREREQ="dropbear"
prereqs() {
echo "$PREREQ"
}
case "$1" in
prereqs)
@saki7
saki7 / cdt-stackoverflow-project-generator.rb
Last active Sep 25, 2017
Project generator for Eclipse CDT bug #512297
View cdt-stackoverflow-project-generator.rb
# 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 Jul 22, 2016
Public Suffix List (https://publicsuffix.org/) をパースするC++のコードの一例
View public_suffix.cpp
#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 Mar 6, 2016
どこかのサイトで紹介されていた、ページ内の画像一覧をまとめて表示するブックマークスニペット
View ImageList.js
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 Aug 29, 2015
エロ動画サイトで画像を全部消して埋め込み動画を探すためのユーザーCSS
View Custom.css
img {
content: url("data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==") !important;
background: blue !important;
}
* {
background-image: none !important;
}
@saki7
saki7 / m.rb
Last active Dec 17, 2015
m.rb ― 辞書に読みがなが登録されていない単語でも読みがなが取れるクラス Yomigana を追加したMeCabのラッパーモジュール
View m.rb
# coding: utf-8
require 'MeCab'
# require 'lanx/str'
# Lanx::Str::Normalizer.katakana は、tr("ぁ-ん", "ァ-ン")してるだけです。自前で用意して下さい。
module Lanx
module M
UNK_FEATURE = '未知語'
@saki7
saki7 / gist:4054780
Created Nov 11, 2012
<C-g> git blame
View gist:4054780
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 = {