Skip to content

Instantly share code, notes, and snippets.

@dai1741
dai1741 / TensorRT_mnist.ipynb
Last active January 2, 2022 09:12 — forked from altbridgetech/TensorRT_mnist.ipynb
TensorRT-tar-installation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dai1741
dai1741 / kk-ratings.js.patch
Created July 16, 2013 18:25
A dirty and insecure patch for kk-star-ratings 1.x. When using it with PHP 5.3, a warning message from php such like 'Deprecated: Function set_magic_quotes_runtime() ...' is injected into ajax response of kk-ratings.js. This ignores it by checking existence of returned contents directly.
--- a/kk-star-ratings/js/kk-ratings.js 2012-05-08 21:00:16.000000000 +0900
+++ b/kk-star-ratings/js/kk-ratings.js 2013-07-17 02:04:01.539796700 +0900
@@ -93,7 +93,7 @@
msg = msg.replace(/^\s+|\s+$/g,"");
var response = msg.split('|||');
- if(response[0]=='SUCCESS')
+ if(response[1]!='')
{
var per = response[1];
@dai1741
dai1741 / data-saver.coffee
Created March 8, 2013 05:08
あるwebページを定期的に巡回し更新があればgitリポジトリにコミットするスクリプト 要PhantomJS・Python2・bash
system = require 'system'
fs = require 'fs'
if system.args.length is 1
console.log 'Usage: data-saver.coffee address [userName] [password]'
phantom.exit 1
else
phantom.outputEncoding = 'System' # for good old ms-dos
console.log 'ブラウザ起動中...'
@dai1741
dai1741 / cppsyntax.py
Last active December 14, 2015 07:09
A SublimeLinter linter for checking C++ syntax using g++ like flymake
# -*- coding: utf-8 -*-
# cppsyntax.py - sublimelint package for checking syntax of c++ files
# 以下のclang実装を参考に作成した
# https://github.com/itsbth/SublimeLinter/blob/da0e15275b7c38cbfbc768a2dcc8e62a0e925ca0/sublimelinter/modules/cpp.py
import os.path
import re
from base_linter import BaseLinter, INPUT_METHOD_TEMP_FILE
@dai1741
dai1741 / Makefile
Created April 30, 2012 15:49
flexとgccを使ってフォルダ内の*.lexを*.exeにコンパイルするMakefile
LEX = flex
CC = gcc
LDLIBS=-lfl
LEXES = $(wildcard *.lex)
EXES = $(LEXES:%.lex=%.exe)
all: $(EXES)
%.c:%.lex
@echo off
setlocal
rem まずこのファイルパスを共有したい設定フォルダに変える
rem 例:"WORKSPACE_DIR\eclipse_workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings"
set theSharedFolder="C:\Users\dai\Documents\eclipse_workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings"
rem このファイルパスを共有させる設定フォルダの上フォルダに変えて実行!
rem 例:"WORKSPACE_DIR\eclipse_workspace\.metadata\.plugins\org.eclipse.core.runtime\"
set theSharingFolder="C:\Users\dai\Documents\eclipse_workspaces\swt\.metadata\.plugins\org.eclipse.core.runtime\"
@dai1741
dai1741 / Makefile
Created December 30, 2011 13:55
Eclipse CDTで競技プログラミングのコードを1プロジェクト内にまとめたうえで個別に実行できるようにするGNU Makefile
# ファイル構成:
# root
# |- src :*.cppが入っている
# |- bin :ここに*.exeが生成される
CXXFLAGS = -O2 -g -Wall -fmessage-length=0
CPPS = $(wildcard src/*.cpp)
OBJS = $(CPPS:.cpp=.o)
@dai1741
dai1741 / wmf-to-svg.bat
Created December 23, 2011 13:31
Convert wmf files in current directory to svg files using Inkscape
@echo off
for %%i in (*.wmf) do set WMF=%%i&call :sub
goto :eof
:sub
set SVG=%WMF:~0,-3%svg
"C:\Program Files (x86)\Inkscape\inkscape" "%WMF%" -l "%SVG%"
:: the inkcape path is hard coded, so you probably need to modify it
@dai1741
dai1741 / fix-chinese-font.user.js
Created December 18, 2011 13:50
A Greasemonkey script that fixes bug that texts look ugly in some pages in Opera 11.60 etc.
// ==UserScript==
// @name Fix chinese font
// ==/UserScript==
(function() { if(document.documentElement.lang === '') document.documentElement.lang = 'ja'; })();