Skip to content

Instantly share code, notes, and snippets.

@gccpacman
gccpacman / linux mint让休眠功能工作.md
Last active October 9, 2015 08:20
linux mint/ Ubuntu/ Debian

Enable the Hibernate option

To enable Hibernate, I followed this answer from Dima. After enabling hibernate you will have an option to hibernate in the indicator session menu at top panel. But, though you can hibernate you may not resume from hibernate. You will just be given a new session. The fixes are below. The fixes to be able to resume from hibernate There is two way to fix this.

  1. Editing the /etc/initramfs-tools/conf.d/resume file First get the UUID of the swap partition.

sudo blkid | grep swap

@gccpacman
gccpacman / python_date.md
Last active October 9, 2015 08:20
Python 基础

How do I calculate number of days betwen two dates using Python?

If you have two date objects, you can just subtract them.

from datetime import date

d0 = date(2008, 8, 18)
d1 = date(2008, 9, 26)
delta = d0 - d1
print delta.days
@gccpacman
gccpacman / multiple_ssh_setting.md
Last active September 4, 2016 23:59 — forked from RichardBronosky/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@gccpacman
gccpacman / docker-https.md
Last active May 6, 2022 05:50
Protecting the Docker daemon Socket with HTTPS

#Protecting the Docker daemon Socket with HTTPS

HOST-IP:172.17.42.1 VM-IP:172.17.0.2

openssl genrsa -aes256 -out ca-key.pem 2048
openssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem ```Common Name:  172.17.42.1```
openssl genrsa -out server-key.pem 2048
openssl req -subj "/CN=172.17.42.1" -new -key server-key.pem -out server.csr

echo subjectAltName = IP:172.17.42.1, IP:172.17.0.2, IP:127.0.0.1 > extfile.cnf

@gccpacman
gccpacman / go_exercise.go
Last active August 29, 2015 14:13
A tour to go Exercise
/*
https://tour.golang.org/flowcontrol/8
http://go-tour-zh.appspot.com/flowcontrol/8
*/
/* Exercise: Loops and Functions #43 */
/* Exercise: Loops and Functions #43 */
package main
import (