Skip to content

Instantly share code, notes, and snippets.

@jackyshan
jackyshan / ping.sh
Created January 17, 2019 06:30
查找局域网ip列表
#!/bin/bash
loop=1
host="172.31.42."
while(( $loop<=254 ))
do
ip="$host$loop"
# echo $ip
let "loop++"
@jackyshan
jackyshan / mogno.sql
Created December 28, 2018 07:57
mongodb日常操作
//查找单个字段
db.users.find({_id:ObjectId("5c25b4fdc32ea0b85da2a3bc")}, {"address":1})
//更新数组
db.users.update({_id:ObjectId("5c25b504c32ea0b85da2a3bd")}, {$push:{address:ObjectId("5c25cf01c32ea0b85da2a3c8")}})
//一对多关系查询
var result = db.users.findOne({_id:ObjectId("5c25b504c32ea0b85da2a3bd")}, {"address":1})
db.address.find({_id:{$in:result["address"]}})
@jackyshan
jackyshan / promise.js
Created December 28, 2018 02:27
js实现promise,async,await
// async function helloAsync(){
// return "helloAsync";
// }
// console.log(helloAsync()) // Promise {<resolved>: "helloAsync"}
// helloAsync().then(v=>{
// console.log(v); // helloAsync
// })
@jackyshan
jackyshan / search.swift
Created August 20, 2018 15:28
Swift实现常用查找算法
//
// main.swift
// find
//
// Created by jackyshan on 2018/8/13.
// Copyright © 2018年 jackyshan. All rights reserved.
//
import Foundation
@jackyshan
jackyshan / sort.swift
Created August 10, 2018 07:15
Swift实现常用排序算法集合
//
// main.swift
// SortDemo
//
// Created by jackyshan on 2018/8/7.
// Copyright © 2018年 GCI. All rights reserved.
//
import Foundation
@jackyshan
jackyshan / AndroidLostLuggage.java
Created July 17, 2018 01:25
Android寻找行李
package com.baitrading.bes.ui;
import android.os.Bundle;
import android.text.InputType;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
//
// DZLuggageGuardViewController.swift
// DianZiCheng
//
// Created by jackyshan on 2018/3/10.
// Copyright © 2018年 jackyshan. All rights reserved.
//
import UIKit
@jackyshan
jackyshan / GciSound.swift
Last active July 16, 2018 02:58
播放声音
import UIKit
import AudioToolbox
open class GciSound: NSObject {
fileprivate var mSoundId = kSystemSoundID_Vibrate
var mAction:() -> Void = {}
public init(SystemFile sysfile:String) {
super.init()
let path = "/System/Library/Audio/UISounds/\(sysfile).caf"
@jackyshan
jackyshan / CheckWselfHelper.swift
Created January 20, 2018 07:06
写个简单的Swift检测Controller没有销毁的工具
//
// CheckWselfHelper.swift
// alliance
//
// Created by jackyshan on 2018/1/19.
// Copyright © 2018年 GCI. All rights reserved.
//
import Foundation
@jackyshan
jackyshan / http_proxy.sh
Created July 11, 2017 11:59
终端代理
给 iTerm 终端设置代理
1.设置代理
使用 curl,wget,brew等http应用程序会调用http_proxy和https_proxy这两环境变量进行代理,通过下面方式设置:
export http_proxy=http://127.0.0.1:8087
export https_proxy=$http_proxy
2.取消设置
unset http_proxy https_proxy