Skip to content

Instantly share code, notes, and snippets.

@sprhawk
sprhawk / gitconfig
Created January 30, 2020 15:36
my git config
[core]
excludesfile = .global_gitignore
[alias]
st = status
ci = commit
br = branch
co = checkout
df = diff
ll = log --name-status
[diff "localizablestrings"]
@sprhawk
sprhawk / Recovery.md
Created January 15, 2020 15:03
Recover Windows (10) System Partition
  1. Create an installation media
  2. Boot PC with an installation media
  3. Press SHFIT + F10 on the first screen to bring up Command Prompt
  4. Run the following commands and click Enter each time at Command Prompt:
diskpart
list disk
select disk N (N refers to the disk which contains the deleted the EFI System partition)
list partition
create partition efi
@sprhawk
sprhawk / use_capslock_as_control.reg
Last active January 23, 2020 15:09
Set CapsLock as Control
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
@sprhawk
sprhawk / disable_cortana.reg
Created January 8, 2020 13:16
Disable Cortana in Registry
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search]
"AllowCortana"=dword:00000000
@sprhawk
sprhawk / tmux.conf
Last active January 12, 2020 05:34
default tmux key binding
unbind C-b
bind-key C-t send-prefix
set-option -g prefix C-t
set -g default-terminal "screen-256color"
@sprhawk
sprhawk / i3_config
Last active February 21, 2020 02:34
i3 wm config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
@sprhawk
sprhawk / find_minimum_bounding_coordinates.sql
Last active February 3, 2019 04:37
find minimum bounding coordinate
-- find minimum bounding coordinate
-- ref:
-- [1] http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates
-- check the ref[1]
--
-- find minimum bounding coordinate,
-- if lon_min or lon_max outside [-π, π],
-- then the lon_min or lat_min will translate to lon_min + 2π or lon_max - 2π,
-- when check condition for this situation, need to check lon <= lon_min or lon >= lon_max
@sprhawk
sprhawk / create_distance_sphere.sql
Last active February 3, 2019 16:12
calculate two point distance on earth
-- calculate two point distance on earth
-- ref:
-- [1] https://www.scribd.com/presentation/2569355/Geo-Distance-Search-with-MySQL
-- [2] http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates
-- [3] https://en.wikipedia.org/wiki/Circle_of_a_sphere
-- [4] https://en.wikipedia.org/wiki/Great-circle_distance
-- [5] https://www.bram.us/2018/03/01/mysql-st_distance_sphere-polyfill/
-- [6] https://stackoverflow.com/questions/35939853/st-distance-sphere-in-mysql-not-giving-accurate-distance-between-two-locations
-- [7] https://www.movable-type.co.uk/scripts/latlong.html
-- [8] https://dev.mysql.com/doc/refman/5.7/en/spatial-convenience-functions.html#function_st-distance-sphere
@sprhawk
sprhawk / find python link
Created November 25, 2018 02:19
filter lines with awk
@sprhawk
sprhawk / DispatchTimeIntervalConvertible.swift
Created November 7, 2018 00:43
Make Int convertible to DispatchTime or DispatchTimeInterval
import Foundation
protocol DispatchTimeIntervalConvertible {
func seconds() -> DispatchTimeInterval
func milliseconds() -> DispatchTimeInterval
func secondsFromNow() -> DispatchTime
func millisecondsFromNow() -> DispatchTime
}