Skip to content

Instantly share code, notes, and snippets.

def main:
print("hello happy world!!!")
if __name__ == "__main__":
main():
# Hello World!
class HelloTrema < Trema::Controller
def start(_args)
logger.info 'Trema started.'
end
def switch_ready(datapath_id)
logger.info "Hello #{datapath_id.to_hex}!"
end
end
wget -O vscode-server-linux-x64.tar.gz https://update.code.visualstudio.com/commit:コミットID/server-linux-x64/stable
(client端末にcurlがインストールされている場合)
置換元
CURL_OUTPUT=$(curl --connect-timeout 7 -L $DOWNLOAD_URL --output vscode-server.tar.gz -w "%{http_code}")\n\t\t\tif [[ ($? != 0) || ($CURL_OUTPUT != 2??) ]]
置換後
cp <ダウンロードしたファイル> vscode-server.tar.gz\n\t\t\tif [[ ($? != 0) ]]
(client端末にcurlがインストールされていない場合)
置換元
{
// IntelliSense を使用して利用可能な属性を学べます。
// 既存の属性の説明をホバーして表示します。
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "g++ build active file",
"type": "shell",
"command": "g++",
"args": [
OBJS = sample
CXX = g++
CXXFLAGS = -std=c++11 -Wall -O2
LDFLAGS = -lboost_thread
RM = rm -rf
all: $(OBJS)
clean:
$(RM) $(OBJS)
#include <iostream>
#include <boost/thread.hpp>
#define LOOP_NUM 5
// hogehogeと標準出力する関数
void Hoge() {
for(int i = 0; i != LOOP_NUM; i++) {
// hogehogeと標準出力(標準出力はスレッドセーフじゃないから本当は排他制御が必要だけど今回は省略)
std::cout << "hogehoge" << std::endl;
#include <iostream>
#include <boost/thread.hpp>
#define LOOP_NUM 5
// 引数の文字列を標準出力する関数
void Print(std::string str) {
for(int i = 0; i != LOOP_NUM; i++) {
// strの内容を標準出力(標準出力はスレッドセーフじゃないから本当は排他制御が必要だけど今回は省略)
std::cout << str << std::endl;
#include <iostream>
#include <boost/thread.hpp>
#define LOOP_NUM 5
// 文字列を加工して返す関数
std::string Modify(std::string str) {
std::cout << str << std::endl;
return str + " is modified.";