Skip to content

Instantly share code, notes, and snippets.

View horitaku1124's full-sized avatar

Horimatsu Takuya horitaku1124

  • Tokyo
View GitHub Profile
sudo apt update
sudo apt install mariadb-server
sudo /etc/init.d/mysql start
docker run -p 27018:27017 -d --rm -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=secret --name mongo1 mongo
docker exec -it mongo1 bash
brew tap mongodb/brew
brew install mongodb-community
CREATE DATABASE dabase_name CHARACTER SET utf8mb4;

create user 'mysql_user'@'localhost' identified by 'mysql_user_password';

GRANT ALL PRIVILEGES ON dabase_name.* to mysql_user@localhost IDENTIFIED BY 'mysql_user_password';

MySQL8では IDENTIFIED BY は使えない

async function postFormData(url = '', data = "") {
const response = await fetch(url, {
method: 'POST',
mode: 'cors',
cache: 'no-cache',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
redirect: 'follow',
@horitaku1124
horitaku1124 / Vagrantfile
Last active August 10, 2020 23:21
Phalcon getting started
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-19.10"
config.vm.network "private_network", ip: "192.168.33.9"
config.vm.synced_folder "./", "/mnt/phalcon_test"
config.vm.provision "shell", inline: <<-SHELL
package com.example.alternate;
import java.sql.*;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;
public class OConnection implements Connection {
private Connection altConn;
public OConnection(Connection alternateConnection) {
import java.io.IOException;
import java.io.InputStream;
import static java.lang.Thread.sleep;
public class MemoryLimit {
private static final int TRY_COUNT = 5;
public static void main(String[] args) throws IOException, InterruptedException {
double memory = 10_000_000;
double lastSuccessMemory = memory;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
/**
* http://www.file-recovery.com/mp4-signature-format.htm
*/
public class IsoFileReader {
public static void main(String[] args) throws IOException {
File file = new File("test1.mp4");
@horitaku1124
horitaku1124 / minikube.Vagrantfile
Last active February 20, 2020 10:33
minikube setup
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-19.10"
config.vm.provider "virtualbox" do |vb|
vb.cpus = "2"
end
config.vm.network "private_network", ip: "192.168.33.100"
@horitaku1124
horitaku1124 / RemoteTest.kt
Last active February 7, 2020 15:05
Setup selenium grid
import org.junit.After
import org.junit.Before
import org.junit.Test
import org.openqa.selenium.OutputType
import org.openqa.selenium.TakesScreenshot
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.firefox.FirefoxOptions
import org.openqa.selenium.remote.RemoteWebDriver
import java.io.File