Skip to content

Instantly share code, notes, and snippets.

View Ghost-VR's full-sized avatar
😫

Michael Yang Ghost-VR

😫
  • Apple Inc.
  • Santa Clara, CA
View GitHub Profile
@coffeenotfound
coffeenotfound / h.code-snippets
Created September 21, 2018 11:31
Visual Studio Code C Include Guard Snippet
{
"Add include guard": {
"prefix": "guard",
"description": "Adds an ifndef include guard to a C header",
"body": [
"#ifndef __${TM_FILENAME/^([^\\.]*)\\..*$/${1:/upcase}/}_${TM_FILENAME/^.*\\.([^\\.]*)$/${1:/upcase}/}__",
"#define __${TM_FILENAME/^([^\\.]*)\\..*$/${1:/upcase}/}_${TM_FILENAME/^.*\\.([^\\.]*)$/${1:/upcase}/}__",
"",
"$0",
"",
@4Kaylum
4Kaylum / DiscordPy Tutorial.md
Last active June 4, 2024 06:00
A simple bot tutorial for Discord.py

Writing a Discord bot with Discord.py

Hey one, hey all, and welcome to a basic Discord bot writing tutorial. This is a basic tutorial that doesn't cover coding in general, but rather how to work with the Discord.py (v1.0.0a) library and how to write a simple bot with it. General help can be found on the Discord API guild and in the documentation.

This tutorial assumes some prior knowledge of programming, and assumes you already have Python3.5 (and Pip) or later installed and added to your PATH.

With that, let's get to it.

Installation

@mivade
mivade / cli.py
Last active January 18, 2024 07:51
Using a decorator to simplify subcommand creation with argparse
"""This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@Zearin
Zearin / python_decorator_guide.md
Last active July 18, 2024 00:10
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

测试平台:DigitalOcean VPS ubuntu14.04 x64, strongswan5.2.2

运行以下命令请使用root权限

一:安装strongswan

由于ubuntu软件仓库中strongswan版本较低,因此从官网源码编译安装

apt-get install build-essential     #编译环境
aptitude install libgmp10 libgmp3-dev libssl-dev pkg-config libpcsclite-dev libpam0g-dev     #编译所需要的软件