Skip to content

Instantly share code, notes, and snippets.

@tomsato
tomsato / sample-go-echo-api.go
Last active May 8, 2021 03:18
Echoフレームワークを利用したサンプルGolang API
package main
import (
"database/sql"
"fmt"
"io/ioutil"
"net/http"
"os"
_ "github.com/go-sql-driver/mysql"
@tomsato
tomsato / sample-go-api.go
Last active January 9, 2023 03:51
Golangのnet/httpを利用したサンプルAPI
package main
import (
"database/sql"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
[
{
"id": "4bbe1766.c798e8",
"type": "http in",
"z": "ad5c5270.4dd64",
"name": "POST sample ",
"url": "/sample",
"method": "post",
"upload": false,
"swaggerDoc": "",
[
{
"id": "7f5055b6.6ac83c",
"type": "http in",
"z": "e9ed6c54.27109",
"name": "POST sample ",
"url": "/sample",
"method": "post",
"upload": false,
"swaggerDoc": "",
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name simple-it-life.com;
root /var/www/vhosts/i-63a588c6;
j…y.fn.j…y.init {0: h1, length: 1, prevObject: j…y.fn.j…y.init}
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<script src="http://code.jquery.com/jquery-1.2.2.js"></script>
</head>
<body>
<h1>jQueryの練習</h1>
<script>
$(function() {
// 現在の設定を確認(cfq)
$ cat /sys/block/sda/queue/scheduler
noop anticipatory deadline [cfq]
// スケジューラを変更する
$ sudo sh -c '(echo deadline > /sys/block/sda/queue/scheduler)'
// 設定確認
$ cat /sys/block/sda/queue/scheduler
noop anticipatory [deadline] cfq
function get_set_class() {
var x = 0;
// ここにプライベートは変数や関数を宣言できる
return {
// 公開メソッド
get:function() {return x;},
set:function(num) {x = num; return this;} // return thisはメソッドチェーン用
}
var hoge = (function(){
var x = {p:3, q:5}
return function() {return x.p + x.q;}
})();
print(hoge()); // 8