Skip to content

Instantly share code, notes, and snippets.

@Moln
Moln / git_add_ssh_key.md
Created March 29, 2017 10:35
Git add ssh key
  1. ssh-keygen -t rsa -C "memo"
  2. 在 gitlab 中添加 ssk-key 内容为 .ssh/id_rsa.pub 文件内容
  3. id_rsa 文件是被改名的, 要在 .ssh/config 中添加指向说明

指向说明示例:

Host 192.168.150.162
RSAAuthentication yes
IdentityFile ~/.ssh/gitlab_rsa
@Moln
Moln / gitlab_install.md
Last active March 5, 2018 09:14
Gitlab install

安装

参考地址:https://about.gitlab.com/downloads/

  1. 安装基础依赖服务
sudo yum install curl policycoreutils openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd
@Moln
Moln / swoole.ref.ide.php
Created December 15, 2016 07:31
Swoole IDE Helper (swoole 1.9.0)
<?php
namespace {
const SWOOLE_BASE = 4;
const SWOOLE_THREAD = 2;
const SWOOLE_PROCESS = 3;
const SWOOLE_IPC_UNSOCK = 1;
const SWOOLE_IPC_MSGQUEUE = 2;
const SWOOLE_IPC_PREEMPTIVE = 3;
const SWOOLE_SOCK_TCP = 1;
@Moln
Moln / ExportExtensionClasses.php
Created November 18, 2016 15:35
导出php扩展所有类,用于PHPStorm IDE 引用
<?php
$extName = 'ev';
$ref = new ReflectionExtension($extName);
$classes = $ref->getClasses();
$classTpl = <<<EOT
class %s {
%s
@Moln
Moln / swoole-to-psr7
Created September 2, 2016 11:08
swoole-to-psr7
<?php
use Zend\Diactoros\ServerRequest;
use Zend\Diactoros\ServerRequestFactory;
use Zend\Http\Request;
$http = new swoole_http_server("0.0.0.0", 9501);
$rootServerConfigs = array(
'DOCUMENT_ROOT' => __DIR__,
);
@Moln
Moln / ToTreeData.js
Last active July 10, 2024 07:09
数据表 转树型格式
function toTreeData(rows, key = 'role_id', childKey = 'items', dataMapCallable = null)
{
var rootId = 0;
var data = {0 : { [childKey]: [] } };
rows.forEach(function (row) {
if (!data[row[key]]) {
data[row[key]] = { [childKey]: [] };
}
@Moln
Moln / MarkdownTableFormat.php
Last active March 28, 2016 06:59
Markdown table format
<?php
$a = <<<EOT
Markdown table content
EOT;
$a = explode("\n", $a);
$c = "";
$ll = [];
foreach ($a as &$aa) {
@Moln
Moln / GeneralMarkdown.php
Last active August 29, 2015 14:24
数据表结构, 导出 markdown 格式
<?php
$dsn = 'mysql:dbname=test;host=192.168.66.49';
$user = 'root';
$password = '';
try {
$dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
@Moln
Moln / telnet.php
Created April 5, 2015 04:18
PHP telnet client
<?php
if ( array_key_exists(1, $argv) ){
$cfgServer = $argv[1];
} else {
echo "ex: 'php test.php 10.0.0.0 [port]' \n";
exit;
}
$cfgPort = isset($argv[2]) ? $argv[2] : 23; //port, 22 if SSH
@Moln
Moln / HexConvert.php
Last active June 2, 2017 01:43
16进制, 32进制, 64进制转换
<?php
/**
* HexConvert, 16进制, 32进制, 64进制转换
*
* @author xiemaomao520@163.com
*
* @example
* <code>
* echo HexConvert::hexc32('FF'); //7v