Skip to content

Instantly share code, notes, and snippets.

View lovelock's full-sized avatar
🏠
Working from home

Frost Wong lovelock

🏠
Working from home
  • http://www.weibo.com
  • Beijing, China
View GitHub Profile
@lovelock
lovelock / cloudSettings
Last active December 15, 2021 09:14
vscode sync
{"lastUpload":"2021-12-15T09:14:28.257Z","extensionVersion":"v3.4.3"}
@lovelock
lovelock / config
Created July 3, 2020 04:31
系统初始化需要的一些备忘录
# .ssh/config
Host *
ControlMaster auto
ControlPath ~/.ssh/master-socket/%r@%h:%p
ControlPersist 3s
@lovelock
lovelock / DroolsConfig.java
Last active July 12, 2020 13:56
This is compatible with drools 7.x, InEvaluator is not necessary because it is memberOfEvaluator. drools extension for collection operator, including `in`, `not in`, `intersectWith` and `not intersectWith`
import lombok.extern.slf4j.Slf4j;
import org.kie.api.KieServices;
import org.kie.internal.utils.KieHelper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
@Slf4j
@Profile("console")
@lovelock
lovelock / install-tmux.sh
Created November 28, 2019 03:13 — forked from pokev25/install-tmux.sh
Install tmux 2.8 on centos 7
# Install tmux 2.8 on Centos
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -LOk https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar -xf libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
./configure --prefix=/usr/local
@lovelock
lovelock / regex
Created October 30, 2018 10:22
匹配URL
(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]
@lovelock
lovelock / unicode_decode_utf16.php
Last active October 9, 2018 03:12
convert unicode characters to utf8
<?php
$str = preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function ($match) {
if ($match) {
return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UTF-16BE');
}
}, $str);
@lovelock
lovelock / main.c
Created August 21, 2018 14:06
describe pointers and const's
#include <stdio.h>
int main()
{
/*
* int const p = 20; // p is a const int
* printf("p = %d\n", p);
*/
/*
@lovelock
lovelock / mb_strrev.php
Created June 22, 2018 08:22
reverse multibyte strings in PHP
<?php
// http://kvz.io/blog/2012/10/09/reverse-a-multibyte-string-in-php/
function mb_strrev ($string, $encoding = null) {
if ($encoding === null) {
$encoding = mb_detect_encoding($string);
}
$length = mb_strlen($string, $encoding);
$reversed = '';
@lovelock
lovelock / wkhtmltopdf.css
Created December 28, 2017 14:31
css to solve wkhtmltopdf long and wide table
thead {
display: table-row-group;
}
.markdown-body table {
overflow: hidden !important;
word-wrap: break-word !important;
word-break: break-all;
}
.markdown-body td {
min-width: 80px;
@lovelock
lovelock / tailf.c
Created September 1, 2017 14:50
tailf command
/*
* tailf.c -- tail a log file and then follow it
* Created: Tue Jan 9 15:49:21 1996 by [email protected]
* Copyright 1996, 2003 Rickard E. Faith ([email protected])
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the