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 / 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 / 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 / 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 / .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 / 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 / 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 / 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 / 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 / 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 / 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) {