Skip to content

Instantly share code, notes, and snippets.

View mk2's full-sized avatar
💭
Internet

Haruka Asakura mk2

💭
Internet
View GitHub Profile
@mk2
mk2 / gist:708592cacc2c494048d3c63c93c5d7a8
Created September 10, 2019 04:49 — forked from steipete/ios-xcode-device-support.sh
Using iOS 13/13.1 devices with Xcode 10.3 (instead of Xcode 11)
// The trick is to link the DeviceSupport folder from the beta to the stable version.
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
// Xcode 10.3 to Xcode 11 Beta
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
// For iOS 13.1 this trick currently seems to work (as of beta 2):
@mk2
mk2 / custom-props.tsx
Created January 23, 2019 08:01 — forked from iamtmrobinson/custom-props.tsx
Using custom props with a Redux form in Typescript
import * as React from 'react';
import {
Field as FormField,
InjectedFormProps,
reduxForm,
} from 'redux-form';
interface CustomProps {
customText: string;
}
cd /tmp
git clone https://github.com/facebook/watchman.git
cd watchman/
git checkout v4.7.0
sudo apt-get install -y autoconf automake build-essential python-dev libtool libssl-dev
./autogen.sh
./configure
make
sudo make install
@mk2
mk2 / WSL-ssh-server.md
Created March 19, 2018 12:26 — forked from dentechy/WSL-ssh-server.md
A step by step tutorial on how to automatically start ssh server on boot on the Windows Subsystem for Linux

How to automatically start ssh server on boot on Windows Subsystem for Linux

Microsoft partnered with Canonical to create Bash on Ubuntu on Windows, running through a technology called the Windows Subsystem for Linux. Below are instructions on how to set up the ssh server to run automatically at boot.

  1. Uninstall and reinstall the ssh server using the following commands:
    1. sudo apt remove openssh-server
    2. sudo apt install openssh-server
  2. Edit the /etc/ssh/sshd_config file by running the command sudo vi /etc/ssh/sshd_config and do the following
    1. Change Port to 2222 (or any other port above 1000)
  3. Change UsePrivilegeSeparation to no
@mk2
mk2 / MapUtils.cs
Created November 18, 2017 16:29 — forked from flarb/MapUtils.cs
A port of this PHP code: http://stackoverflow.com/questions/1763917/google-static-maps-move-maps-with-a-finger To C# in Unity3D to convert google maps lat/lng to pixel coordinates and vice versa.
using UnityEngine;
using System.Collections;
public class MapUtils {
static float GOOGLEOFFSET = 268435456f;
static float GOOGLEOFFSET_RADIUS = 85445659.44705395f;//GOOGLEOFFSET / Mathf.PI;
static float MATHPI_180 = Mathf.PI/180f;
static private float preLonToX1 = GOOGLEOFFSET_RADIUS * (Mathf.PI/180f);
@mk2
mk2 / php-doc.el
Created June 23, 2017 06:37 — forked from stesie/php-doc.el
php doc block generator/extractor for emacs
;;; php-doc.el --- doc block generator/extractor for php
;; Copyright (C) 2010, 2013 Stefan Siegl <stesie@brokenpipe.de>
;; Maintainer: Stefan Siegl <stesie@brokenpipe.de>
;; Author: Stefan Siegl <stesie@brokenpipe.de>
;; Keywords: php docblock
;; Created: 2010
;; Modified: 2013-09-14
;; X-URL: https://gist.github.com/stesie
@mk2
mk2 / ko.utils.3.4.0.signatures.js
Created June 4, 2017 14:03 — forked from hyle/ko.utils.3.4.0.signatures.js
KnockoutJS 3.4.0 utils (ko.utils) signatures
// knockout 3.4.0
ko.utils.addOrRemoveItem = function (array, value, included) { /* .. */ }
ko.utils.anyDomNodeIsAttachedToDocument = function (nodes) { /* .. */ }
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
@mk2
mk2 / kachidoki_elevator.cc
Created January 26, 2017 02:56 — forked from remore/kachidoki_elevator.cc
(1: 最適化問題) 下記パラメータのままでElevator::tick()のみを最適化して平均待ち人数を最小化する / (2: 並列化問題) 以下のプログラムをマルチスレッドで動作させると何倍早くなるか実装して検証する / (3: チューニング問題)並列化以外の方法で本プログラムの実行時間を短縮するためにどのような改修を加えるとよいか考察する
#include <iostream>
#include <iomanip>
#include <random>
#include <unistd.h>
using namespace std;
const int MAX_FLOOR = 14;
const int ELEVATOR_COUNT = 4;
const int RAISING_PROBABILITY = 10;
@mk2
mk2 / file0.js
Created July 5, 2016 13:37
Reduxのアクションを綺麗に書く方法の提案 ref: http://qiita.com/mk2/items/5f9d65dbb149512fc468
export default class ActionSchema {
constructor(...props) {
Object.assign(this, {
...props,
});
}
static get actionType() {
return this.name;
@mk2
mk2 / dl.sh
Created May 9, 2016 15:10
Lets download mp4
wget -r -l2 -A.mp4 http://...