Skip to content

Instantly share code, notes, and snippets.

View locona's full-sized avatar
:octocat:
On vacation

Miyamae Yuuya locona

:octocat:
On vacation
View GitHub Profile
@locona
locona / main.go
Created August 20, 2019 09:27
How to change to json string without escaping.
package main
import (
"encoding/json"
"fmt"
)
type IDType struct {
Value int
Valid bool
package main
import (
"fmt"
"io/ioutil"
"os/exec"
)
func run() {
cmd := exec.Command("/bin/sh", "-c", "ping 127.0.0.1")
package main
import (
"fmt"
"reflect"
"strconv"
"strings"
"github.com/k0kubun/pp"
)
node -e 'console.log(Date.now())'
hcommand to find recursively files {can be modified for folders too, change -type f}, and renamed them by specfying regex pattern
find . -type f -maxdepth [depth] -name "[filepattern]" | while read FNAME; do mv "$FNAME" "${FNAME//search/replace}"; done
example:
find . -type f -maxdepth 1 -name "domain*.php" | while read FNAME; do mv "$FNAME" "${FNAME//domain/lead}"; done
1. 15
2. 30
3. 60
4. 125
5. 250
6. 500
7. 1000
1. 0
2. 0
%load_ext autoreload
%autoreload 2
try:
print("try")
raise Exception("RAISE")
except Exception as e:
print(e)
finally:
print("finally")
class Sample:
def __init__(self):
pass
@classmethod
def helloo(cls):
print('class hello')
def hello(self):
function! s:find_git_root()
return system('git rev-parse --show-toplevel 2> /dev/null')[:-2]
endfunction
command! ProjectFiles execute 'Files' s:find_git_root()