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 / 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 / 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 + '';
@erfg12
erfg12 / chat_server.js
Last active February 26, 2019 16:47
NodeJS chat server with commands and null terminator.
var net = require('net');
var PORT = 13000;
var clients = [];
net.createServer(function(sock) {
console.log('CONNECTED: ' + sock.remoteAddress +':'+ sock.remotePort);
sock.name = "";
clients.push(sock);
@erfg12
erfg12 / matrix_chart_csv.php
Last active April 9, 2019 17:59
Cross reference a CSV (excel) file (column by row) for a value
<?PHP
// Get value from matrix chart. H = first column going down, W = first row across
function getValueFromCSV($h, $w) {
$v = 0;
$k = 0;
$row = 0;
if (($handle = fopen("test.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 100, ",")) !== FALSE) {
$key = array_search($w, $data, true);
if ($key != null && $row == 0)
@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 / tutorial.md
Last active September 27, 2019 20:13
Download waybackmachine.org Websites

Method 1

  1. Get wayback machine proxy software - https://github.com/STRML/wayback-machine-machine

  2. Configure proxy software, and setup proxy on your OS. Run proxy software.

  3. If using Windows, get WGet software - https://eternallybored.org/misc/wget/

  4. Open a command/terminal window in the directory you want to download the site to, use this command:

    wget -r -np -e use_proxy=yes -e http_proxy=127.0.0.1:4080 -k http://www.mywaybackmachinewebsite.com

NOTE: If you want, visit the website first to make sure it's exactly what you want prior to download. WGet will download whatever your browser sees.

@ECHO OFF
REM This is for GIMX cable and ULTRAGRID video stream
SET GIMX_PATH=C:\Program Files\GIMX
SET ULTRAGRID_PATH=C:\Users\jake\Desktop\UltraGrid
SET HOST_IP=192.168.0.0
SET GIMX_USBPORT=COM3
SET HDMI_INPUT=idk
SET GIMX_CONF=X360Pad