Skip to content

Instantly share code, notes, and snippets.

View machinaeXphilip's full-sized avatar
🦕

machinaeXphilip machinaeXphilip

🦕
  • Berlin, Germany
View GitHub Profile
@Overemployed
Overemployed / jiggler.mjs
Last active January 27, 2023 18:51
PIKVM mouse jiggler
// assumes your mouse is in relative mode https://docs.pikvm.org/mouse/?h=relative#relative-mouse-on-v2-platform-otg-hid
// You may want to set your pikvm to support dual mode, so you can switch between absolute and relative
const { PIKVM_HOST, PIKVM_USER, PIKVM_PASSWORD, MOUSE_MODE = 'normal' } = process.env
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
import fetch from 'node-fetch';
import { path } from "ghost-cursor";
import websocket from 'websocket';
const WebSocketClient = websocket.client
let connection;
@FreyaHolmer
FreyaHolmer / SceneViewZAlign.cs
Last active February 28, 2025 03:26
Allows the scene view camera to use Z up/down (be sure to place this script in an Editor/ folder)
// Allows you to change the up vector in the scene view to the Z axis.
// Y-up mode uses Unity's default implementation.
//
// Original code from Akulist on the Unity forums, modified by Freya Holmér:
// • Fixed orbit+RMB zoom not working
// • Toggling will now align the camera immediately to the new up vector
// • When the camera is upside down in Z axis mode, left/right orbit will no longer be mirrored (pls fix this too Unity~)
// • Moved toggle buttons to under the gizmo
// • Fixed broken rotation state when focusing a different window in Unity and coming back to the scene view
//
@davej
davej / fetch-timeout.js
Last active July 1, 2022 23:35
Add a pseudo timeout/deadline to a request using the ES6 fetch api
Promise.race([
fetch('/foo'),
new Promise((_, reject) =>
setTimeout(() => reject(new Error('Timeout')), 7000)
)
]);
@dcollien
dcollien / ImageTools.es6
Last active July 3, 2025 21:23
Resize Images in the Browser
let hasBlobConstructor = typeof(Blob) !== 'undefined' && (function () {
try {
return Boolean(new Blob());
} catch (e) {
return false;
}
}());
let hasArrayBufferViewSupport = hasBlobConstructor && typeof(Uint8Array) !== 'undefined' && (function () {
try {
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@valentinkostadinov
valentinkostadinov / hex.js
Created June 27, 2013 10:29
JavaScript HEX encoding
function toHex(s) {
// utf8 to latin1
var s = unescape(encodeURIComponent(s))
var h = ''
for (var i = 0; i < s.length; i++) {
h += s.charCodeAt(i).toString(16)
}
return h
}