Skip to content

Instantly share code, notes, and snippets.

@pawitp
pawitp / main.c
Created October 21, 2012 01:44
UInput Event Injector (Inject Event into Android via kernel)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/input.h>
#include <linux/uinput.h>
#define die(str, args...) do { \
@pawitp
pawitp / server.php
Created April 6, 2014 06:21
Example for array/struct with nuSOAP
<?php
date_default_timezone_set('Asia/Bangkok');
require_once "lib/nusoap.php";
// Create SOAP Server
$server = new soap_server();
$server->configureWSDL("Test_Service", "http://www.example.com/test_service");
// Example "hello" function
function hello($username) {
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Random;
public class Buzhash32Chunking {
// If we use a multiple of 32, we get a lot of cancelling out
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class Md5Chunking {
private static MessageDigest md;
private static final int BLOCK_SIZE = 63;
@pawitp
pawitp / bootable_recovery.patch
Last active August 18, 2020 19:09
Compatibility patches for I9082 (CM12)
From b04637db515edbe6ab6006391e223b25712f7a8e Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <p.pawit@gmail.com>
Date: Tue, 27 Jan 2015 22:29:39 +0700
Subject: [PATCH] recovery: uncrypt: fix compatibility with CWM
CWM and other older recoveries do not support block map, so avoid
using it when possible
Change-Id: I49a04676ca5193db31c87418a5760727648745f0
---
From 5e101a379e79721f7be8203f47abd0509536eaae Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <p.pawit@gmail.com>
Date: Wed, 24 Apr 2013 14:55:05 +0700
Subject: [PATCH] Camera: antibanding setting
Some camera HALs do not support auto-antibanding and the user
needs to configure it to match their electricity frequency
Change-Id: Ie2022d78ad2fd293a6f39aacf7804fe21f7589d5
---
@pawitp
pawitp / super_num.patch
Created December 21, 2019 02:25
Patch to bring back Super+<Num> shortcut on Linux Mint 19.3. This is a partial revert of https://github.com/linuxmint/cinnamon/commit/94719c2cf1525f17b38bc7356d46d5b6bb5eab59
diff -ruw grouped-window-list@cinnamon.org.bak/appGroup.js grouped-window-list@cinnamon.org/appGroup.js
--- grouped-window-list@cinnamon.org.bak/appGroup.js 2019-12-12 18:46:55.000000000 +0700
+++ grouped-window-list@cinnamon.org/appGroup.js 2019-12-21 09:10:38.809467280 +0700
@@ -780,6 +780,33 @@
return false;
}
+ onAppKeyPress() {
+ if (this.groupState.isFavoriteApp && this.groupState.metaWindows.length === 0) {
+ this.launchNewInstance();
@pawitp
pawitp / memcached-$USER
Created November 28, 2015 06:12
CentOS's memcached init script, modified to support running socket-based user-specific instance
#! /bin/sh
#
# chkconfig: - 55 45
# description: The memcached daemon is a network memory cache service.
# processname: memcached
# pidfile: /var/run/memcached-$USER/memcached.pid
# Standard LSB functions
#. /lib/lsb/init-functions
From 1ad8b5f5d66937b50e38782170b00ef61404633e Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <p.pawit@gmail.com>
Date: Wed, 11 Dec 2013 20:47:31 +0700
Subject: [PATCH] chromium: disable HW rendering for capri
Change-Id: I16b2c14eb15a3efe4d84d603c132434a5f97530a
---
android_webview/browser/in_process_view_renderer.cc | 5 +++++
1 file changed, 5 insertions(+)
@pawitp
pawitp / gist:666208230ef8cd63d426dd80afbf0cc2
Last active June 22, 2019 14:13
Setup keyboard on Arch. Map <Win>+Left to Home, etc.
# This will map:
# <Win> + Left to Home
# <Win> + Right to End
# <Win> + Up to Page Up
# <Win> + Down to Page Down
# Modify /usr/share/X11/xkb/symbols/pc, replace the definition of <LEFT>, <RGHT>, <UP> and <DOWN>
key <LEFT> {
type[Group1]= "PC_SUPER_LEVEL2",
symbols[Group1]= [ Left, Home ]