Skip to content

Instantly share code, notes, and snippets.

View Kr3m's full-sized avatar

Kevin Remisoski Kr3m

View GitHub Profile
@Kr3m
Kr3m / CGaz_StrafeHud.c
Created May 1, 2024 20:49 — forked from Jelvan1/CGaz_StrafeHud.c
Quake 3 DeFRaG 1.91.26 - CampingGaz-Hud (speedometer, accel bar, compass, cgaz)
#define M_PI 3.14159274101f
typedef struct
{
vec3_t prev_vel; // 0x0
float prev_width; // 0xc
int prev_commandTime; // 0x10
} accelBarState_t;
accelBarState_t accelBarState; // 0x2b0bb0
@Kr3m
Kr3m / pretty git history
Created January 25, 2023 10:18 — forked from ecasilla/pretty git history
git-hist
##
# Creates an alias called "git hist" that outputs a nicely formatted git log.
# Usage is just like "git log"
# Examples:
# git hist
# git hist -5
# git hist <branch_name>
# git hist <tag_name> -10
##
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short"
@Kr3m
Kr3m / rssToJson
Created June 25, 2019 01:27 — forked from BilalBudhani/rssToJson
PHP function to convert simple RSS to JSON
public function Parse ($url) {
$fileContents= file_get_contents($url);
$fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents);
$fileContents = trim(str_replace('"', "'", $fileContents));
$simpleXml = simplexml_load_string($fileContents);
$json = json_encode($simpleXml);
return $json;
}
@Kr3m
Kr3m / class.envato-api-basic.php
Created May 14, 2019 23:19 — forked from dtbaker/class.envato-api-basic.php
Simple PHP class for interacting with the Envato API within a WordPress plugin
<?php
/**
* Exception handling class.
*/
class EnvatoException extends Exception {
}
@Kr3m
Kr3m / README.md
Created May 14, 2019 19:16
HTML to PDF conversion in PHP using wkhtmltopdf (and optionally Smarty)

Recently I was asked to generate PDF invoices for an online shop. I looked at various PHP PDF generators, but wasn't particularly impressed with any of them.

Then I found (via Stack Overflow) a command-line HTML-to-PDF convertor called wkhtmltopdf, which uses WebKit (the same layout engine as Safari and Google Chrome) and therefore is very accurate.

There is a class for PHP integration on the Wiki, but I found it overly complicated and it uses temp files which aren't necessary. This is the code I wrote instead.

I used Smarty for generating the HTML for the PDF, but you can use any template engine, or pure PHP if you prefer.

Note: I originally tried to install wkhtmltopdf from source, but it's much easier to use the static binary instead.

@Kr3m
Kr3m / sublime_text_2_useful_shortcuts.md
Created July 2, 2016 06:26 — forked from nuxlli/sublime_text_2_useful_shortcuts.md
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@Kr3m
Kr3m / 0_reuse_code.js
Created April 9, 2014 12:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Kr3m
Kr3m / hosts.ps1
Created October 26, 2013 04:22 — forked from markembling/hosts.ps1
#
# Powershell script for adding/removing/showing entries to the hosts file.
#
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
#
$file = "C:\Windows\System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {