Skip to content

Instantly share code, notes, and snippets.

View metteo's full-sized avatar

Grzegorz Nowak metteo

  • novaware
  • Krakow, Poland
View GitHub Profile
#!/bin/bash
# SPDX-License-Identifier: MIT
## Copyright (C) 2009 Przemyslaw Pawelczyk <[email protected]>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
#
# Lockable script boilerplate
@tbroyer
tbroyer / Html5Historian.java
Created February 22, 2012 10:07
GWT PlaceHistoryHandler.Historian using HTML5 pushState and onpopstate
/*
* Copyright 2012 Thomas Broyer <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@swankjesse
swankjesse / Rip.java
Created February 8, 2013 23:27
Stream editor for Java nerds. Use Java regular expressions to break up lines, and Java format strings to put them back together again.
/*bin/mkdir /tmp/rip 2> /dev/null
javac -d /tmp/rip $0
java -cp /tmp/rip Rip "$@"
exit
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.regex.Matcher;
@svenefftinge
svenefftinge / I18Processor.xtend
Created August 9, 2013 06:04
An annotation processor for localization using Java Resource Bundle
@Active(ExternalizedProcessor)
annotation Externalized {}
class ExternalizedProcessor extends AbstractClassProcessor implements CodeGenerationParticipant<ClassDeclaration> {
override doTransform(MutableClassDeclaration annotatedClass, extension TransformationContext context) {
for (field : annotatedClass.declaredFields) {
val initializer = field.initializerAsString
val msgFormat = try {
new MessageFormat(initializer)
@tleen
tleen / gist:f7b3e40c8b3ad976df05
Created September 22, 2014 22:33
Create empty gh-pages branch for GitHub Pages
git checkout --orphan gh-pages
Benchmark (arg) Mode Samples Score Error Units
o.s.MyBenchmark.baseline 1 avgt 50 5.346 ñ 0.033 ns/op
o.s.MyBenchmark.baseline 100 avgt 50 5.402 ñ 0.053 ns/op
o.s.MyBenchmark.baseline 10 avgt 50 5.409 ñ 0.067 ns/op
o.s.MyBenchmark.baseline 1000 avgt 50 5.409 ñ 0.057 ns/op
o.s.MyBenchmark.baseline 5 avgt 50 5.373 ñ 0.057 ns/op
o.s.MyBenchmark.mapTest 1 avgt 50 6.989 ñ 0.044 ns/op
o.s.MyBenchmark.mapTest 100 avgt 50 7.259 ñ 0.111 ns/op
o.s.MyBenchmark.mapTest 10 avgt 50 7.125 ñ 0.159 ns/op
o.s.MyBenchmark.mapTest 1000 avgt 50 7.674 ñ 0.048 ns/op
@paulirish
paulirish / what-forces-layout.md
Last active April 28, 2025 06:24
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@joepie91
joepie91 / vpn.md
Last active April 25, 2025 13:58
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@jamesmacwhite
jamesmacwhite / Workarounds for Netflix and the blocking of IPv6 tunnels.md
Last active April 29, 2025 09:07
Prevent proxy/VPN streaming error messages from Netflix when using a Hurricane Electric IPv6 tunnel.

Workarounds for Netflix and the blocking of Hurricane Electric IPv6 tunnels

The dreaded "You seem to be using an unblocker or proxy." error message. Cool story bro.

This gist was essentially created out of my own rant about Netflix being hostile to IPv6 tunnel services since June 2016. You are welcome to read my opinion on the matter, this is the more technical side to the issue and how to combat it within your own network.

Since I wrote this, various GitHub users have contributed their thoughts and ideas which has been incorporated into this gist. Thank you to everyone who have contributed their own methods and implementations.

The problem

Netflix now treats IPv6 tunnel brokers (such as Hurricane Electric) as proxy servers. A while ago it became apparent to users and Netflix that somewhat by accident, IPv6 tunnel users were being served content outside of their geolocation because of the way Netflix was identifyi