Skip to content

Instantly share code, notes, and snippets.

View mattn's full-sized avatar
🍛
I love curry 🍛

mattn mattn

🍛
I love curry 🍛
View GitHub Profile
package main
import (
"fmt"
"log"
"unsafe"
"github.com/jgillich/go-opencl/cl"
)
@mattn
mattn / a.go
Created April 9, 2018 08:56 — forked from hyuki/a.go
os.Create, fmt.Fprintf
package main
import (
"bufio"
"fmt"
"log"
"os"
)
func main() {
@mattn
mattn / ipset.bat
Created March 9, 2018 04:18
IPを切替えるバッチ(sudo for Windows 必須)
@echo off
setlocal enabledelayedexpansion
set ifname="ローカル エリア接続"
set count=0
if "%1" equ "" (
for /F "tokens=1,2,3,4,5 delims=," %%i in (%~dp0ipset.csv) do (
set "n=00!count!"
echo !n:~-2! %%i %%j
@mattn
mattn / vim-lsp-config.vim
Created January 19, 2018 16:59
vim-lsp の設定
if executable('typescript-language-server')
augroup LspTypeScript
au!
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'typescript-language-server',
\ 'cmd': {server_info->[&shell, &shellcmdflag, 'typescript-language-server', '--stdio']},
\ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'tsconfig.json'))},
\ 'whitelist': ['typescript'],
\ })
autocmd FileType typescript setlocal omnifunc=lsp#complete
package livereload
import (
"os"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
"github.com/omeid/livereload"
)
@mattn
mattn / bolt.go
Last active March 30, 2019 18:05
benchmark with bolt, goleveldb, pogreb for writing
package main
import (
"fmt"
"log"
"github.com/boltdb/bolt"
)
func main() {
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 8d288e0..ad017af 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -13449,8 +13449,14 @@ f_writefile(typval_T *argvars, typval_T *rettv)
if (write_list(fd, list, binary) == FAIL)
ret = -1;
#ifdef HAVE_FSYNC
- else if (do_fsync && fsync(fileno(fd)) != 0)
- EMSG(_(e_fsync));
package main
import (
"fmt"
"log"
"math/rand"
"regexp"
"strings"
"time"
@mattn
mattn / settings.yml
Created October 16, 2017 04:37
github-nippou settings
format:
subject: '### %{subject}'
line: '* [%{title}](%{url}) by @[%{user}](https://github.com/%{user}) %{status}'
dictionary:
status:
merged: '**merged!**'
closed: '**closed!**'
#include <stdio.h>
int main(void) {
int n = 600000 * 3;
int i = 1;
long c;
char buf[BUFSIZ];
setbuf(stdout, buf);
for (i = 1; i <= n; i++) {
if (i % 3 == 0 && i % 5 == 0) {