Skip to content

Instantly share code, notes, and snippets.

@AVGP
AVGP / wat.js
Created September 6, 2017 22:17
ffmpeg.js converting webm from a media recorder into mp4
var ffmpeg = require('ffmpeg.js/ffmpeg-mp4.js')
document.querySelector('button').addEventListener('click', (evt) => {
document.querySelector('[camera]').setAttribute('animation', {
property: 'rotation',
to: '0 360 0',
dur: 10000,
easing: 'linear'
})
@AVGP
AVGP / json-ldfy.php
Last active December 20, 2023 13:20
A barebones WP plugin to add JSON-LD based on post data automatically. It won't really work, but it's a starting point for exploration.
<?php
/*
Plugin Name: JSON-LDfy
Plugin URI: https://www.google.com
Description: Add JSON-LD based on some post data
Version: 1.0
Author: Martin Splitt
Author URI: https://www.google.com
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@AVGP
AVGP / make-animated-gif.js
Last active August 9, 2023 00:18
Uses three.js, three-software-renderer & omggif to render an animated GIF from a Three.js Scene on the server with node.js
var fs = require('fs'),
omggif = require('omggif'),
THREE = require('three'),
SoftwareRenderer = require('three-software-renderer');
// How many frames and how large shall the GIF be?
var NUM_FRAMES = 200, WIDTH = 500, HEIGHT = 500;
// Our scene, camera and renderer and a box to render
var scene = new THREE.Scene(),

A primer on x86 assembly with GNU assembler

When it comes to assembly language, it isn't as hard as many people think. Fundamentally, you write short, human-readable commands for the processor to execute (your assembly code) and then use a tool (the actual assembler) to translate your code into machine-readable binary instructions. Unlike high-level languages, assembly language is very simple and doesn't have that many features. The difficulty is to deal with memory and build more complex flows (e.g. loops or I/O) from the simple primitives that the assembly language gives you.

Registers and instructions

CPUs usually have small, very fast storage available for the data that is used in its instructions. This kind of storage is much smaller but also much faster than the RAM and is called registers. An x86 processor has a bunch of them to store generic data, manage the stack, keep track of the current instruction and other administrative inform

char shellcode[] = "INSERT SHELLCODE HERE!";
int main(int argc,char argv)
{
int (*f)();
f = (int (*)())shellcode;
(int)(*f)();
}
[SECTION .text]
global _start
_start:
jmp short getData
execIt:
pop ebx ;Get the string off stack
xor eax,eax ;Clear eax
mov [ebx+8],al ;This helps us to avoid having a zero byte in our code.
;It sets the terminator to the string.
push eax ;Second argument for WinExec
<style>
body
{
min-width:300px;
overflow-x:hidden;
}
p
{
border:#ddd thin solid;
background-color:#eee;
@AVGP
AVGP / WebShell echo.php
Created March 12, 2011 15:02
The echo-App for the JS-Webshell
<?php
class echoApplication extends App
{
function run()
{
parent::run();
$data = $this->params;
$this->outputResults($data,$_GET['environment']);
}
}
@AVGP
AVGP / webcamtexture-script.js
Created February 1, 2015 16:13
Three.js livecoding arena - WebcamTexture
// Setup your scene here
var tex = null;
var mat = new THREE.MeshBasicMaterial({});
var box = new THREE.Mesh(
new THREE.BoxGeometry(100, 100, 100),
mat
);
window.THREE = THREE;
var script = document.createElement("script");
@AVGP
AVGP / my-element.html
Last active May 4, 2023 14:05
A simple web component boilerplate
<template>
<style>
</style>
</template>
<script>
var Element = null;
(function(currentScript) {
var elemPrototype = Object.create(HTMLDivElement.prototype); // pick the appropriate prototype for your element!