Skip to content

Instantly share code, notes, and snippets.

@wangsha
wangsha / outdated-package-test.cfg
Created October 9, 2017 08:06
Monit script auto check and update packages
check program outdated-package-test with path "/usr/bin/apt-get -u upgrade --assume-no"
if status != 0 then exec "DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -y -o DPkg::options::='--force-confdef' -o DPkg::options::='--force-confold' install grub-pc"
if status != 0 for 2 cycles then exec "/usr/bin/apt-get upgrade -y --force-yes -qq"
if status != 0 for 5 cycles then alert
@wangsha
wangsha / release.sh
Last active November 14, 2022 18:30
Automatic create release from master branch for python package.
#!/bin/bash
# create release from master branch
# v1.0.0, v1.5.2, etc.
versionLabel=$(grep -i '^__version__ = ' setup.py | cut -d "'" -f2)
# establish branch and tag name variables
import java.io.IOException;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
/**
* Created by sha on 23/1/16.
*/
public class CookieRedirectInterceptor implements Interceptor {
@wangsha
wangsha / osx_chrome_insecure
Created November 16, 2014 06:21
osx run chrome in insecure mode
open -a Google\ Chrome --args --disable-web-security --allow-running-insecure-content
@wangsha
wangsha / Secure-NSUserDefaults.podspec
Created July 30, 2014 09:55
Secure-NSUserDefaults podspec
Pod::Spec.new do |s|
s.name = 'Secure-NSUserDefaults'
s.version = '1.0.0'
s.platform = :ios, '5.0'
s.license = 'MIT'
s.summary = 'View controller container, enabling you to present multiple controllers on top of one another. '
s.description = 'Secure NSUserDefaults allows you to protect your user defaults against unauthorized modifications on iOS and Mac OS X. You can also link user defaults to the machine they’ve been created on which makes plist sharing impossible. Please note that this implementation does not use encryption. It is therefore not suitable to store sensitive data.'
s.author = { 'Matthias Plappert' => '[email protected]' }
s.homepage = 'https://github.com/matthiasplappert/Secure-NSUserDefaults'
s.source = { :git => 'https://github.com/matthiasplappert/Secure-NSUserDefaults.git', :commit => "5501549d45a6aa0e027d64445ff8ad794dc4a485" }
@Test
public void networkRequestSchedulingSimulation() {
BehaviorSubject<String> syncResultSubject = BehaviorSubject.create("L0");
PublishSubject<Integer> syncRequestSubject = PublishSubject.create();
Observable<Input> syncResultInputSubject = syncResultSubject.toObservable().map(new Func1<String, Input>() {
@Override
public Input call(String integer) {
return Input.RESULT;
}
Pod::Spec.new do |s|
s.name = "Mantle"
s.version = "0.3.3"
s.summary = "Model framework for Cocoa and Cocoa Touch."
s.homepage = "https://github.com/MantleFramework/Mantle"
s.license = 'MIT'
s.author = { "GitHub" => "[email protected]" }
s.source = { :git => "https://github.com/MantleFramework/Mantle.git", :commit => "439be82a87e449f26abb2171df1d32c0c15f9e72" }