Skip to content

Instantly share code, notes, and snippets.

View erfg12's full-sized avatar
🏠
Working from home

Jacob Fliss erfg12

🏠
Working from home
View GitHub Profile
@erfg12
erfg12 / obj_ball.gmx
Created May 9, 2018 20:48
GameMaker 1.4 Flip X Y Coordinates
// If you're trying to give X Y coordinates over a network and you need to flip them on the client side, here's how it can be done.
// global.bx = server sending ball X coordinate
// global.by = server sending ball Y coordinate
// This code should be placed in your ball object's step.
//show_debug_message("[DEBUG|BALL|REAL] bx:" + string(global.by) + " by:" + string(global.by) + " w/2:" + string(room_width/2) + " h/2:" + string(room_height/2));
//build a fake grid
fakex = global.bx - (room_width/2);
fakey = global.by - (room_height/2);
@erfg12
erfg12 / bunnycdn_api.js
Last active March 28, 2024 16:44
BunnyCDN API PUT for NodeJS. Use startUploading function to start the uploading process of all files in a directory.
var request = require('request');
var fs = require('fs');
function uploadItem(item) {
console.log('uploading ' + item);
request({
method: 'PUT',
preambleCRLF: true,
postambleCRLF: true,
uri: 'https://storage.bunnycdn.com/newagetest//path/filename',
@erfg12
erfg12 / app.js
Last active June 24, 2019 19:29
Run this script with a file argument to convert. Ex: convert.js myFile.avi
var ffmpeg = require('fluent-ffmpeg');
// convert to small streamable MP4
ffmpeg(process.argv[2], { timeout: 432000 }).addOptions([
'-c:v libx264',
'-pix_fmt yuv420p',
'-movflags faststart'
]).output(process.argv[2] + '.mp4')
.on('progress', function(progress) {
@erfg12
erfg12 / C# Windows Firewall
Last active November 26, 2020 20:48
Block all connections in Windows firewall, except some IP addresses during work hours. For Windows Vista, 7, 8 and 10.
private static INetFwPolicy2 getCurrPolicy()
{
INetFwPolicy2 fwPolicy2;
Type tNetFwPolicy2 = Type.GetTypeFromProgID("HNetCfg.FwPolicy2");
fwPolicy2 = (INetFwPolicy2)Activator.CreateInstance(tNetFwPolicy2);
return fwPolicy2;
}
INetFwPolicy2 fwPolicy2 = getCurrPolicy();
@erfg12
erfg12 / SelectVideo.xaml.cs
Last active September 5, 2018 15:53
Xamarin C# convert string to UriVideoSource
// need to use https://developer.xamarin.com/samples/xamarin-forms/CustomRenderers/VideoPlayerDemos/ FormsVideoLibrary class
// the function ConvertFromInvariantString is built in to this library class.
VideoSourceConverter p = new VideoSourceConverter();
UriVideoSource test = (UriVideoSource)p.ConvertFromInvariantString("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4");
videoPlayer.Source = test;
@erfg12
erfg12 / client.c
Last active October 2, 2018 18:59
TCP client C
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#ifdef _WIN32
#include <winsock2.h>
#include "windows.h"
#endif
@erfg12
erfg12 / igdb_search.php
Last active October 10, 2018 16:41
IGDB.com PHP API search for game ID by name
<?PHP
$key = 'IGDB_API_KEY_HERE'; //your IGDB api key goes here
if (isset($_POST['game'])) {
header('Content-Type: application/json; charset=utf-8');
$json_url = 'https://api-endpoint.igdb.com/games/?search='.urlencode($_POST['game']).'&fields=name';
$ch = curl_init( $json_url );
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('user-key:'.$key, 'Accept: application/json')
@erfg12
erfg12 / fix.md
Last active December 3, 2023 23:14
PCSX2 Snowblind games fix (v1.5.0-dev-2640+)

Games list

  • Champions of Norrath (both games)
  • Baldur's Gate: Dark Alliance

Make game run at consistent frame rate

  • Plugin/Bios Selector > GPU > (select) GSdx * SSE4
  • Video (GS) > Plugin Settings... > (tick) Enable HW Hacks
  • Video (GS) > Plugin Settings... > Advanced Settings and Hacks > (tick) Fast Texture Invalidation
  • Video (GS) > Plugin Settings... > Advanced Settings and Hacks > Skipdraw Range > 1 - 4 (only for underpowered PCs)
@erfg12
erfg12 / .cpanel.yml
Last active January 11, 2022 20:53
cpanel git commit to public_html
---
deployment:
tasks:
- export DEPLOYPATH=/home/ACCOUNT/public_html/
- /bin/cp -u -r * $DEPLOYPATH
- /bin/cp .htaccess $DEPLOYPATH
@erfg12
erfg12 / tcp_server.js
Last active February 25, 2019 18:24
NodeJS script for a simple TCP server
var net = require('net');
var PORT = 6969;
net.createServer(function(sock) {
console.log('CONNECTED: ' + sock.remoteAddress +':'+ sock.remotePort);
sock.on('data', function(data) {
//console.log('RAW DATA RCVD: ' + sock.remoteAddress + ': ' + data);
var readData = data + '';