Skip to content

Instantly share code, notes, and snippets.

View duan-li's full-sized avatar

D Li duan-li

View GitHub Profile
@duan-li
duan-li / README.md
Created February 22, 2024 03:54 — forked from abelcallejo/README.md
Create bootable Linux USB using Mac

Creating bootable Linux USB using Mac

mac

CentOS, Ubuntu, Slackware, etc. Whatever Linux-based OS it is, you can create a bootable USB for it by using a Mac.

1. Prepare the .iso file

Download it, copy it, whatever it takes to prepare that Linux-based OS .iso file

2. Convert the .iso file into a .img.dmg

@duan-li
duan-li / 1-setup.md
Last active February 4, 2024 12:39 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS

Methods of Signing with a GPG Key on MacOS

Last updated September 21, 2022

This Gist explains how to do this using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

There has been a number of comments on this gist regarding some issues around the pinentry-program and M1 Macs. I've finally gotten a chance to try things out on an M1 and I've updated the documentation in 2-using-gpg.md to reflect my findings.

@duan-li
duan-li / work-with-multiple-github-accounts.md
Created January 2, 2024 04:19 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@duan-li
duan-li / colors.go
Created December 4, 2022 22:33 — forked from ik5/colors.go
Simple golang expirement with ANSI colors
package main
// http://play.golang.org/p/jZ5pa944O1 <- will not display the colors
import "fmt"
const (
InfoColor = "\033[1;34m%s\033[0m"
NoticeColor = "\033[1;36m%s\033[0m"
WarningColor = "\033[1;33m%s\033[0m"
ErrorColor = "\033[1;31m%s\033[0m"
DebugColor = "\033[0;36m%s\033[0m"
@duan-li
duan-li / minikube-ingress.yaml
Last active March 30, 2022 12:12
minikube local dev ingress example
# ref https://k8s.io/examples/service/networking/example-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: local-dev-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- host: dev.test
@duan-li
duan-li / php-5.6.ini
Created November 27, 2018 23:16
default ini file
[PHP]
;;;;;;;;;;;
; WARNING ;
;;;;;;;;;;;
; This is the default settings file for new PHP installations.
; By default, PHP installs itself with a configuration suitable for
; development purposes, and NOT for production purposes.
; For several security-oriented considerations that should be taken
; before going online with your site, please consult php.ini-recommended
@duan-li
duan-li / AR_Cache_Repository.php
Created August 26, 2018 13:02 — forked from guiwoda/AR_Cache_Repository.php
AR (Eloquent) vs DM (Doctrine) gist
<?php
namespace App\ActiveRecord;
class PostRepository
{
private $cache;
public function __construct(Cache $cache)
{
// Any set() / get() cache implementation.
@duan-li
duan-li / migration.php
Created February 5, 2018 05:49
basic database migration for a simple laravel project
<?php
// up users
$table = 'users';
if (!Schema::hasTable($table)) {
Schema::create($table, function (Blueprint $table) {
$table->increments('id');
$table->string('display_name');
@duan-li
duan-li / middleware.php
Last active January 18, 2018 05:45
Correct way to test laravel middleware
<?php
namespace App\Http\Middleware;
use Closure;
class Sample
{
/**
* Handle an incoming request.
@duan-li
duan-li / text_editor
Created October 10, 2017 02:33
make chrome like text editor
data:text/html, <html contenteditable>