Skip to content

Instantly share code, notes, and snippets.

View neatlife's full-sized avatar
😀
Out sick

neatlife

😀
Out sick
View GitHub Profile
@neatlife
neatlife / es1
Created June 30, 2020 10:14
es api usage
{
"query": {
"bool": {
"must": [
{
"match_all": {}
},
{
"match_phrase": {
"send_type": {
@echo off
Title Converter Office 2016 Retail to Volume
echo Press Enter to start VL-Conversion...
echo.
pause
echo.
for /f "tokens=6 delims=[]. " %%G in ('ver') do set win=%%G
@neatlife
neatlife / vim-swift-setup.sh
Created May 7, 2020 08:30 — forked from mgrider/vim-swift-setup.sh
Swift syntax highlighting for Vim
# Swift syntax highlighting for Vim
# Original Source: http://wingsquare.com/blog/swift-script-syntax-highlighting-and-indentation-for-vim-text-editor/
# Another helpful article: https://billyto.github.io/blog/swift-syntax-vim
# More about Vim packages: http://vimcasts.org/episodes/packages/
echo "--- creating ~/.vim/pack/bundle/start dir.."
mkdir -p ~/.vim/pack/bundle/start
echo "--- Cloning Apple's Swift repo.."
@neatlife
neatlife / epochms
Created May 7, 2020 03:10
c get current second
static long long epochms(void)
{
struct timespec tv;
clock_gettime(CLOCK_REALTIME, &tv);
return tv.tv_sec;
}
@neatlife
neatlife / AppDelegate.swift
Created May 5, 2020 02:13
关闭macos最后一个窗口退出应用
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}
@neatlife
neatlife / osx-vnc-hidden-options.md
Created January 27, 2020 02:47 — forked from jabenninghoff/osx-vnc-hidden-options.md
RemoteManagement "hidden" options

macOS Sierra (and possibly earlier) has some "hidden" screen sharing options:

If you're connecting to VNC using ssh tunneling, you can force macOS to listen only on localhost:

sudo defaults write /Library/Preferences/com.apple.RemoteManagement.plist VNCOnlyLocalConnections -bool yes

In newer versions of macOS, screen sharing will automatically re-lock the screen when you disconnect if it was locked when you first connected. To change this behavior, use:

sudo defaults write /Library/Preferences/com.apple.RemoteManagement RestoreMachineState -bool NO

restart_vmware() {
sudo /etc/init.d/vmware-tools stop
sudo /etc/init.d/vmware-tools start
}
[xdebug]
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=0.0.0.0
xdebug.remote_port=9000
xdebug.idekey=VIM
@neatlife
neatlife / php convert object to array
Last active December 12, 2017 14:48
php convert object to array
```php
function varDumper($vars)
{
$results = [];
if (is_array($vars)) {
foreach($vars as $key => $var) {
$keyPrefix = '';
if (is_object($var)) {
$keyPrefix = get_class($var);
}
@neatlife
neatlife / codesign_gdb.md
Created November 7, 2017 01:21 — forked from hlissner/codesign_gdb.md
Codesign gdb on OSX

Note: these instructions are for pre-Sierra MacOS. Sierra Users: see https://gist.github.com/gravitylow/fb595186ce6068537a6e9da6d8b5b96d by @gravitylow.

If you are getting this in gdb on OSX while trying to run a program:

Unable to find Mach task port for process-id 57573: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
  1. Open Keychain Access