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
using System; | |
using System.IO; | |
namespace console_sample | |
{ | |
internal class Program | |
{ | |
private const string TemplatePath = "../../resources/daily_yyyymmdd.txt"; | |
private const string DestPath = "../../dest/"; |
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
import java.io.File | |
import java.nio.file.Files | |
import java.text.DateFormat | |
import java.text.SimpleDateFormat | |
import java.time.LocalDate | |
import java.time.LocalDateTime | |
import java.time.format.DateTimeFormatter | |
val TemplateFile = "DailyReport.xlsx" | |
val FileName = "DailyReport_" |
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
// 言語処理 100本ノック http://www.cl.ecei.tohoku.ac.jp/nlp100/#ch1 | |
fn main() { | |
knock_3("パトカー", "タクシー"); | |
knock_2(); | |
knock_1(); | |
} | |
fn knock_3(s1: &str, s2: &str){ | |
println!("{}", s1); |
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
<div class="uk-flex uk-flex-center uk-flex-middle"> | |
<div class="uk-section-muted uk-section-small"> | |
<div class="uk-container"> | |
<form class="uk-form-stacked"> | |
<div class="uk-margin"> | |
<label class="uk-form-label">E-mail</label> | |
<div class="uk-inline"> | |
<span class="uk-form-icon" uk-icon="icon: mail"></span> | |
<input type="email" class="uk-input"/> | |
</div> |
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
# step 1 | |
grep -rl hello ./php >> result.txt | |
# step 2 | |
# edit result.txt | |
# step 3 | |
grep -rlf result.txt ./target_dir |
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 ( | |
"bufio" | |
"os" | |
"strconv" | |
) | |
var sc = bufio.NewScanner(os.Stdin) |
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 forceDownloadFile(c *gin.Context, fileName string) { | |
targetPath := filepath.Join(downloadsPath, fileName) | |
if !strings.HasPrefix(filepath.Clean(targetPath), downloadsPath) { | |
c.String(403, "Look like you attacking me") | |
return | |
} | |
c.Header("Content-Description", "File Transfer") | |
c.Header("Content-Transfer-Encoding", "binary") | |
c.Header("Content-Disposition", "attachment; filename="+fileName) |
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" | |
) | |
func main() { | |
// open database | |
db, err := sql.Open("mysql", "root:root@tcp(127.0.0.1:3306)/my_database") | |
if err != nil { |
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 gcd(a, b int) int { | |
if b == 0 { | |
return a | |
} | |
return gcd(b, a%b) | |
} |
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
// sliceの重複要素を削除 | |
func slimSlice(slice []int) []int { | |
m := make(map[int]int) | |
slim := make([]int, 0) | |
for _, element := range slice { | |
if _, ok := m[element]; !ok { | |
m[element] = 0 | |
slim = append(slim, element) | |
} | |
} |
OlderNewer