Skip to content

Instantly share code, notes, and snippets.

View jinhucheung's full-sized avatar
🏗️
Building

jim jinhucheung

🏗️
Building
View GitHub Profile
@probonopd
probonopd / Wayland.md
Last active May 9, 2024 08:31
Think twice about Wayland. It breaks everything!

Think twice before abandoning Xorg. Wayland breaks everything!

Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.

Wayland proponents make it seem like Wayland is "the successor" of Xorg, when in fact it is not. It is merely an incompatible alternative, and not even one that has (nor wants to have) feature parity (missing features). And unlike X11 (the X Window System), Wayland protocol designers actively avoid the concept of "windows" (making up incompr

@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@akillcool
akillcool / clash.service
Last active April 19, 2024 12:27
clash auto start and update subcribe configuration
# edit and save this file to /usr/lib/systemd/system/clash.service
[Unit]
Description=clash
After=network.target
[Service]
WorkingDirectory="your home directory"/.config/clash
ExecStart="your home directory"/.config/clash/start-clash.sh
ExecStop="your home directory"/.config/clash/stop-clash.sh
Environment="HOME=your home directory"
@huacnlee
huacnlee / dingtalk-qrcode-login.rb
Last active August 1, 2021 10:12
实现钉钉扫描登录 Ruby
# 实现钉钉扫描登录
#
# 从钉钉 “移动应用接入 - 扫码登录” 开通,并获得 app_id 和 app_secret
# 开通:https://open-dev.dingtalk.com/#/loginMan
#
# 这个流程只能实现简单登录,拿到用户 nick,dingId, openid, unionid
# 文档:https://ding-doc.dingtalk.com/doc#/serverapi2/etaarr
require "openssl"
require "base64"
require "faraday"
@fuyuanli
fuyuanli / cloudflare-pve-acme.sh
Last active January 20, 2024 05:43
acme.sh + Proxmox VE
# CloudFlare API
#
# Please install "acme.sh" before runnung this script.
# curl https://get.acme.sh/ | sh
#
export CF_Email="Your_CloudFlare_Account@example.com"
export CF_Key="Your_CloudFlare_API_Key"
/root/.acme.sh/acme.sh --issue \
-d $DOMAIN \
@db0sch
db0sch / regenerate_credentials.md
Last active October 31, 2023 20:30
How to regenerate the master key for Rails 5.2 credentials

If your master.key has been compromised, you might want to regenerate it.

No key regeneration feature at the moment. We have to do it manually.

  1. Copy content of original credentials rails credentials:show somewhere temporarily.
  2. Remove config/master.key and config/credentials.yml.enc
  3. Run EDITOR=vim rails credentials:edit in the terminal: This command will create a new master.key and credentials.yml.enc if they do not exist.
  4. Paste the original credentials you copied (step 1) in the new credentials file (and save + quit vim)
  5. Add and Commit the file config/credentials.yml.enc
@HugoPoi
HugoPoi / Resize virtual machine partition.md
Last active May 4, 2024 01:46
How to resize virtual machine partition after extend the disk

Resize a VM system disk

Introduction

  • You have a VM with small disk
  • You have GPT partition table
  • You NOT USE LVM (you should)
  • You need to extend a partition on the main drive
  • You use Debian 8.x aka Jessie

Extend the disk

@MauricioMoraes
MauricioMoraes / access_postgresql_with_docker.md
Last active May 2, 2024 10:21
Allow Docker Container Access to Host's Postgres Database on linux (ubuntu)

You have to do 2 things in order to allow your container to access your host's postgresql database

  1. Make your postgresql listen to an external ip address
  2. Let this client ip (your docker container) access your postgresql database with a given user

Obs: By "Host" here I mean "the server where docker is running on".

Make your postgresql listen to an external ip address

Find your postgresql.conf (in case you don't know where it is)

$ sudo find / -type f -name postgresql.conf

@480
480 / gist:3b41f449686a089f34edb45d00672f28
Last active May 6, 2024 19:52
MacOS X + oh my zsh + powerline fonts + visual studio code terminal settings

MacOS X + oh my zsh + powerline fonts + visual studio code (vscode) terminal settings

Thank you everybody, Your comments makes it better

Install oh my zsh

http://ohmyz.sh/

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@nielsutrecht
nielsutrecht / RsaExample.java
Created December 28, 2016 14:13
Example of RSA generation, sign, verify, encryption, decryption and keystores in Java
import javax.crypto.Cipher;
import java.io.InputStream;
import java.security.*;
import java.util.Base64;
import static java.nio.charset.StandardCharsets.UTF_8;
public class RsaExample {
public static KeyPair generateKeyPair() throws Exception {
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");