Skip to content

Instantly share code, notes, and snippets.

@BretFisher
BretFisher / docker-for-mac.md
Last active May 15, 2025 16:59
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@addyosmani
addyosmani / preprocessing.md
Last active January 31, 2025 18:33
JavaScript preprocessing/precompilation

Problem: How can we preprocess JavaScript (at build-time or on the server-side) so engines like V8 don't have to spend as much time in Parse? This is a topic that involves generating either bytecode or a bytecode-like-abstraction that an engine would need to accept. For folks that don't know, modern web apps typically spend a lot longer in Parsing & Compiling JS than you may think.

  • Yoav: This can particularly be an issue on mobile. Same files getting parsed all the time for users. Theoretically if we moved the parsing work to the server-side, we would have to worry about it less.
  • One angle to this problem is we all ship too much JavaScript. That's one perspective. We could also look at preprocessing.
  • We've been talking about this topic over the last few weeks a bit with V8. There were three main options proposed.
    1. Similar to what optimize-js does. Identify IIFEs and mark them as such so the browser and VMs heuristics will catch them and do a better job than today. optimize-js only tackles IIFE bu
@mala
mala / autofill_ui.md
Last active January 19, 2017 07:02
暮らしに役立つITコラム ChromeやSafariの自動入力機能が、なぜ「悪いデザイン」なのか

見た目の上で、隠されているフィールドに対しても自動入力してしまうという問題が話題になっている(2017年1月)

のだけれど、この問題の歴史はとても古い。自分も調査したり問題を報告したりしているので、振り返ってみる。

2012年の話

2012年4月のShibuya.XSS #1 https://atnd.org/events/25689 で、Hamachiya2が発表した

@watilde
watilde / board.md
Last active November 15, 2016 07:29
Node discussion at Tokyo Node festival 2016

Good Point

NPM

  • package.json
  • Ecosystem

Perfomance

  • Perfomance improvement
  • Optimaized for perfomance
  • Quick start for webapp
@mala
mala / gist:457a25650950d4daf4144f98159802cc
Last active September 28, 2016 12:55
CVE-2016-7401 CSRF protection bypass on a site with Google Analytics の解説

CVE-2016-7401

多くのcookie parserは、pairsの区切りとして ; と , を許容しているのでdjango以外にも影響がある。 ブラウザが使用するcookie pairの区切りは実際には ;

@voluntas
voluntas / react.rst
Last active May 25, 2022 11:57
React コトハジメ

React コトハジメ

日時:2017-01-02
作:@voluntas
バージョン:2.1.0
URL:https://voluntas.githu.io/

突っ込みは Twitter @voluntas まで。

@taichi
taichi / code_review_basics.md
Last active May 30, 2024 14:23
チームでコードを書き始めた後、「どうやらレビューってやつをした方が良いらしい」くらいの若手に向けた資料です。

コードレビューの基本


一番大事な事

ソースコードはプロジェクトの共同所有物である

  • 誰かだけが触れるコードを無くす
@yuroyoro
yuroyoro / Uber-migrated-pg-to-mysql.md
Created July 27, 2016 06:28
UberのPostgresqlからNoSQL on MySQLへの移行を読んでざっくりまとめた

Why Uber Engineering Switched from Postgres to MySQL - Uber Engineering Blog のまとめ

Posgresqlだと

  • pgは追記型なので少しの更新でも多くのdiskへのwriteがおきる
  • カラムを一つ更新しただけで多くのindexの書き換えが起こる
  • よって、replicationはWALを送るので更新が多いとWALが大量に送られる
  • repcliationでは物理的なdiskの変更を送る
  • DC間でレプリするときつい
  • bugがあってreplica間でMVCCの不整合が起きる
# 最初になにをやるのかをコメントで書いておくとコードがぐっとわかりやすくなります。
# コードを書いているときは「ここでは〇〇をやろう」と考えながら書いているわけだけど、
# いったんコードになってしまうとそのメタな情報はなくなってしまうので、
# 読者は「結局これは何をやっているのか」というのを推測しながら読むことになってしまいます。
# コメントで意図を説明しておけば推測に頼らずにすむし、変なコードがあっても意図通り
# なのかバグなのか判別がつきやすい。
#
# なおこれはトップレベルのメソッドです。どういうレイアウトがいいかは
# 他にどんなコードがあるかによりますが、元々の例では単体のこのコードしかないので、
# 単純に引数の合計を計算するだけのものにクラスは不要でしょう。