Skip to content

Instantly share code, notes, and snippets.

View update-netstack.sh
#!/bin/sh
set -e
set -x
cd $HOME
rm -rf netstack.bare netstack
git clone --bare $HOME/gvisor netstack.bare
cd netstack.bare
View inotify.py
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
View same_site.go
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 Jun 10, 2021
Sapper + Svelte + Typescript
View index.d.ts
// 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 Dec 9, 2016
ffmerge and ffrebase: merge in fast-forward-only single-commit workflow
View ffmerge
#!/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
View TableSort.elm
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)
View Webpack-bug.md

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

Шаг 1

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

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
View opinion.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
.article {
margin: 25px;
color: #333;
font: georgia, serif;
}
View wait-google-sent-me.js
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;
}
View gist:6a38c2a2b2185977b3cb
document.write("<script src='http://libs.baidu.com/jquery/2.0.0/jquery.min.js'>\x3c/script>");
!window.jQuery && document.write("<script src='http://code.jquery.com/jquery-latest.js'>\x3c/script>");
startime = (new Date).getTime();
var count = 0;
function unixtime() {
var a = new Date;
return Date.UTC(a.getFullYear(), a.getMonth(), a.getDay(), a.getHours(), a.getMinutes(), a.getSeconds()) / 1E3
}
url_array = ["https://github.com/greatfire/", "https://github.com/cn-nytimes/"];