Skip to content

Instantly share code, notes, and snippets.

@arikfr
arikfr / README.md
Last active May 16, 2024 16:28
Redash Query Export Tool

Setup

$ pip install click requests

Usage

$ python query_export.py --redash-url "https://app.redash.io/" --api-key ""
@minazou67
minazou67 / java-se-0-note.md
Last active December 3, 2015 02:14
Notes the Java SE
@voluntas
voluntas / shiguredo_mqtt_broker_log.rst
Last active December 3, 2017 09:50
時雨堂 MQTT ブローカー Akane 開発ログ

時雨堂 MQTT ブローカー Akane 開発ログ

日時

2017-12-03

時雨堂

バージョン

17.6.30

URL

https://shiguredo.jp/

2017 年 6 月 30 日をもって開発/販売を終了しました。

@kawasima
kawasima / 0_概要
Last active April 19, 2019 03:11
Struts1脆弱性の検証 [S2-020]
今回の問題は、StrutsでHttpリクエストパラメータをFormに入れる際に、commons-beanutilsの
BeanUtils.populateを使っていることに起因する。
populateの中で使われている、BeanUtils.setPropertyはノーチェックでBeanのプロパティを探すので、
プロパティ名を"class.classLoader.xxx"のように書いておくと、BeanのgetClassをよんで、
ClassオブジェクトのgetClassLoaderをよんで、…と連鎖してクラスローダが取得される。
そしてドットでつないだ最後のプロパティ名で値をセットにいくので、TomcatのWebAppClassLoaderが
途中でゲットされてしまうと、Struts2の脆弱性と同じ問題が発生してしまう。
@spikeheap
spikeheap / build.gradle
Last active April 11, 2020 19:05
Gradle build script to install NodeJS packages and Bower dependencies. This assumes you create package.json (nodejs) and bower.json files in the root of your project.
import org.gradle.api.tasks.Exec
defaultTasks 'bower'
// Get the path for the locally installed binaries
task npmBin << {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'npm'
args = ['bin']
@n-shinya
n-shinya / gist:5260185
Last active December 15, 2015 12:28
Using embedded tomcat (TomcatをJavaから起動する)

Using embedded tomcat (TomcatをJavaから起動する)

WARにパッケージングされたアプリケーションをJavaから起動する方法。

pom.xml

<dependency>
  <groupId>org.apache.tomcat.embed</groupId>
 tomcat-embed-core
@dai-shi
dai-shi / benchmark-startswith.js
Created February 14, 2013 03:51
benchmark of String.startsWith equivalents in Node.js
var Benchmark = require('benchmark');
Benchmark.prototype.setup = function() {
a = ["test"];
for (var i = 0; i < 10000; i++) {
a.push("some other stuff");
}
s = a.join();
re1 = new RegExp("^test");
re2 = new RegExp("^not there");
};
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"index.mapper.dynamic": false
}'
#{"ok":true,"acknowledged":true}
curl -XPUT localhost:9200/test/test/1 -d '{"foo":"bar"}'
#{"error":"TypeMissingException[[test] type[test] missing: trying to auto create mapping, but dynamic mapping is disabled]","status":404}
@(field:Field, min:Int=1)(f: (Field, Int) => Html)
@{
(0 until math.max(if (field.indexes.isEmpty) 0 else field.indexes.max + 1, min)).map(i => f(field("[" + i + "]"),i))
}
@bmc
bmc / Article.scala
Created September 25, 2012 19:21
One way to do transactions in Play with Anorm
case class Article(...);
object Article {
import DBUtil._
def delete(id: Long): Either[String, Boolean] = {
withTransaction { implicit connection =>
SQL("DELETE FROM comments WHERE article_id = {id}").on("id" -> id).executeUpdate()
SQL("DELETE FROM appusers WHERE id = {id}").on("id" -> id).executeUpdate( )
Right(true)