Skip to content

Instantly share code, notes, and snippets.

View vittee's full-sized avatar

Wittawas Nakkasem vittee

  • LINE BK
  • Bangkok, Thailand
  • 05:31 (UTC +07:00)
View GitHub Profile
public class Test {
public static void main(String[] args) {
A a = new A(5);
System.out.println(a.a);
test(a);
System.out.println(a.a);
}
public static void test(A a) {
a.a = 3 ;
@vittee
vittee / svnserve.sh
Last active December 11, 2015 19:28 — forked from dexterbt1/svnserve.sh
svnserve, wrapper for svn daemon, tested with CentOS 6.3 edited to support custom installation prefix (default: /usr/local)
#!/bin/bash
#
# /etc/init.d/subversion
#
# Starts the Subversion Daemon
#
# chkconfig: 2345 90 10
# description: Subversion Daemon
@vittee
vittee / redis.sh
Created October 19, 2013 04:49
Redis init.d script for CentOS 5/6
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
@vittee
vittee / httpd
Created November 1, 2013 09:19
Apache 2.2 Init.d script for CentOS/RHEL
#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache2/logs/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf
@vittee
vittee / parser_phperror.rb
Last active May 6, 2020 10:06
Simple Fluentd Parser Plugin for parsing PHP Error.
# vim: ts=2
#
require 'fluent/parser'
module Fluent
class TextParser
class PhpErrorParser < Parser
Plugin.register_parser('phperror', self)
config_param :xdebug, :bool, :default => false
@vittee
vittee / thiscall_ptr.cpp
Created August 19, 2015 09:32
Calling C++ method using function pointer
#include "stdafx.h"
#include <stdlib.h>
class MyClass {
private:
int val = 0;
public:
MyClass(int i) {
val = i;
typedef int(__thiscall *gameui_runcmd)(void* _this, char *cmd);
void runSettings() {
HMODULE gameui = GetModuleHandle("GameUI.dll");
gameui_runcmd runcmd_func = (gameui_runcmd) ((uintptr_t) gameui + 0x2D1E0);
void *gameui_instance = (void*) ((uintptr_t)gameui + 0xC5184);
//
runcmd_func(gameui_instance, "OpenOptionsDialog");
}
@vittee
vittee / GameUI.h
Last active August 29, 2015 14:27
#pragma once
#include <system_error>
#include <Windows.h>
namespace GameUI {
typedef int(__thiscall *noarg_meth_t)(void*);
typedef int(__thiscall *onearg_meth_t)(void*, void*);
class TaskBar
// struct for pin
typedef struct {
uint8 pin;
uint8 state;
long lastUpdated;
long interval;
} pin_info_t;
// initialize pin info
pin_info_t pin9 = {9, LOW, 0, 1000};
@vittee
vittee / JitCore.c
Created July 21, 2016 09:47
miasm2 modification for compiling with mingw32 on Windows
// Remove the weak linkage
PyObject* /*__attribute__((weak))*/ vm_get_mem(JitCpu *self, PyObject* args)