Skip to content

Instantly share code, notes, and snippets.

Avatar

slow-is-fast slow-is-fast

View GitHub Profile
View alacritty.yml
# 默认窗口无标题栏,16:9的窗口比例启动
window:
# decorations: "none"
# dimensions:
# columns: 120
# lines: 30
startup_mode: Maximized
# 背景半透明,方便抄代码
background_opacity: 0.9
@slow-is-fast
slow-is-fast / ArcUtils.java
Created Jul 10, 2020 — forked from Takhion/ArcUtils.java
Collection of methods to achieve better circular arc drawing, as Canvas.drawArc() is unreliable. See the related article: https://medium.com/p/9155f49166b8
View ArcUtils.java
/**
* ArcUtils.java
*
* Copyright (c) 2014 BioWink GmbH.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@slow-is-fast
slow-is-fast / laravel_model_observe_change.md
Created May 18, 2020
Laravel Model observer get changed data
View laravel_model_observe_change.md
    public function updated(Order $order)
    {
        $originals = [];
        if ($order->isDirty('order_status')) {
            Log::info("order new status :" . $order->order_status . " -- old status :" . $order->getOriginal('order_status'));
        }
        foreach ($order->getDirty() as $key => $val) {
            $originals[$key] = $order->getOriginal($key);
        }
View python_md5.md
import hashlib

def file_md5(fname):
    hash_md5 = hashlib.md5()
    with open(fname, "rb") as f:
        for chunk in iter(lambda: f.read(4096), b""):
            hash_md5.update(chunk)
    return hash_md5.hexdigest()
@slow-is-fast
slow-is-fast / osx_install.sh
Created Oct 18, 2019 — forked from canering/osx_install.sh
Install most of my Apps with homebrew & cask
View osx_install.sh
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@slow-is-fast
slow-is-fast / gist:b3d6fba9218d36e318d116836035bb5f
Created Apr 26, 2019 — forked from andphe/gist:3232343
Export your links from Safari reading list
View gist:b3d6fba9218d36e318d116836035bb5f
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'
View exiftool.md
exiftool  "-CreateDate<FileModifyDate" "-DateTimeOriginal<FileModifyDate" "-ModifyDate<FileModifyDate" -overwrite_original .
View gist:3f57be7e1b1055fb300c3bb955f68649
pip install -U git+https://github.com/shadowsocks/shadowsocks.git@master
View keybind_like_emacs.js
[
/*============= Emacs Style =============*/
{ "keys": ["ctrl+b"], "command": "move", "args": {"by": "characters", "forward": false} },
{ "keys": ["ctrl+f"], "command": "move", "args": {"by": "characters", "forward": true} },
{ "keys": ["ctrl+p"], "command": "move", "args": {"by": "lines", "forward":
false} },
{ "keys": ["ctrl+n"], "command": "move", "args": {"by": "lines", "forward":
true} },
{ "keys": ["ctrl+a"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["ctrl+e"], "command": "move_to", "args": {"to": "eol", "extend": false} },
View removeEmoji.php
function removeEmoji($text)
{
$cleanText = "";
// Match Emoticons
$regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u';
$cleanText = preg_replace($regexEmoticons, '', $text);
// Match Miscellaneous Symbols and Pictographs
$regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u';