Skip to content

Instantly share code, notes, and snippets.

// Force strict semicolon mode
// bug fix by def075
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_VERSION "0.666 beta- fix"
new String:g_gameMode[64];
new Handle:g_mapMenu = INVALID_HANDLE;
/* Left 4 Dead 2 Panic Events */
#include <sourcemod>
public OnPluginStart()
{
/* Hook Panic Create event after it has happened */
HookEvent("create_panic_event", OnPanicCreate);
/* Hook Left Player event after it has happened */
HookEvent("player_left_start_area", OnPlayerLeftStartArea);
}
@nagadomi
nagadomi / nin3layer_model.lua
Last active July 12, 2016 11:44
mavenlin's 3-layer NIN
require 'cunn'
require './lib/SpatialAveragePooling'
-- reference: https://gist.github.com/mavenlin/e56253735ef32c3c296d
local function normal_init(m, u, s, bias)
m.weight:normal(u, s)
if bias == nil then
m.bias:normal(u, s)
else
@nagadomi
nagadomi / csv.lua
Last active April 28, 2020 14:52
csvigo example
-- sudo luarocks install csvigo
-- でインストールしておく
require 'csvigo'
--[[ test.csv
a,b,c,d
1,2,3,4
5,5,3,3
--]]
require 'cutorch'
require 'cunn'
local function build_model()
-- a CNN
local model = nn.Sequential()
model:add(nn.SpatialConvolutionMM(3, 128, 5, 5, 1, 1))
model:add(nn.ReLU())
model:add(nn.SpatialMaxPooling(2, 2, 2, 2))
model:add(nn.View(10 * 10 * 128))
@nagadomi
nagadomi / LeakyReLU.lua
Last active October 25, 2015 12:46
LeakyReLU
--- mynn.lua
mynn = {} -- Define your own namespace.
--- LeakyReLU.lua
-- Define LeakyReLU module under your own namespace.
local LeakyReLU, parent = torch.class('mynn.LeakyReLU','nn.Module')
function LeakyReLU:__init(negative_scale)
parent.__init(self) -- Call the super class constructor
@nagadomi
nagadomi / pagerank.lua
Last active August 29, 2015 14:16
PageRank
local function pagerank(mat, alpha, epsilon)
alpha = alpha or 0.85
epsilon = epsilon or 1.0e-5
local state = torch.Tensor(mat:size(1)):fill(1.0 / mat:size(1))
local p = mat:clone()
local alpha_not = ((1.0 - alpha) / state:size(1))
for i = 1, mat:size(1) do
p[i]:div(mat[i]:sum() + 1.0e-6)
@nagadomi
nagadomi / randomwrite.rb
Created May 8, 2015 15:33
turbovisor segfault
require 'open-uri'
TARGET_URL = "http://localhost:8888/"
TARGET_DIR = "./"
CORE_FILE = "./core"
def random_file_update
rng = Random.new
10000.times do |i|
filename = File.join(TARGET_DIR, sprintf("%d", i % 10))
@nagadomi
nagadomi / otto.conf
Created May 19, 2015 03:03
my xgboost configuration for kaggle-otto competition
# local-CV: 0.436
# number of threads
nthread=8
# fixed random seed
seed=12
# whether create binary buffer for text input, this normally will speedup loading (NO)
use_buffer = 0
# The path of training data
This file has been truncated, but you can view the full file.
[{"bias":[0.028505884110928,-0.011944146826863,-0.031148914247751,-0.0031341155990958,0.0092963706701994,0.008396684192121,-0.052017644047737,-0.053563583642244,0.013980533927679,-0.0083225620910525,0.019794654101133,0.0097693046554923,0.019742390140891,-0.021908029913902,-0.04789212718606,-0.058312103152275,0.00098388339392841,-0.024875573813915,-0.00019801953749266,-0.0051305224187672,-0.035766143351793,-0.018864262849092,0.03208315372467,0.0075986147858202,-0.015769049525261,-0.043182034045458,-0.018727220594883,0.0072148125618696,-0.054116483777761,0.0087907928973436,-0.0050874976441264,0.0030902056023479],"kW":3,"nInputPlane":3,"weight":[[[[0.027103105559945,0.077817507088184,0.088963352143764],[0.050164110958576,-0.047492902725935,0.011296784505248],[-0.011886465363204,-0.13131293654442,-0.035226672887802]],[[0.044841166585684,-0.014278756454587,0.038773007690907],[0.19783321022987,-0.027543751522899,-0.16893927752972],[-0.010402355343103,-0.020798994228244,-0.071524895727634]],[[0.068569131195545,-0.10