Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
set -e
set -x
cd $HOME
rm -rf netstack.bare netstack
git clone --bare $HOME/gvisor netstack.bare
cd netstack.bare
import functools
import logging
import os
import struct
from typing import Dict, cast, Optional, List
import cytoolz
from trio.hazmat import wait_readable
import inotify_simple
import trio
package main
import (
"regexp"
"strconv"
)
// Don’t send `SameSite=None` to known incompatible clients.
func shouldSendSameSiteNone(useragent string) (bool, error) {
sameSiteNoneIncompatible, err := isSameSiteNoneIncompatible(useragent)
@eh-dub
eh-dub / index.d.ts
Last active June 10, 2021 16:45
Sapper + Svelte + Typescript
// in $PROJECT_ROOT/typings/@sapper
declare module '@sapper/app' {
// from sapper/runtime/src/app/types.ts
// sapper doesn't export its types yet
interface Redirect {
statusCode: number
location: string
}
// end
@shamrin
shamrin / ffmerge
Last active December 9, 2016 09:30
ffmerge and ffrebase: merge in fast-forward-only single-commit workflow
#!/usr/bin/env fish
set branch (git symbolic-ref -q --short HEAD)
or exit 1
if test $branch = "master"
echo "error: can't ffmerge master to master, switch to feature branch first"
exit 2
end
@pdamoc
pdamoc / TableSort.elm
Created February 16, 2016 17:15
TableSort
import Html exposing (..)
import Html.Events exposing (onClick)
import StartApp.Simple exposing (start)
-- Generic
type alias HeadItem a =
{ sorter: (a -> a -> Basics.Order)
, toHtml : (a -> Html)

Суть бага в Webpack v1.12.11

Шаг 1

Есть модуль A, который импортирует модуль B В процессе первого(!) импорта модуля B происходит его инициализация, которая в коде вебпака происходит следующим образом:

/******/ 		// Check if module is in cache
/******/ if(installedModules[moduleId])
@yomotsu
yomotsu / getDeltaAngle.js
Last active May 11, 2023 14:53
Calculates the shortest difference between two given angles given in radians, in JS
// http://docs.unity3d.com/ja/current/ScriptReference/Mathf.DeltaAngle.html
var getDeltaAngle = function () {
var TAU = 2 * Math.PI;
var mod = function ( a, n ) { return ( a % n + n ) % n; }
return function ( current, target ) {
var a = mod( ( current - target ), TAU );
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
.article {
margin: 25px;
color: #333;
font: georgia, serif;
}
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}