Skip to content

Instantly share code, notes, and snippets.

@Cacodaimon
Cacodaimon / gist:b2426e0d73eaa916c54a362adebaf0c5
Created June 27, 2025 13:14
OpenAI OpenAPI YAML fixed for building a Java client
This file has been truncated, but you can view the full file.
openapi: 3.0.0
info:
title: OpenAI API
description: The OpenAI REST API. Please see
https://platform.openai.com/docs/api-reference for more details.
version: 2.3.0
termsOfService: https://openai.com/policies/terms-of-use
contact:
name: OpenAI Support
url: https://help.openai.com/
@Cacodaimon
Cacodaimon / client.js
Created October 22, 2012 17:55
WebSocket nodejs server & client tutorial used @ cacodaemon.de
module.exports.Client = function (name, socket) {
this.name = name
this.socket = socket
this.send = function (msg) {
this.socket.send(msg)
}
this.toString = function (msg) {
return this.name
@Cacodaimon
Cacodaimon / SumByKey.js
Created November 4, 2013 21:12
A simple AngularJS filter for summarizing the values of an array containing objects by a key.
angular.module('caco.feed.filter', [])
.filter('sumByKey', function() {
return function(data, key) {
if (typeof(data) === 'undefined' || typeof(key) === 'undefined') {
return 0;
}
var sum = 0;
for (var i = data.length - 1; i >= 0; i--) {
sum += parseInt(data[i][key]);
@Cacodaimon
Cacodaimon / .bashrc
Last active December 7, 2020 22:33
A powerline inspired bashrc
#!/bin/bash
[ -z "$PS1" ] && return
# ~/.local/share/fonts/
# https://github.com/powerline/fonts
color_black_black='\[\e[0;30m\]'
color_black_red='\[\e[0;31m\]'
color_black_green='\[\e[0;32m\]'
@Cacodaimon
Cacodaimon / Markdown-Cheatsheet.md
Last active September 25, 2020 02:10
PHP simple markdown parser performance test
@Cacodaimon
Cacodaimon / GameManager.js
Created December 3, 2012 00:54
Abstract game object class. (Used @ cacodaemon.de)
/*
* Simple JavaScript game manager.
*
* (c) 2012 Guido Krömer <mail@cacodaemon.de>
*
*/
function GameManager () {
var canvas = null;
var ctx = null;
var delta = 0;
@Cacodaimon
Cacodaimon / GameManager.js
Last active November 13, 2018 23:04
JavaScript Canvas textured raycaster, used @ cacodaemon.de.
/*
* Simple JavaScript game manager.
*
* By Guido Krömer <mail@cacodaemon.de> 2013
*
*/
function GameManager () {
var canvas = null;
var ctx = null;
var delta = 0;
@Cacodaimon
Cacodaimon / index.html
Created July 23, 2013 11:31
Quick and dirty Google Feed API example, fetching the first image of each feed item.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Google Feed API JSONP Example displaying some Images - wwww.cacodaemon.de</title>
<script type="text/javascript">
function processResults (response) {
var entries = response.responseData.feed.entries;
var images = document.getElementById('images');
"use strict";
var User = require('./User.js').User;
var Message = require('./Message.js').Message;
var PrivateMessage = require('./Message.js').PrivateMessage;
var Command = require('./Message.js').Command;
var SessionHandler = require('./SessionHandler.js').SessionHandler;
module.exports.ChatServer = function (port, debug) {
var http = require('http');
var qs = require('querystring');
@Cacodaimon
Cacodaimon / Session.js
Created November 11, 2012 14:59
Node.js Session handling, used @ cacodaemon.de
module.exports.Session = function () {
var getRandom = function () {
return Math.floor(Math.random() * 1e16).toString(36);
}
this.sessionId = getRandom() + '-' + new Date().getTime().toString(36) + '-' + getRandom();
this.doDestroy = false;
this.toString = function () {
return this.sessionId;