Skip to content

Instantly share code, notes, and snippets.

View hakur's full-sized avatar
😂

Xing Yu hakur

😂
  • Chengdu ,Sichuan , China
View GitHub Profile
@revolunet
revolunet / lzw_encoder.js
Created February 25, 2011 14:55
LZW javascript compress/decompress
// LZW-compress a string
function lzw_encode(s) {
var dict = {};
var data = (s + "").split("");
var out = [];
var currChar;
var phrase = data[0];
var code = 256;
for (var i=1; i<data.length; i++) {
currChar=data[i];
@jedy
jedy / go_scp.go
Last active May 31, 2022 07:20
an example of scp in golang
// https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works
package main
import (
"fmt"
"golang.org/x/crypto/ssh"
)
const privateKey = `content of id_rsa`
@JISyed
JISyed / MoveCamera.cs
Last active August 26, 2024 05:45
Camera movement script in Unity3D. Supports rotating, panning, and zooming. Attach to the main camera. Tutorial explaining code: http://jibransyed.wordpress.com/2013/02/22/rotating-panning-and-zooming-a-camera-in-unity/
// Credit to damien_oconnell from http://forum.unity3d.com/threads/39513-Click-drag-camera-movement
// for using the mouse displacement for calculating the amount of camera movement and panning code.
using UnityEngine;
using System.Collections;
public class MoveCamera : MonoBehaviour
{
//
// VARIABLES
@christopher-hopper
christopher-hopper / find-windows-process-listening-on-port.md
Last active October 8, 2018 18:34
Find Windows processes listening on a port

Windows processes listening on a port

These examples assume you are using Windows 7 and have Cygwin installed with the awk package.

This single command will identify the process listening on port "2222" by feeding netstat output into tasklist using gawk.

netstat -aon | gawk ' $2~/:2222/ { system("tasklist /svc /FI \"PID eq " $5 "\"") } '
<?php
/**
* Batch Mockup
*
* I placed this in my BaseController.php file
*
* @usage
* $batch = new Batch('stats');
* $batch->columns = ['score', 'name'];
* $batch->data = [
@defektive
defektive / gist:b5c543a4b5ad3f7b4a1b
Created May 26, 2014 03:40
Character Controller for unity
using UnityEngine;
using System.Collections;
public class ControllerScript : MonoBehaviour {
CharacterController controller;
public float speed = 5.0f;
public float jumpSpeed = 8.0f;
public float pushPower = 3.0f;
@GibTreaty
GibTreaty / Joystick.cs
Last active July 17, 2017 02:27
Jostick
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
anonymous
anonymous / wanxue
Created February 11, 2015 06:28
xoxoxo wanxue
<div id="cc_video_<?php echo $_GET['vid']; ?>_2062507" class="video-container">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="720" height="520" id="cc_<?php echo $_GET['vid']; ?>">
<param name="movie" value="./player.swf?vid=<?php echo $_GET['vid']; ?>&amp;siteid=C19E12B3564FE2AD&amp;playerid=C308B2C7A78B53E9&amp;playertype=1&amp;autoStart=false">
<param value="transparent" name="wmode">
<param name="allowFullScreen" value="true">
<param name="allowScriptAccess" value="always">
<embed src="./player.swf?vid=<?php echo $_GET['vid']; ?>&amp;siteid=C19E12B3564FE2AD&amp;playerid=C308B2C7A78B53E9&amp;playertype=1&amp;autoStart=false" width="720" height="520" name="cc_<?php echo $_GET['vid']; ?>" wmode="transparent" allowfullscreen="true" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
public class EventTriggerListener : UnityEngine.EventSystems.EventTrigger{
public delegate void VoidDelegate (GameObject go);
public delegate void VoidDelegateData (GameObject go, PointerEventData eventData);
public VoidDelegate onClick;
public VoidDelegate onDown;
public VoidDelegate onEnter;
public VoidDelegate onExit;