Skip to content

Instantly share code, notes, and snippets.

View f1047's full-sized avatar
🦍
Coding Gorilla

Hiroaki Matsushige a.k.a. Luo Boming f1047

🦍
Coding Gorilla
View GitHub Profile
@f1047
f1047 / ssh_config_template
Created June 27, 2024 07:59
General SSH config useful in most cases
Host *
ServerAliveInterval 300
ServerAliveCountMax 10
ForwardX11 yes
ForwardX11trusted yes
ForwardAgent yes
@f1047
f1047 / 0_gen-scrapbox-format-link.js
Last active April 9, 2024 11:06
Bookmarklet to generate Scrapbox compatible format link
@f1047
f1047 / 0_create-atcoder-event-on-google-calendar.js
Last active April 9, 2024 11:06
Bookmarklet to create AtCoder coding event on Google Calendar
javascript:(function() { const contestName = document.querySelector("a.contest-title").innerHTML; const contestUrl = document.querySelector("a.contest-title"); const times = document.querySelectorAll("small.contest-duration a"); const startTimeFormed = String(times[0]) .split("=")[1].replace("&p1", "") + "00"; const endTimeFormed = String(times[1]) .split("=")[1].replace("&p1", "") + "00"; const googleCalendarUrl = "http://www.google.com/calendar/event?" + "action=" + "TEMPLATE" + "&text=" + encodeURIComponent(contestName) + "&dates=" + startTimeFormed + "/" + endTimeFormed + "&location=" + contestUrl; window.open(googleCalendarUrl, ''); })();
@f1047
f1047 / scrapbox2md.rb
Last active July 18, 2021 09:00
Scrapbox のエントリが入った json をページ毎の markdown file に保存するスクリプト
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'json'
require 'pathname'
require 'stringio'
require 'net/http'
require 'uri'
name: "ResNet-50"
input: "data"
input_dim: 1
input_dim: 3
input_dim: 224
input_dim: 224
layer {
bottom: "data"
top: "conv1"
name: "MOBILENET"
# transform_param {
# scale: 0.017
# mirror: false
# crop_size: 224
# mean_value: [103.94,116.78,123.68]
# }
input: "data"
input_dim: 1
input_dim: 3
@f1047
f1047 / read_binary_file.hpp
Last active January 24, 2020 07:13
バイナリファイルを読み込むやつ
#include <cstdint>
#include <fstream>
#include <string>
#include <vector>
#include <stdexcept>
inline std::vector<std::uint8_t> readBinaryFile(const std::string& filename) {
std::ifstream fin(filename, std::ios_base::in | std::ios_base::binary);
if (!fin) {
throw std::runtime_error{"Failed to open file"};
@f1047
f1047 / hexdump.hpp
Last active January 24, 2020 07:13
バイナリデータを16進数表示するやつ
#pragma once
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <sstream>
#include <string>
inline std::string hexdump(const void* buf, std::size_t size, std::size_t num_cols = 10) {