Skip to content

Instantly share code, notes, and snippets.

View AwayQu's full-sized avatar
🌊
langlanglang

文档工程师 AwayQu

🌊
langlanglang
View GitHub Profile
@AwayQu
AwayQu / logging_subprocess.py
Created September 27, 2017 03:13 — forked from bgreenlee/logging_subprocess.py
Variant of subprocess.call that accepts a logger instead of stdout/stderr #python
import subprocess
import select
from logging import DEBUG, ERROR
def call(popenargs, logger, stdout_log_level=DEBUG, stderr_log_level=ERROR, **kwargs):
"""
Variant of subprocess.call that accepts a logger instead of stdout/stderr,
and logs stdout messages via logger.debug and stderr messages via
logger.error.
@AwayQu
AwayQu / logging_subprocess.py
Created September 27, 2017 03:13 — forked from bgreenlee/logging_subprocess.py
Variant of subprocess.call that accepts a logger instead of stdout/stderr #python
import subprocess
import select
from logging import DEBUG, ERROR
def call(popenargs, logger, stdout_log_level=DEBUG, stderr_log_level=ERROR, **kwargs):
"""
Variant of subprocess.call that accepts a logger instead of stdout/stderr,
and logs stdout messages via logger.debug and stderr messages via
logger.error.
@AwayQu
AwayQu / convert_model.py
Created April 8, 2018 08:12 — forked from boaerosuke/convert_model.py
Using coremltools to convert a Keras model into mlmodel for iOS
import coremltools
import numpy
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.utils import np_utils
from keras.models import load_model
@AwayQu
AwayQu / convert_keras.py
Last active April 14, 2019 05:01
Update by Death Gist
import coremltools
output_labels = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'X']
scale = 1/255.
coreml_model = coremltools.converters.keras.convert('./KGNetCNN.h5',
input_names='image',
image_input_names='image',
output_names='output',
class_labels=output_labels,
@AwayQu
AwayQu / change png alpha
Last active April 14, 2019 06:01
Update by Death Gist
convert input.png -alpha off output.png
find . -name "*.png" -exec convert "{}" -alpha off "{}" \;
convert input.png -channel A -threshold 254 output.png
mkdir batch
FOR %G IN (*.png) DO convert %G -channel A -threshold 254 batch\%G
# color space
convert app_icon.jpg -colorspace sRGB -type truecolor result.jpg

How to Download iOS Simulator (Xcode) in Command Line and Install it

For faster connection speed and more flexibility.

Steps

  1. Start Xcode in command line by running this in commandline /Applications/Xcode.app/Contents/MacOS/Xcode
  2. Start downloading of the simulator
  3. Cancel it. YES CANCEL IT!
  4. You will get a message like this:
@AwayQu
AwayQu / NSBezierPath+cgPath.swift
Created November 26, 2018 14:12 — forked from juliensagot/NSBezierPath+cgPath.swift
Convert NSBezierPath to CGPath (Swift 4, Xcode 9.2)
extension NSBezierPath {
var cgPath: CGPath {
get { return self.transformToCGPath() }
}
/// Transforms the NSBezierPath into a CGPath
///
/// :returns: The transformed NSBezierPath
private func transformToCGPath() -> CGPath {
@AwayQu
AwayQu / DDTTYLogger.m
Last active April 13, 2019 11:58
Update by Death Gist
// Software License Agreement (BSD License)
//
// Copyright (c) 2010-2018, Deusty, LLC
// All rights reserved.
//
// Redistribution and use of this software in source and binary forms,
// with or without modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
@AwayQu
AwayQu / tcpdump.sh
Last active April 13, 2019 17:09
Update by Death Gist
tcpdump -iany -X -s0 -nn port 9528
telnet 10.0.13.22 9528
telnet 10.0.13.22 9528
@AwayQu
AwayQu / dropa
Last active April 13, 2019 17:19
Update by Death Gist
https://juejin.im/?utm_source=gold_browser_extension