View swagger.yaml
This file contains 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
--- | |
swagger: '2.0' | |
info: | |
version: 1.0.0 | |
title: Swager api sample | |
description: | | |
#### Swagger API description example | |
schemes: | |
- https |
View swagger-01.yaml
This file contains 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
--- | |
swagger: '2.0' | |
info: | |
version: 1.0.0 | |
title: Swager api sample | |
description: | | |
#### Swagger API description example | |
schemes: | |
- https |
View swagger-02.yaml
This file contains 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
definitions: | |
Monster: | |
type: object | |
properties: | |
name: | |
type: string | |
description: Pokemon name | |
hp: | |
type: number | |
description: Max health points |
View swagger-03.yaml
This file contains 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
/pokemon/list: | |
get: | |
responses: | |
200: | |
description: Return all as array | |
schema: | |
type: array | |
items: | |
$ref: '#/definitions/Monster' | |
View swagger-04.yaml
This file contains 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
/pokemon/add: | |
post: | |
description: Add new Pokemon | |
parameters: | |
- name: newMonster | |
in: body | |
required: true | |
schema: | |
$ref: '#/definitions/Monster' | |
responses: |
View pantip-scrap.js
This file contains 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
var cheerio = require('cheerio'); | |
var request = require('request') | |
var prettyjson = require('prettyjson') | |
function gotHTML(err, resp, html) { | |
if (err) return console.error(err) | |
var parser = cheerio.load(html) | |
topic = {} | |
topic.title = parser('h2').text() | |
topic.story = parser('.display-post-story', '.main-post').text() |
View topic-parse.js
This file contains 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
var parser = cheerio.load(html) | |
topic = {} | |
topic.title = parser('h2').text() | |
topic.story = parser('.display-post-story', '.main-post').text() |
View helper-base-url.rb
This file contains 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
#get base url from sinatra with nginx passenger app passenger_base_uri | |
base_url = "#{request.env['rack.url_scheme']}://#{request.env['HTTP_HOST']}#{request.env['SCRIPT_NAME']}"; |
View measure_exec_time.js
This file contains 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
// easy | |
console.time('sss'); | |
someFunction(); // run whatever needs to be timed in between the statements | |
console.timeEnd('ssss'); | |
// Standard | |
var t0 = performance.now(); | |
doSomething(); | |
var t1 = performance.now(); |
View eternalblue_exploit.py
This file contains 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
#!/usr/bin/python | |
from impacket import smb | |
from struct import pack | |
import os | |
import sys | |
import socket | |
''' | |
EternalBlue exploit by sleepya | |
The exploit might FAIL and CRASH a target system (depended on what is overwritten) |
OlderNewer