Skip to content

Instantly share code, notes, and snippets.

Stepping forward

Bing-Sheng Chen gundamew

Stepping forward
Block or report user

Report or block gundamew

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
gundamew / helper.php
Last active Sep 27, 2019
Simple helpers to run tasks before/until the deadline.
View helper.php
if (! function_exists('stop_before')) {
function stop_before(callable $func, DateTimeInterface $dt)
$tz = $dt->getTimezone();
$now = new DateTime('now', $tz);
if ($now > $dt) {
gundamew /
Created Mar 6, 2019
Checkout GitLab merge request locally.
#!/usr/bin/env bash
set -euo pipefail
# Ref:
# *
# *
test -z $1 && echo "Merge request number required." 1>&2 && exit 1
git fetch ${2:-origin} merge-requests/$1/head:mr-$1 && git checkout mr-$1
gundamew /
Created Sep 1, 2018
Script to update Homebrew and Composer packages.
#!/usr/bin/env bash
set -euo pipefail
echo "Updating Homebrew..."
brew update && brew upgrade && brew cleanup
echo "Updating Composer..."
composer self-update --clean-backups && composer g update && composer g dump-autoload
#composer g clear-cache
gundamew /
Created Aug 16, 2018
Stop , remove, and rebuild Docker containers.
#!/usr/bin/env bash
set -euo pipefail
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi $(docker images --format "{{.Repository}}" | grep 'bsdock')
[[ -f "$PWD/docker-compose.yml" ]] && docker-compose up -d --build
gundamew / OpensslAes256.php
Last active Jun 1, 2016
An AES encryption implementation in PHP with OpenSSL module.
View OpensslAes256.php
// Set cipher method
$cipherMethod = 'AES-256-CBC';
// Set encryption key
// The key length must be 256 bits long
$key = (empty($key)) ? openssl_random_pseudo_bytes(32) : '...';
// Set initialization vector
$iv = (empty($iv)) ? openssl_random_pseudo_bytes(openssl_cipher_iv_length($cipherMethod)) : '...';
gundamew / McryptAes256.php
Last active Jun 13, 2016
An AES encryption implementation in PHP with Mcrypt module.
View McryptAes256.php
* An AES encryption implementation in PHP with Mcrypt module.
* Key length is 256, CBC mode, and use PKCS#7 padding.
* Example:
* $aes = new McryptAes256;
* $encryptedString = $aes->encrypt($rawString);
* $decryptedString = $aes->decrypt($encryptedString);
View gist:8416349
如果你知道有一個人他拿一個大家常在用的軟體來當作己網路 ID
比如說把自己叫 Photoshop、把自己叫 Windows 或是把自己叫 Angry Bird
大家好我是 PCMan
就是裝在你電腦你桌面上那個可以上 BBS 的電腦軟體 PCMan


本文修改自:The Unfollow Manifesto

At some point in the past, I've decided to follow you on Twitter or any other social network, because you appeared to be a person whose postings I might be interested in.

我曾經覺得你寫的某些東西很有意思,因此決定在 Twitter,或其他社交網路上追蹤你的狀態。

But recently you noticed me unfollowing you.

You can’t perform that action at this time.