コマンド | 説明 | 使い方 | 備考 |
---|---|---|---|
pwd | カレントディレクトリの絶対パスを表示する | pwd | print working directoryの略 |
ls | カレントディレクトリ内に存在するファイルを一覧表示する | ls <ディレクトリ名> | ディレクトリ名を指定しなかった場合はカレントディレクトリを指定したとみなされる |
cd | 指定したディレクトリに移動する | cd <ディレクトリ名> | ディレクトリ名を指定しなかった場合はホームディレクトリを指定したとみなされる |
mkdir | ディレクトリを作る | mkdir <ディレクトリ名> | make directory の略 |
rm | ファイルを削除する | rm <ファイル名> | remove の略。ディレクトリを削除したい場合は -r オプションが必要 |
mv | ファイルを移動させる | mv <移動元> <移動先> | 移動元と移動先が同じディレクトリにある場合は、実質ファイル名の変更として使える |
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
/********************************************************************** | |
* CSS生成日 : 2021/05/10 18:42:06 | |
* バージョン: Chat v2.0 Style Generator 日本語版 2021.03.27 | |
**********************************************************************/ | |
/* Background colors - 背景色 */ | |
body { | |
overflow: hidden; |
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
work="./work" | |
object=$1 | |
mkdir $object | |
for i in $(ls $work) | |
do | |
mv $work/$i/* $object/$object\_$i.png | |
done |
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
package main | |
import ( | |
"database/sql" | |
_ "github.com/go-sql-driver/mysql" | |
) | |
func main() { | |
db, _ := sql.Open("mysql", "user:password@tcp(host:port)/dbname") | |
tx, _ := db.Begin() // トランザクション開始 |
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
func main(){ | |
db, _ := sql.Open("mysql", "user:password@tcp(host:port)/dbname") | |
tx, _ := db.Begin() | |
defer func() { | |
// panicが起きたらロールバック | |
if recover() != nil { | |
tx.Rollback() | |
} | |
}() | |
} |
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
tx, _ := db.Begin() // トランザクション開始 | |
stmt, _ := tx.Prepare("INSERT INTO hoge (id) VALUES (?)") | |
stmt.Exec("0000") | |
tx.Commit() |
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
stmt1, _ := db.Prepare("INSERT INTO hoge (id) VALUES (?)") | |
tx, err := db.Begin() // トランザクション開始 | |
stmt2 := tx.Stmt(stmt1) | |
stmt1.Exec("0000") // トランザクションに含まれない | |
stmt2.Exec("0000") // トランザクションに含まれる | |
tx.Commit() |
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
tx, _ := db.Begin() | |
tx.Exec("INSERT INTO hoge (id) VALUES (?)", "0000") | |
tx.Query("SELECT * FROM hoge WHERE id = ?", "0000") | |
tx.QueryRow("SELECT * FROM hoge") | |
tx.Commit() |
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
package main | |
import ( | |
"database/sql" | |
_ "github.com/go-sql-driver/mysql" | |
) | |
func main() { | |
db, _ := sql.Open("mysql", "user:password@tcp(host:port)/dbname") |
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
package main | |
import( | |
"fmt" | |
) | |
type Hoge struct { | |
A int | |
B struct { | |
X int |
NewerOlder