Skip to content

Instantly share code, notes, and snippets.

View eczn's full-sized avatar
Star

eczn* eczn

Star
View GitHub Profile
@Papersman
Papersman / workers.js
Last active April 8, 2024 09:52
mikan_cloudflare_workers
/*
* https://github.com/netnr/workers
*
* 2019-10-12 - 2022-05-05
* netnr
*
* https://github.com/Rongronggg9/rsstt-img-relay
*
* 2021-09-13 - 2022-05-29
* modified by Rongronggg9
extension Task where Failure == Error {
// Start a new Task with a timeout. If the timeout expires before the operation is
// completed then the task is cancelled and an error is thrown.
init(priority: TaskPriority? = nil, timeout: TimeInterval, operation: @escaping @Sendable () async throws -> Success) {
self = Task(priority: priority) {
try await withThrowingTaskGroup(of: Success.self) { group -> Success in
group.addTask(operation: operation)
group.addTask {
try await _Concurrency.Task.sleep(nanoseconds: UInt64(timeout * 1_000_000_000))
@oussamahamdaoui
oussamahamdaoui / devtools-detect.js
Last active January 29, 2024 10:04
Detect devtools open and close events tested on Chrome and Safari
(function() {
'use strict';
const el = new Image();
let consoleIsOpen = false;
let consoleOpened = false;
Object.defineProperty(el, 'id', {
get: () => {
consoleIsOpen = true;
}
@Jack-Works
Jack-Works / 2018.js
Last active March 1, 2024 02:23
cRAzY eSnEXt (*all* proposals mixed in)
#! Aaaaaaaaaaa this is JS!!!
// https://github.com/tc39/proposal-hashbang
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Nov 23, 2018
for await(const x of (new A // https://github.com/tc39/proposal-pipeline-operator
|> do { // https://github.com/tc39/proposal-do-expressions
case(?) { // https://github.com/tc39/proposal-pattern-matching
when {val}: class {
@zhenhappy
zhenhappy / vpn_route.md
Created February 11, 2020 07:30 — forked from shalyf/vpn_route.md
利用路由表给VPN分流

2020年初因为武汉肺炎爆发,所以在家办公,公司给配置了L2TP的VPN,但是我不想所有流量都走VPN(VPN比较慢而且也节省流量),于是想到用路由表给VPN分流。
具体的方案就是公司内网的流量走VPN,外网流量走默认网关。

我是在macOS上操作的,其他平台应该也差不多。

假设:
公司内网 192.168.10.0/24
家里网络 192.168.1.0/24 你已经配置好VPN并且可以使用了。

@justjavac
justjavac / GetOptimizationStatus.md
Last active May 15, 2024 05:24
V8 %GetOptimizationStatus

%GetOptimizationStatus return a set of bitwise flags instead of a single value, to access the value, you need to take the binary representation of the returned value. Now, for example, if 65 is returned, the binary representation is the following:

(65).toString(2).padStart(12, '0');
// 000001000001

Each binary digit acts as a boolean with the following meaning:

import UIKit
import AVKit
class VideoView: UIView {
// video layer that will stream the url
private let videoLayer = AVPlayerLayer()
// pan gesture used for scrubbing
private let panGesture = UIPanGestureRecognizer()
@udzura
udzura / yawaraka-docker.md
Last active June 16, 2022 23:34
やわらかDocker
@forivall
forivall / y-combinator.ts
Last active March 27, 2024 03:38
Typescript Y-Combinator
// my brain decided to ask the question: yknow, i want you to think about the y combinator --
// like, what is it. like what the fuck girl, cmon, you have a comp sci degree, you should know this, and understand it and shit
// and so i was like fiiiiiiiiiiiiiiine gosh, lets see if typescript can handle the typing, and play around with it
// so i looked up a javascript implementation, and played with the type defintion until it
// matched up and then i was like oh: thats what the type definition of the functions in it are.
// i get it now. that's pretty cool. the main interesting thing is a the inner function that takes itself
// and returns the function initially passed to the outer function. neato.
@WorldSEnder
WorldSEnder / higher-kinded.ts
Last active January 9, 2023 21:37
Higher kinded types in typescript
// The two main components are the interfaces
// Generic<T, Context> and GenericArg<"identifier">
// Generic basically structurally replaces types in T that are GenericArg<S>
// for some `S extends keyof Context` with `Context[S]`
// See the test cases for specific uses.
// ====== TESTING
// Pass through for trivial types
type Test00 = Generic<number>;