Skip to content

Instantly share code, notes, and snippets.

View peter279k's full-sized avatar
🎯
Focusing

Chun-Sheng, Li peter279k

🎯
Focusing
View GitHub Profile
@peter279k
peter279k / massInsertOrUpdate.php
Created June 28, 2018 12:43 — forked from RuGa/massInsertOrUpdate.php
Mass (bulk) insert or update on duplicate for Laravel 4/5
/**
* Mass (bulk) insert or update on duplicate for Laravel 4/5
*
* insertOrUpdate([
* ['id'=>1,'value'=>10],
* ['id'=>2,'value'=>60]
* ]);
*
*
* @param array $rows
@peter279k
peter279k / fcitx-chewing.png
Created July 2, 2018 09:16 — forked from tanyuan/fcitx-chewing.png
Ubuntu: fcitx + chewing 新酷音輸入法
fcitx-chewing.png
<?php
final class EmailValueObject
{
private $mailbox;
private $host;
public function __construct($email)
{
if (false === strpos($email, '@')) {

#我的 Vim 指令筆記

##vim 的三種模式 ###模式

  • 輸入模式:輸入內文。
  • 指揮模式:也叫指令模式,主要是進入到可以對文件做修改,複製,剪下貼上,游標移動等動作。
  • 執行模式:文件存檔,離開等等行為。

###常用模式的切換

  • 輸入模式 -> 指揮模式 : 鍵盤 Esc

我的 Vim 指令筆記

vim 的三種模式

模式

  • 輸入模式:輸入內文。
  • 指揮模式:也叫指令模式,主要是進入到可以對文件做修改,複製,剪下貼上,游標移動等動作。
  • 執行模式:文件存檔,離開等等行為。

常用模式的切換

  • 輸入模式 -> 指揮模式 : 鍵盤 Esc
@peter279k
peter279k / .profile
Created April 8, 2019 06:25 — forked from edwinksl/.profile
Default .profile for Ubuntu 16.04 copied from /etc/skel/.profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
@peter279k
peter279k / Dockerfile
Created January 3, 2020 05:54 — forked from sidja/Dockerfile
How to change time zone in docker container ubuntu
FROM ubuntu:16.04
ENV TZ=Australia/Melbourne
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN dpkg-reconfigure --frontend noninteractive tzdata
@peter279k
peter279k / drive-format-ubuntu.md
Created January 7, 2020 18:01 — forked from keithmorris/drive-format-ubuntu.md
Partition, format, and mount a drive on Ubuntu
/* MODELS */
var ProjectCollection = function(projects){
var self = this;
var projects = projects;
this.create = function(attrs){
projects.push(attrs)
// might want to a bit of ajax here
@peter279k
peter279k / pkl_to_json.py
Created February 24, 2020 08:39 — forked from hailiang-wang/pkl_to_json.py
Convert python pickle file to json
#!/usr/local/bin/python3
'''
Convert a pkl file into json file
'''
import sys
import os
import _pickle as pickle
import json