This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mcxiaoke.next.utils; | |
import android.annotation.SuppressLint; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.net.Proxy; | |
import android.os.Build; | |
import android.os.Parcelable; | |
import android.util.ArrayMap; | |
import android.util.Log; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int X_MAX = 412; | |
int Y_MAX = 50; | |
int x, y; | |
x = random.nextInt(X_MAX); | |
y = random.nextInt(Y_MAX); | |
// String htmlEventJs = "var ev = document.createEvent(\"HTMLEvents\"); " + | |
// "var el = document.elementFromPoint(%d,%d); " + | |
// "ev.initEvent('click',true,true);" + | |
// " el.dispatchEvent(ev);"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WEBGL_RENDERERS = ['ANGLE (NVIDIA Quadro 2000M Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (NVIDIA Quadro K420 Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (NVIDIA Quadro 2000M Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (NVIDIA Quadro K2000M Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Family Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (ATI Radeon HD 3800 Series Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics 4000 Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (Intel(R) HD Graphics 4000 Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (AMD Radeon R9 200 Series Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Family Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Family Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics 4000 Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics 3000 Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Mobile Intel(R) 4 Seri |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Sidekiq auto start using systemd unit file for Ubuntu 16.04 | |
# | |
# Put this in /lib/systemd/system (Ubuntu). | |
# Run: | |
# 1. systemctl enable sidekiq (to enable sidekiq service) | |
# 2. systemctl {start,stop,restart} sidekiq (to start sidekiq service) | |
# | |
# This file corresponds to a single Sidekiq process. Add multiple copies | |
# to run multiple processes (sidekiq-1, sidekiq-2, etc). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pid_full = '/tmp/my_daemon.pid' | |
def run | |
EM.run{ | |
Signal.trap('INT') { stop } | |
Signal.trap('TERM'){ stop } | |
# your daemon code runs here. This will not exit since it is running in EM | |
} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' # Sockets are in standard library | |
server = TCPServer.new(1234) | |
begin | |
while connection = server.accept | |
while line = connection.gets | |
break if line =~ /quit/ | |
puts line | |
connection.puts "Received!\n" | |
end |