Skip to content

Instantly share code, notes, and snippets.

View mislavjakopovic's full-sized avatar

Mislav Jakopović mislavjakopovic

View GitHub Profile
#include "stdafx.h"
void __fastcall Hotpatch(void* pOFunc, void* pHkFunc)
{
DWORD dwOldProt = 0;
BYTE bPatch[5];
bPatch[0] = 0xE9;
VirtualProtect((void*)pOFunc, 5, PAGE_EXECUTE_READWRITE, &dwOldProt);
DWORD dwRelativeAddr = ((DWORD)pHkFunc - (DWORD)pOFunc - 5);
memcpy(&bPatch[1], &dwRelativeAddr, 4);
@mislavjakopovic
mislavjakopovic / php.ini
Created November 10, 2020 01:26
php.ini
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
ipconfig /flushdns
pause
REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowSuperHidden | Find "0x0"
IF %ERRORLEVEL% == 1 goto turnoff
If %ERRORLEVEL% == 0 goto turnon
goto end
:turnon
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowSuperHidden /t REG_DWORD /d 1 /f
goto end
:turnoff
function virtualenv_info {
[[ -n "$VIRTUAL_ENV" ]] && echo '('${VIRTUAL_ENV:t}') '
}
function ruby_prompt {
if (( $+commands[rvm-prompt] )); then
print -n $ZSH_THEME_RUBY_PROMPT_PREFIX
print -n $(~/.rvm/bin/rvm-prompt)
print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX
elif (( $+commands[rbenv] )); then
@mislavjakopovic
mislavjakopovic / worst_function_ever.php
Created May 19, 2017 21:16
how not to do your projects
public function actionExport()
{
//get all the rooms
$rooms = Room::model()->findAll(array('order'=>'orderby'));
foreach ($rooms as $r) {
$rslug = $r->slug;
$$rslug = <<<HTMLComposeMessage
<?xml version="1.0" encoding="UTF-8"?>
<panorama id="node1">