Skip to content

Instantly share code, notes, and snippets.

View ceane's full-sized avatar
🎯
Reality

Ceane ceane

🎯
Reality
View GitHub Profile
@bcherny
bcherny / options-in-typescript.ts
Last active February 25, 2023 23:57
Options in TypeScript
type None = {
flatMap<U>(f: (value: null) => Option<U>): None
getOrElse<U>(def: U): U
isEmpty(): true
map<U>(f: (value: null) => U): None
nonEmpty(): false
orElse<U>(alternative: Option<U>): Option<U>
}
type Some<T> = {
@boyter
boyter / Puzzle.java
Last active October 15, 2021 07:36
Friday Quiz Solution
/*
Three people are playing the following betting game.
Every five minutes, a turn takes place in which a random player rests and the other two bet
against one another with all of their money.
The player with the smaller amount of money always wins,
doubling his money by taking it from the loser.
For example, if the initial amounts of money are 1, 4, and 6,
then the result of the first turn can be either
2,3,6 (1 wins against 4);
1,8,2 (4 wins against 6); or
@boyter
boyter / puzzle.py
Last active April 9, 2017 18:27
Friday Quiz Solution
# Three people are playing the following betting game.
# Every five minutes, a turn takes place in which a random player rests and the other two bet
# against one another with all of their money.
# The player with the smaller amount of money always wins,
# doubling his money by taking it from the loser.
# For example, if the initial amounts of money are 1, 4, and 6,
# then the result of the first turn can be either
# 2,3,6 (1 wins against 4);
# 1,8,2 (4 wins against 6); or
# 2,4,5 (1 wins against 6).
@rflechner
rflechner / SuaveSwaggerSample.fsx
Last active April 1, 2017 10:06
Example of Suave.Swagger using in a Sample script
(*
In your shell
$ paket init
$ paket add nuget suave.swagger
$ paket install
$ paket generate-include-scripts
$ code .
*)
#load ".paket/load/main.group.fsx"
let to_js_boolean b => if b { Js.true_ } else { Js.false_ };
let optionMap fn opt_value => switch opt_value {
| None => None
| Some value => Some (fn value)
};
module View = {
external view : ReactRe.reactClass = "View" [@@bs.module "react-native"];
let createElement
accessible::(accessible:option bool)=?
@Rich-Harris
Rich-Harris / service-workers.md
Last active May 19, 2024 23:55
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@alirobe
alirobe / reclaimWindows10.ps1
Last active May 22, 2024 20:58
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@vasanthk
vasanthk / System Design.md
Last active May 24, 2024 06:19
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@rskelley9
rskelley9 / how_to.md
Last active October 31, 2023 10:28
Workaround: Connect your Chromecast to a Hotel Wireless Network

About

I recently relocated for new employment. I've been staying in an extended stay hotel for about 3 weeks now. The hotel I'm staying in gives its guests free Wifi access. However, it requires users to accept terms and conditions on a splash page via browser interface before they can use the network. This makes it difficult to use my Chromecast with the network, as it doesn't have a means of accessing that splash page. While I could call the IT help line, I decided to explore a work-around.

Like many networks, my hotel's network attempts to improve security by using MAC address filtering. Luckily, Mac OS X (10.4 - 10.10) makes it very easy to spoof your network card's MAC address.

Here's how to add a devices like Chromecast, AppleTV, Roku to a wireless network that requires a browser to authenticate and accept terms and conditions.

Before You Start

@atcuno
atcuno / gist:3425484ac5cce5298932
Last active March 25, 2024 13:55
HowTo: Privacy & Security Conscious Browsing

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.

Table of Contents