Skip to content

Instantly share code, notes, and snippets.

View hinzundcode's full-sized avatar

Chris hinzundcode

View GitHub Profile
a52dec 0.7.4-9
aalib 1.4rc5-12
acl 2.2.52-2
alsa-firmware 1.0.29-1
alsa-lib 1.1.1-1
alsa-plugins 1.1.1-1
alsa-utils 1.1.1-1
alsaplayer 0.99.81-8
attr 2.4.47-1
autoconf 2.69-3
//
// AppDelegate.swift
// Test3
//
// Created by Chris Hinze on 28.05.15.
// Copyright (c) 2015 Chris Hinze. All rights reserved.
//
import Cocoa
"use strict";
const ffi = require("ffi");
const ref = require("ref");
const ArrayType = require("ref-array");
let StringArray = ArrayType("string");
let voidPtr = ref.refType(ref.types.void);
let stdlib = ffi.Library(null, {
"fork": ["int", []],
"use strict";
const ffi = require("ffi");
const ref = require("ref");
const ArrayType = require("ref-array");
const { createReadStream, createWriteStream, readSync, writeSync, closeSync } = require("fs");
let IntArray = ArrayType("int");
let StringArray = ArrayType("string");
let voidPtr = ref.refType(ref.types.void);
@hinzundcode
hinzundcode / leet.php
Created July 9, 2011 11:26
Leetspeak Generator
<?php
header('Content-type: text/plain; charset=utf8');
$input = "hab me eben nen leet-speak generator geschrieben..";
$words = array(
'one' => 1,
'to' => 2,
'too' => 2,
@hinzundcode
hinzundcode / StringView.js
Created May 5, 2018 20:22
read and write strings from arraybuffers
function strlen(buffer, byteOffset, byteLength) {
let array = new Uint8Array(buffer, byteOffset, byteLength);
for (let i = 0; i < array.length; i++) {
if (array[i] == 0)
return i;
}
throw new Error("invalid string: not ending with null byte");
}
@hinzundcode
hinzundcode / clock.js
Created October 3, 2018 18:43
puck js clock
function update() {
var now = new Date();
var minutes = now.getMinutes();
if (minutes < 10)
minutes = "0"+minutes;
var seconds = now.getSeconds();
if (seconds < 10)
seconds = "0"+seconds;
var time = now.getHours()+":"+minutes+":"+seconds;
@hinzundcode
hinzundcode / gist:2ca9b9a425b8ed0d9ec4
Created May 29, 2015 14:00
NSImage to base64 encoded data url
var path: NSString = NSWorkspace.sharedWorkspace().absolutePathForAppBundleWithIdentifier("com.apple.dt.xcode")!
var icon: NSImage = NSWorkspace.sharedWorkspace().iconForFile(path)
var data: NSData = icon.TIFFRepresentation!
var bitmap: NSBitmapImageRep = NSBitmapImageRep(data: data)!
data = bitmap.representationUsingType(NSBitmapImageFileType.NSPNGFileType, properties: [:])!
var base64: NSString = "data:image/png;base64," + data.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.allZeros)
println(base64)
"use strict";
const { Transform } = require("stream");
function createStreamPair() {
let config = {
objectMode: true,
transform(chunk, encoding, callback) {
this.other.push(chunk);
callback();
<!DOCTYPE html>
<canvas id="canvas" style="width: 200px; height: 200px; border: 1px solid #000;" width=200 height=200></canvas>
<script type="module">
const circle = (mx, my, r) => (x, y) => Math.pow(x - mx, 2) + Math.pow(y - my, 2) < Math.pow(r, 2);
let canvas = document.getElementById("canvas");
let context = canvas.getContext("2d");
let drawables = [
{