Skip to content

Instantly share code, notes, and snippets.

@shanghaikid
shanghaikid / PolicyKit.conf
Created February 5, 2020 13:15 — forked from priyadarshan/PolicyKit.conf
FreeBSD 11 notebook installation cheat-sheet
# /usr/local/etc/PolicyKit/PolicyKit.conf
# Allow normal users to mount removable media automatically
<config version="0.1">
<match action="org.freedesktop.hal.storage.mount-removable">
<return result="yes"/>
</match>
<match action="org.freedesktop.hal.storage.mount-fixed">
<return result="yes"/>
</match>
@shanghaikid
shanghaikid / gist:50453115aa5b59435db88b1e6f7789e5
Created February 17, 2019 01:54 — forked from adamstac/gist:7462202
Install and configure Sendmail on Ubuntu

Install and configure Sendmail on Ubuntu

This should help you get Sendmail installed with basic configuration on Ubuntu.

  1. If sendmail isn't installed, install it: sudo apt-get install sendmail
  2. Configure /etc/hosts file: nano /etc/hosts
  3. Make sure the line looks like this: 127.0.0.1 localhost yourhostname
  4. Run Sendmail's config and answer 'Y' to everything: sudo sendmailconfig
  5. Restart apache sudo service apache2 restart
{"110000":"北京市","110101":"东q城区","110102":"西城区","110105":"朝阳区","110106":"丰台区","110107":"石景山区","110108":"海淀区","110109":"门头沟区","110111":"房山区","110112":"通州区","110113":"顺义区","110114":"昌平区","110115":"大兴区","110116":"怀柔区","110117":"平谷区","110118":"密云区","110119":"延庆区","120000":"天津市","120101":"和平区","120102":"河东区","120103":"河西区","120104":"南开区","120105":"河北区","120106":"红桥区","120110":"东丽区","120111":"西青区","120112":"津南区","120113":"北辰区","120114":"武清区","120115":"宝坻区","120116":"滨海新区","120117":"宁河区","120118":"静海区","120119":"蓟州区","130000":"河北省","130100":"石家庄市","130102":"长安区","130104":"桥西区","130105":"新华区","130107":"井陉矿区","130108":"裕华区","130109":"藁城区","130110":"鹿泉区","130111":"栾城区","130121":"井陉县","130123":"正定县","130125":"行唐县","130126":"灵寿县","130127":"高邑县","130128":"深泽县","130129":"赞皇县","130130":"无极县","130131":"平山县","130132":"元氏县","130133":"赵县","130181":"辛集市","130183":"晋州市","130184":"新乐市","130200":"唐山市","130202":"路南区","130203":"路北区","130204":"古冶区","130205":"开平区","130207":"丰南区","130208":"丰润区","130209":"曹妃甸区","130223":"滦县","130224":"滦南县
@shanghaikid
shanghaikid / log.js
Last active January 14, 2019 07:32
save log fed error
const {error, log} = console;
Object.defineProperties(console, {
'saveLog': {
value: function() {
// put backend request here in the try catch error
alert('sent', arguments);
}
},
'log': {
buildTopSvgPath(start, end, skipAmount = 0) {
const startX = start.x + start.width / 2,
startY = start.y + start.height,
endX = (startX + end.x + end.width / 2) / 2, // half way between real start and end
endY = start.enHeight + skipAmount + ENCLOSURE_Y_GAP / 2,
width = Math.abs(endX - startX),
height = Math.abs(endY - startY),
svgWidth = width + STROKE_WIDTH * 2,
svgHeight = height + STROKE_WIDTH * 2,
left = Math.min(startX, endX) - STROKE_WIDTH,
@shanghaikid
shanghaikid / gist:605f0cdb995b40b6cd370c9f2fab22e7
Created May 23, 2018 14:56 — forked from phillips1012/gist:d2a9fce6e69002f5dbe4
How to install Arch Linux with MBR without swap

#How to install Arch Linux with MBR without swap

This tutorial assumes you're installing arch to /dev/sda. You can replace /dev/sda with the device name you want to install arch to.

##Partitioning

Make a single partition on an MBR partition scheme to install arch to.

We'll call this "/dev/sda1". Edit this if it's some other device file.

@shanghaikid
shanghaikid / gist:590f7e572af4a2f344f0f6b2302fa3c6
Created July 12, 2017 12:45 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.
$ ssh -A vm
$ git config --global url."[email protected]:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "[email protected]:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@shanghaikid
shanghaikid / README.md
Created March 15, 2017 02:51 — forked from Bonuspunkt/README.md
dojo JSX Transform

JSX Loader for Dojo

place the JSXTranformer.js from the react package next to the jsxTransform.js file.

sample

/** @jsx React.DOM */
// filename: Comment.jsx
define([
	'react/react'
@shanghaikid
shanghaikid / 0Option2ConstructorSummary.md
Created December 12, 2016 07:15 — forked from allenwb/0Option2ConstructorSummary.md
New ES6 constructor features and semantics: Alternative 2 manual super in derived classes

New ES6 Constructor Semantics and Usage Examples

Manual super: Alternative Design where subclass constructors do not automatically call superclass constructors

This Gist presents a new design of class-based object construction in ES6 that does not require use of the two-phase @@create protocol.

One of the characteristics of this proposal is that subclass constructors must explicitly super invoke their superclass's constructor if they wish to use the base class' object allocation and initialization logic.

An alternative version of this design automatically invokes the base constructor in most situations.

@shanghaikid
shanghaikid / gist:45102b1e5cdc1d8b226d
Created December 26, 2015 07:00 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat