Skip to content

Instantly share code, notes, and snippets.

package com.gypsyengineer.tlsbunny.jsse;
import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/*
* Don't forget to set the following system properties when you run the class:
@denim2x
denim2x / HttpConstants.java
Last active May 26, 2020 12:24
Basic Java WebServer implementation (https://cutt.ly/4ySoqUI)
interface HttpConstants {
/** 2XX: generally "OK" */
public static final int HTTP_OK = 200;
public static final int HTTP_CREATED = 201;
public static final int HTTP_ACCEPTED = 202;
public static final int HTTP_NOT_AUTHORITATIVE = 203;
public static final int HTTP_NO_CONTENT = 204;
public static final int HTTP_RESET = 205;
public static final int HTTP_PARTIAL = 206;
@denim2x
denim2x / AEIOU and Sometimes Y.js
Last active September 5, 2019 18:36
JavaScript code golfing
/**
* Given a string, print the count of vowels in it.
* To add a minor complication, y should be counted as half (0.5) a vowel.
*/
const Vowel = new Set('aeiou'), array = Array.from(input.toLowerCase());
let y = 0;
const vowels = array.filter((c) => {
y += (c == 'y');
return Vowel.has(c)
@denim2x
denim2x / masonry.css
Last active September 8, 2023 21:31
Pure-CSS Masonry (grid layout)
/**
@author denim2x <denim2x@cyberdude.com>
@license MIT
Pure-CSS Masonry layout, implemented via grid (http://mdn.io/grid);
all items are being nicely stacked vertically - thanks to
`grid-auto-rows` and `grid-row: span ...`.
SUIT CSS compliant implementation.
*/
@denim2x
denim2x / Set-BlueLight.ps1
Created June 13, 2018 08:10
PowerShell cmdlet for setting Night Light on WIndows 10
Function Set-BlueLight {
[CmdletBinding()]
Param (
[Parameter(Mandatory=$true)] [ValidateRange(0, 23)] [int]$StartHour,
[Parameter(Mandatory=$true)] [ValidateSet(0, 15, 30, 45)] [int]$StartMinutes,
[Parameter(Mandatory=$true)] [ValidateRange(0, 23)] [int]$EndHour,
[Parameter(Mandatory=$true)] [ValidateSet(0, 15, 30, 45)] [int]$EndMinutes,
[Parameter(Mandatory=$true)] [bool]$Enabled,
[Parameter(Mandatory=$true)] [ValidateRange(1200, 6500)] [int]$NightColorTemperature
)
@denim2x
denim2x / index.html
Created February 27, 2018 11:49
Web demo #1
<!DOCTYPE html>
<html lang="en">
<head>
<title> Demo </title>
<meta charset="UTF-8">
<style>
.slider img {
display: inline-block;
}
.slider {