Skip to content

Instantly share code, notes, and snippets.

@bmaupin
bmaupin / install-openjdk-6-ubuntu-16.sh
Last active December 22, 2023 12:11
Install openjdk-6-jdk on Ubuntu/Xubuntu 16.04
# NOTE: This is a hack and will downgrade the tzdata package.
# Better alternatives:
# - Use Azul Zulu build of OpenJDK 6 (https://www.azul.com/downloads/zulu/zulu-linux/ - make sure you enable the box labeled Older Zulu versions)
# - Install Java 6 directly from Oracle and install it manually (https://gist.github.com/bmaupin/16855ce1b2484c459f41ad836a7d3f2f)
wget http://launchpadlibrarian.net/235298493/openjdk-6-jdk_6b38-1.13.10-1_amd64.deb
wget http://launchpadlibrarian.net/235298496/openjdk-6-jre_6b38-1.13.10-1_amd64.deb
wget http://launchpadlibrarian.net/235298494/openjdk-6-jre-headless_6b38-1.13.10-1_amd64.deb
wget http://launchpadlibrarian.net/235298487/openjdk-6-jre-lib_6b38-1.13.10-1_all.deb
wget http://launchpadlibrarian.net/250277191/tzdata_2016c-0ubuntu1_all.deb
@mdonkers
mdonkers / server.py
Last active April 4, 2025 13:11
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@jimmywarting
jimmywarting / readme.md
Last active April 29, 2025 08:29
Cors proxies
Exposed headers
Service SSL status Response Type Allowed methods Allowed headers
@fabiocolacio
fabiocolacio / sdl-joystick-polling.c
Created December 15, 2017 02:37
A demonstration of using SDL2 to poll the state of buttons and axes on a joystick
#include <SDL2/SDL.h>
// This program shows how to work with joysticks using SDL2.
// This example shows how to do it by manually polling the joystick
// rather than using the sdl event queue.
int main() {
// Initialize the joystick subsystem
SDL_Init(SDL_INIT_JOYSTICK);
// If there are no joysticks connected, quit the program
@mix3d
mix3d / recursiveDeepCopy.js
Created August 8, 2018 21:18
Most Performant JS DeepCopy
// from https://jsperf.com/deep-copy-vs-json-stringify-json-parse/5
function recursiveDeepCopy(o) {
var newO, i;
if (typeof o !== 'object') {
return o;
}
if (!o) {
return o;
/*
* cloudflare's email-decode.js
*
* (manually) "decrypted" by antipatico (github.com/antipatico)
*
* All Wrongs Reversed (Ↄ), 2018
*/
! function() {
"use strict";
@paulgregg
paulgregg / README.md
Last active April 22, 2025 03:02
Converting a gitlab export to simple git repo

Converting a gitlab export to simple git repo

Gitlab exports a tar.gz file which contains a file called project.bundle. We can convert this file into a normal git repo using the following steps:

Extract the project.bundle file

$ tar xvfz GitLabExport.gz
/**
* Export all data from an IndexedDB database
*
* @param {IDBDatabase} idbDatabase The database to export from
* @return {Promise<string>}
*/
export function exportToJson(idbDatabase) {
return new Promise((resolve, reject) => {
const exportObject = {}
if (idbDatabase.objectStoreNames.length === 0) {
@RobinCPC
RobinCPC / wine_setup.md
Last active January 13, 2025 01:31
Wine Setup

Install Wine with Mono & Gecko in Ubuntu 20.04

Warning: Do not try those command in your main PC, I test in a virtual Machine

Note: Most of commands are from the Dockerfile in Reference section. If you want to test wine, just run their docker container

1. Setup PPA

sudo dpkg --add-architecture i386
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo tee /etc/apt/trusted.gpg.d/winehq.asc
@GlauberF
GlauberF / KeyEventSimulator.js
Created April 29, 2020 10:28
A function for simulating key event in JavaScript. You just have to choose what key and keyboard event you want to simulate.
/**
* Simulate a key event.
* @param {Number} keyCode The keyCode of the key to simulate
* @param {String} type (optional) The type of event : down, up or press. The default is down
* @param {Object} modifiers (optional) An object which contains modifiers keys { ctrlKey: true, altKey: false, ...}
*/
function simulateKey (keyCode, type, modifiers) {
var evtName = (typeof(type) === "string") ? "key" + type : "keydown";
var modifier = (typeof(modifiers) === "object") ? modifier : {};