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 / GIF-Screencast-OSX.md
Created April 25, 2016 11:25 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@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 / 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 / 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 <[email protected]>
;; Maintainer: Stefan Siegl <[email protected]>
;; Author: Stefan Siegl <[email protected]>
;; Keywords: php docblock
;; Created: 2010
;; Modified: 2013-09-14
;; X-URL: https://gist.github.com/stesie
@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 / 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
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 / 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;
}
@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):