This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The biggest 64bit prime | |
| #define P 0xffffffffffffffc5ull | |
| #define G 5 | |
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <assert.h> | |
| #include <stdlib.h> | |
| // calc a * b % p , avoid 64bit overflow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local cjson = require('cjson') | |
| local util = require('login_util') | |
| if ngx.var.request_method ~= 'POST' then | |
| ngx.log(ngx.WARN, 'request method is not post') | |
| ngx.exit(400) | |
| end | |
| ngx.req.read_body() | |
| local args = ngx.req.get_post_args() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Over time, I collected some options to make Firefox really fast. | |
| WARNING! NO WARRANTY, use on your own risk! | |
| If you know what you're doing, go to 'about:config' and edit the listed values accordingly. | |
| Hint: Double-click boolean values to toggle true/false. | |
| ########################### | |
| If mouse-wheel scrolling is slow, try |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright (c) 2013 Calvin Rien | |
| * | |
| * Based on the JSON parser by Patrick van Bergen | |
| * http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html | |
| * | |
| * Simplified it so that it doesn't throw exceptions | |
| * and can be used in Unity iPhone with maximum code stripping. | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function hex_dump (str) | |
| local len = string.len( str ) | |
| local dump = "" | |
| local hex = "" | |
| local asc = "" | |
| for i = 1, len do | |
| if 1 == i % 8 then | |
| dump = dump .. hex .. asc .. "\n" | |
| hex = string.format( "%04x: ", i - 1 ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Shader "Diffuse Lightmap" { | |
| Properties { | |
| _MainTex ("Texture 1", 2D) = "white" {} | |
| } | |
| SubShader { | |
| Tags { "RenderType" = "Opaque" } | |
| Pass { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '''Zookeeper-based Scheduler''' | |
| ## Standard Library | |
| import cPickle # Store dictionary in ZooKeeper | |
| import datetime # Time delta | |
| import socket # Hostname | |
| ## Third Party | |
| import celery # Current app | |
| import celery.beat # Scheduler | |
| import celery.utils.log # Get logger | |
| import kazoo.client # ZooKeeper Client Library |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from apscheduler.scheduler import Scheduler | |
| import datetime as dt | |
| sched = Scheduler() | |
| sched.start() | |
| def timeout(job_fn, *fn_args, **delta_args): | |
| """Like setTimeout in javascript; returns a job object | |
| First argument is the function to be called. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| public static class ConfigurableJointExtensions { | |
| /// <summary> | |
| /// Sets a joint's targetRotation to match a given local rotation. | |
| /// The joint transform's local rotation must be cached on Start and passed into this method. | |
| /// </summary> | |
| public static void SetTargetRotationLocal (this ConfigurableJoint joint, Quaternion targetLocalRotation, Quaternion startLocalRotation) | |
| { | |
| if (joint.configuredInWorldSpace) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| /* Author @jpsarda | |
| * A drawing class. | |
| * | |
| * Examples : | |
| * |