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
##https://vulkan.lunarg.com/ | |
## https://vulkan.lunarg.com/sdk/home | |
# 18.04 | |
wget -qO - http://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add - | |
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.1.101-bionic.list http://packages.lunarg.com/vulkan/1.1.101/lunarg-vulkan-1.1.101-bionic.list | |
sudo apt update | |
sudo apt install lunarg-vulkan-sdk |
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 ( | |
"os" | |
"syscall" | |
"time" | |
) | |
func statTimes(name string) (atime, mtime, ctime time.Time, err error) { | |
fi, err := os.Stat(name) | |
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
import ( | |
"bytes" | |
"encoding/json" | |
"errors" | |
"fmt" | |
"github.com/BurntSushi/toml" | |
"errors" | |
) | |
// borrowed from golang playgroud: |
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
#!/bin/bash | |
appname=python | |
getpids() { | |
local pids=$(ps -ef | grep $1 | grep -v grep| awk '{print $2}') | |
echo $pids | |
} | |
pids=`getpids $appname` |
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
# I want compress yesterday's log, so I have to learn how to get yesterday with bash | |
# yesterday=$(date --date='-1 day' +%Y-%m-%d) | |
# today=$(date +%Y-%m-%d) | |
# yesterday_log=service_log_${yesterday}.log | |
# zip ${yesterday_log}.zip ${yesterday_log} | |
## today | |
today=$(date +%Y-%m-%d) |
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
# raii (c++) | |
before: | |
void UseFile(char const* fn) | |
{ | |
FILE* f = fopen(fn, "r"); // 获取资源 | |
// 使用资源 | |
try { | |
if (!g()) { fclose(f); return; } | |
// ... |
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
// https://en.wikipedia.org/wiki/Dangling_pointer | |
void f() { | |
int *x = malloc(sizeof(int)); | |
*x = 1024; | |
printf("%d\n", *x); |
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
// http://rustbyexample.com/scope/borrow.html | |
// https://is.gd/E0jeLL | |
fn simple_borrow() { | |
let mut v = vec!["A"]; | |
{ | |
// immutable borrow |
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
// https://play.rust-lang.org/ | |
// https://is.gd/VHQlvO | |
// Line comments which go to the end of the line. | |
/* Block comments which go to the closing delimiter. */ | |
fn main () { |
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
# open file manager of current directory in the terminal | |
# http://askubuntu.com/questions/31069/how-to-open-a-file-manager-of-the-current-directory-in-the-terminal | |
xdg-open . | |
# mac | |
# open . |
NewerOlder