Skip to content

Instantly share code, notes, and snippets.

View inabajunmr's full-sized avatar
aesthetics

inaba jun inabajunmr

aesthetics
View GitHub Profile
@jonleighton
jonleighton / base64ArrayBuffer.js
Last active May 21, 2024 04:57
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
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:
@gustavoatt
gustavoatt / gist:3217842
Created July 31, 2012 15:30
Sort of a stack with two stacks using insertion sort
#!/usr/bin/env python
from collections import deque
# Sort using insertion sort with stacks O(n^2)
def sort_stack(l):
res_stack = deque()
# We keep res_stack always sorted
while len(l) > 0:
@fedir
fedir / wkhtmltopdf@Debian8.sh
Last active October 5, 2022 16:05
Install wkhtmltopdf on Debian 8, 9
apt-get update
aptitude install xfonts-base xfonts-75dpi fontconfig xvfb
mkdir ~/src/wkhtmltopdf -p
cd ~/src/wkhtmltopdf
wget https://bitbucket.org/wkhtmltopdf/wkhtmltopdf/downloads/wkhtmltox-0.13.0-alpha-7b36694_linux-jessie-amd64.deb
dpkg -i wkhtmltox-0.13.0-alpha-7b36694_linux-jessie-amd64.deb
echo 'xvfb-run --server-args="-screen 0, 1024x768x24" /usr/local/bin/wkhtmltopdf $*' > /usr/bin/wkhtmltopdf.sh
chmod a+rx /usr/bin/wkhtmltopdf.sh
ln -s /usr/bin/wkhtmltopdf.sh /usr/local/sbin/wkhtmltopdf
/usr/local/sbin/wkhtmltopdf https://www.google.fr output.pdf
@juanca
juanca / github_load_all_diffs.js
Created March 2, 2017 18:42
Github PR bookmarklet: Load all file diffs
javascript:
document.querySelectorAll('.load-diff-button').forEach(node => node.click())
@masatomix
masatomix / HS256Main.java
Last active May 13, 2021 09:12
HS256 / RSA256 を用いたサンプル。共通鍵、公開鍵でハッシュした署名をつけるJWSのサンプルと、公開鍵で署名したJWTを検証するサンプルコード。
package nu.mine.kino;
import java.text.ParseException;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWSAlgorithm;
import com.nimbusds.jose.JWSHeader;
import com.nimbusds.jose.JWSObject;
import com.nimbusds.jose.JWSVerifier;
import com.nimbusds.jose.KeyLengthException;
@t-miya
t-miya / Amazonlinux.docker
Created October 3, 2017 08:35
AWS Lambda 用に pip でモジュールを用意するための Dockerfile
FROM amazonlinux:2017.03
RUN true\
&& yum -q -e 0 -y update || true\
&& yum -q -e 0 -y install gcc python27-devel python27-pip || true\
&& pip install --upgrade pip || true\
&& pip install wheel || true\
&& yum -q -e 0 -y clean all
CMD [""]
@macrat
macrat / image.go
Created November 9, 2017 05:25
golangでグラデーション作ったり、文字入れたり。
package main
import (
"image"
"image/color"
"image/png"
"os"
"golang.org/x/image/font"
"golang.org/x/image/font/basicfont"
@voluntas
voluntas / loadtest.rst
Last active April 3, 2024 03:25
負荷試験コトハジメ
@shyouhei
shyouhei / gist:22254d2cc60cef9016140cab0cdb50a2
Created June 5, 2020 05:33
会社に所属する理由は放置しておくとゴリゴリ削れていくぞ、という話

おことわり

  • 既に他媒体のインタビューなどで発表済みの内容をモンタージュしたものであり、卜部のことを詳細にストーキングしている読者がいるとすれば新規のコンテンツを含まない。
  • 卜部の人生は卜部の人生なのであっておまえらの人生ではない。「所謂普通の人生」を送ってきたという認識は寸毫もない。性急な一般化は危険と言わざるを得ない。

何個か前の受託開発の会社をやめたきっかけの話

当時、その案件にはひとりアサインで、客先常駐であった。幸いにして常駐先の皆さんには本当に良くしていただいて、困りごともなく、業務も適量で、掛け値なしによい客先だなと思っていた。

しかしそうなってくると、所属先に所属している意味ってなんだっけという疑問がむくむくと頭をもたげてくるのである。客先常駐ひとりアサインというのは客先常駐ひとりアサインであるがゆえに、会社がこんだけ抜いてるぞというのが隠しようがないわけ。客先に請求書持っていくのも自分なんだから単価も分かるし、振り込まれてる給料も分かる(明細見れば社保の会社負担分とかも分かる)。俺が所属先に投げてるバックオフィス業務は、この抜かれてる金額に見合っているか?

ところが。ところがなのである。やめるぞと宣言して常駐が解除になり、所属先に残りのしばらく通っていると、いろいろなことが見えてくるのだ。たとえば所属先の同僚と何気なく会話する。たとえばバックオフィスの人達と(やめるから)書類のやりとりをする。たとえば所属先の営業が電話をかけている。そういうごく些細なことの積み重ねがあるのだ。会社は、中抜きするだけの謎の組織ではなかった。もっとディティールがある。そこを無視して、というか、そこが不可視化されて、金のやりとりだけ見えてしまうから、不要という話に傾いてしまったんだと気づいた。まあ言った以上はそのままやめたし次も良かったから後悔もないけど、不幸な、というか、回避策は何かあったんではないか。

@herrjemand
herrjemand / verify.apple.attestation.js
Last active October 14, 2023 18:01
Snippet code to verify apple anonymous attestation
const crypto = require('crypto');
const base64url = require('base64url');
const cbor = require('cbor');
const asn1 = require('@lapo/asn1js');
const jsrsasign = require('jsrsasign');
/* Apple Webauthn Root
* Original is here https://www.apple.com/certificateauthority/Apple_WebAuthn_Root_CA.pem
*/
let appleWebAuthnRoot = 'MIICEjCCAZmgAwIBAgIQaB0BbHo84wIlpQGUKEdXcTAKBggqhkjOPQQDAzBLMR8wHQYDVQQDDBZBcHBsZSBXZWJBdXRobiBSb290IENBMRMwEQYDVQQKDApBcHBsZSBJbmMuMRMwEQYDVQQIDApDYWxpZm9ybmlhMB4XDTIwMDMxODE4MjEzMloXDTQ1MDMxNTAwMDAwMFowSzEfMB0GA1UEAwwWQXBwbGUgV2ViQXV0aG4gUm9vdCBDQTETMBEGA1UECgwKQXBwbGUgSW5jLjETMBEGA1UECAwKQ2FsaWZvcm5pYTB2MBAGByqGSM49AgEGBSuBBAAiA2IABCJCQ2pTVhzjl4Wo6IhHtMSAzO2cv+H9DQKev3//fG59G11kxu9eI0/7o6V5uShBpe1u6l6mS19S1FEh6yGljnZAJ+2GNP1mi/YK2kSXIuTHjxA/pcoRf7XkOtO4o1qlcaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUJtdk2cV4wlpn0afeaxLQG2PxxtcwDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2cAMGQCMFrZ+9DsJ1PW9hfNdBywZDsWDbWFp28it1d/5w2RPkRX3Bbn/UbDTNLx7Jr3jAGGiQIwHFj+dJZYUJR786osByBelJYsVZd2GbHQu209b5