Skip to content

Instantly share code, notes, and snippets.

@jackyshan
jackyshan / sendmail.py
Created December 6, 2016 03:30
python批量发送邮件
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import urllib2, time, string, random
email = ''
title = raw_input("输入邮件标题:")
if len(title) <= 0:
title = '标题'
@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