postman stuff

save result in the env variables. add the following in the Tests tab

var jsonData = pm.response.json();
pm.environment.set("aliyunnlsrequestbody", JSON.stringify(jsonData));

load env var, add in the body tab

{{aliyunnlsrequestbody}}

{
"productid":"f2c57f0f2bbc4b1f8824b3561d46f50a",
"token":{{wxtoken}}
}

微信H5调用流程

  1. https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxce4cf9e541529a96&redirect_uri=http%3A%2F%2Fhangzhou.qixiangshaonian.com%2Fwxgzh%2Foauth&response_type=code&scope=snsapi_userinfo&state=thisisastateobjectlalala&connect_redirect=1#wechat_redirect   这里服务器可以得到openid返回客户端。客户端记住。
  2. 是否会需要购买?
  3. http://{{host}}/user/auth post   {
    “productid”:”f2c57f0f2bbc4b1f8824b3561d46f50a”,
    “unionid”:”odG1y52PYElXeYXMuQY8je22d50E”,
    “token”:{{wxtoken}}
    }   这里要么productid和unionid,要么用token。  token是产品授权后的产物。
  4. http://{{host}}/user/product   post {
    “productid”:”f2c57f0f2bbc4b1f8824b3561d46f50a”,
    “token”:{{wxtoken}}
    }  这里可以得到最终用户侧的产品json
  5. 数据埋点等等

vue 背景按钮绝对定位

<div style=”position: relative; width: 100%;”>
<img style=”position: absolute; left: 41%; top: 3%; -webkit-transform: translate(-50%,-50%); width: 10%;” src=”../assets/logo.png” />
<img style=”width: 100%;” src=”../assets/bg.jpg” /></div>

windows openssh installation

– download from github, don’t install as a windows feature, that build never gets updates
https://github.com/PowerShell/Win32-OpenSSH/releases

– extract to c:\program files\openssh and then add that folder to env path

done

monitor ss

import socket
import re
import MySQLdb
import os
import json

#remove old socket file
try:
os.remove(“/tmp/client.sock”)
except:
pass

#connect to ssserver
cli = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
cli.bind(‘/tmp/client.sock’) # address of the client
cli.connect(‘/var/run/shadowsocks-manager.sock’) # address of Shadowsocks manager
#send a ping command
cli.send(b’ping’)
print(cli.recv(1506)) # You’ll receive ‘pong’
#open db
db = MySQLdb.connect(host=”localhost”, # your host, usually localhost
user=”root”, # your username
passwd=”zhoujing”, # your password
db=”ssstats”) # name of the data base
db.autocommit(1)
#create a Cursor object.
cur = db.cursor()
#make a loop that get the stats from the ssserver
while True:
ss = cli.recv(1506)
print ss
#using regex to extract what we want
m = re.search(‘stat: ({.+})’,ss)
jobj = json.loads(m.group(1))
for key,value in jobj.iteritems():
cur.execute(“insert into ssstats (port,data_transferred)”\
+” values (%s,%s)”,(int(key),int(value)/1024))

cur.close()
db.close()

FreePBX with Asterisk and sccp stuff

Download and install FreePBX, the recommended version is 13

Install everything

Install tftp server

yum install tftp tftp-server xinetd

download and put everythink into the tftp server root
wget -c https://github.com/Omid-Mohajerani/SCCP-Asterisk/blob/master/7937.tar.gz?raw=true
tar -xvf 7937.tar.gz -C /var/lib/tftpboot/
/var/lib/tftpboot/

if there’s a folder, make sure move everything to the root folder

systemctl restart tftp

try verify tftp works
tftp 192.168.x.x
get source_filename target_filename

if not, check permission, chmod 777 -R tftpboot

Install and setup DHCP
yum -y install dhcp
vim /etc/dhcp/dhcpd.conf

subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.19;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.1.19;
range 192.168.1.25 192.168.1.30;
}
host cisco001 {
option routers 192.168.1.19;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.1.19;
option tftp-server-name “192.168.1.19”;
hardware ethernet 00:04:F2:EE:04:D1;
fixed-address 192.168.1.20;
}
host testpc{
option routers 192.168.1.19;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.1.19;
option tftp-server-name “192.168.1.19”;
hardware ethernet 1C:B7:2C:27:B7:7B;
fixed-address 192.168.1.21;
}

Reboot dhcpd

systemctl restart dhcpd

Use browser to access http://192.168.1.19 activate and go to “Admin/System Admin/Intrusion detection” add your workstation IP to the whitelist

Build sccp module
reference: https://github.com/Omid-Mohajerani/SCCP-Asterisk/wiki/Installing-CHAN-SCCP-in-Asterisk

1 – Download and install Chan-SCCP.

cd /usr/src/
git clone https://github.com/chan-sccp/chan-sccp chan-sccp_master
cd chan-sccp_master
./configure --enable-conference
make -j2
make install

2 – Unload skinny module and load SCCP module.

vim /etc/asterisk/modules.conf
 noload=chan_skinny.so
 load=chan_sccp.so

3 – copy sample files to asterisk folder.

cp sccp.conf.freepbx /etc/asterisk/sccp.conf
cp sccp_extensions.conf.freepbx /etc/asterisk/sccp_extensions.conf
cp sccp_hardware.conf.freepbx /etc/asterisk/sccp_hardware.conf

Modify sccp, sccp_hardware and sccp_extensions

in /etc/asterisk/ folder
Everytime after modify, type following command to reload asterisk.

asterisk -r
core restart now

You will see device immediately reload and read new sccp config. if error, you will see “default tftp” or something alike.

Check device connection
from the asterisk server try to ping device ip, if it can’t ping thru, mostly you sill see it stuck at VLAN config on the LCD. Hit Globe key and go to network config and you will see there’s no IP assigned. You can reboot or try to fix dhcp config.

If you can ping to device, check sccp.conf, sccp_hardware.conf
Make sure you have

– Correct MAC address as SEPMACMACMAC in sccp_hardware.conf.
– Allow IP in sccp_hardware
– Allow internal (all private ip range) in sccp.conf
– Correct extension, sccp doesn’t need password.

Use browser to create a new extension.
Application/Extensions
Add extension/add new custom extension
Fill only 2 fields are important. Use default setting for the rest.
User extension: xxxx (1002 for example) 分机号,
Advanced Tab/Dial: SCCP/xxxx (SCCP/1002 for example)

submit and hit Apply Config button (top right)

Cisco 7937 operations

  • factory reset: Global Key (no LCD response) and enter **1 (should see reset icon)
  • unlock: Global Key and **#
  • Global Key is top left button on the left side of the dials (1,2,3, etc)
  • /etc/asterisk folder, sccp.conf add externhost = public domain name (sip.example.com)
    /etc/asterisk/sccp_hardware.conf add nat=on
    Polycom IP 7000

Polycom IP 7000

  • factory reset: connect poe to boot, immediately hold keys (1,3,5,7), until LCD shows enter sequence to reset, the sequence is the mac address. Also you’ll have to enter those blindly, the LCD shows **** only when you do.
  • Address is sip server domain name or public static IP, all other fields are ext number (1003), password is ext password.

NAT troubleshooting

  • Router port forward TCP: 5060, 5160, 2000(sccp)  and UDP 10000-20000, disable SIP passthrough or SIP ALG
  • Asterisk/FreePBX Asterisk SIP setting, add NAT public domain name + local network (auto detect)

Game Dev Tycoon

RPGs are
0/100/100, 100/100/50, 100/100/50
Adventure.
0/100/100, 100/50/0, 100/50/0.

action, strategy and sim
100/50/0, 0/50/100, 0/100/50

casual
0/100/0, 0/100/0, 0/100/50

So, this is how to get through the beginning of the game:

1. You make your custom engine, Use 2D graphics v1 and use Basic Sound feature.

2. Begin the game with developing a Sports Action. Set sliders to 100/50/0, 0/50/100, 0/100/50 on Stages 1, 2 and 3 respectively.

3. Next develop Military Strategy, Medieval Strategy. Slider settings are the same – 100/50/0, 0/50/100, 0/100/50.

4. You should now have about 45 research points, do some contract work, get over 100K cash, then you should have enough research points to begin researching Custom Engine. If you do not then develop next game and then you will have it. If you have – research Custom Engine, then create your first custom engine, enabling only 2D Graphics v2 feature.

5. After creating custom engine you will have enough to research Racing – do that.

6. From now on use 2D Graphics v2, but do not use any other features (Not even basic sound).

7. Develop Space Sim, Racing Sim. Slider settings are the same – 100/50/0, 0/50/100, 0/100/50.

8. Research Fantasy.

9. Develop Fantasy Adventure. Slider settings are 0/100/100, 100/50/0, 100/50/0.

10. From now on you’ll develop RPGs mostly. Slider settings for RPGs are 0/100/100, 100/100/50, 100/100/100. You can do Fantasy and Medieval RPGs one after another. Make sure to never develop same Topic/Genre in a row, but aside from that, you can do Fantasy/RPG -> Medieval/RPG -> Fantasy/RPG -> Medieval/RPG and the likes with no problem. If you want to develop something else, you can do Adventures (but they are a bit harder to get the balance right). Do not do any more research in the garage.

11. You should transition to the office when you

have at least 2M in bank (or 1.5M and a game that just started selling)
have 3D Graphics v1 research available (important!)
12. Train yourself in staff management, then train yourself in research (“make me think”).

13. Once you finished training yourself in staff management, immediately hire four new employees in quick succession. Spend 80K on budget. Select “Game Demo” in order to get balanced employees, and when choosing your candidate, choose the one with lowest Design/Tech, and if tied, with smaller Speed and bigger Research.

YES! I SAID LOWEST!

I hope you remember you need to do better each time in order to keep releasing well reviewed games. The lower your employee’s Speed, Design and Tech are, the easier it will be to increase them. Think about it – if training adds average of 30 to the stat, then employee with 100 Speed will get 33% better from Speed training, while employee with 300 Speed will get 10% better. Feel difference? Less starting stats mean you will have easier time increasing your productivity.

Also, when you hire 4 crew members, you will obviously increase your output tremendously. Hiring weak employees (like, 120D/70T) helps to cut overall output down when you assign them to a field in medium game development. And first few training sessions will improve their output very much so you will get very good reviews at no effort at all!

14. When you hire an employee, always train him with welcome training immediately.

15. You should now have five total employees, who are totally wasted (their effectiveness is close to zero). No problem! They can still research as well. Therefore, start researching Medium Games, Target Audience (if available) and 3D Graphics v1 with two (three) of them.

16. As soon as you have researched 3D Graphics v1 start creating new engine, put only 3D Graphics v1 (and all other features in other fields).

17. As soon as you have completed your new custom engine, you should wait until most of your employees are halfway-restored, then start doing Contract Work (start with easiest) until they are completely recovered.

18. Once they are completely recovered, train everybody once in research.

19. After training is finished, do one small game (RPG or Adventure or whatever, but I remind you those two are easiest). Again, use only 3D Graphics v1 feature but no other features. Here, pay attention to how much Design + Tech you produce. You may need to release with many bugs, or you may surprisingly get a quite low amount and even have 6+ review scores with all bugs fixed (newbie employees seem to randomly skip producing bubbles at all for whole stage 1 of development).

By the way, in case you wonder why are we doing a small game – you should remember from review algorithm that new employee forces the game to get 7+ reviews in most case if it would be an 8+ or 9+ review. Therefore, we make one small game so that this does not effect our medium games.

20. Train everybody once in research. If you had to release with bugs in order to not get too high score, do not train in anything else. If you had released without bugs and still got low scores, train everybody in their weaker stat (and your main in both stats – “gems” option)

21. Now do contract work until your first employee becomes exhausted again. Wait until three of them become exhausted, then start vacating them starting with the one who’s exhausted most, and vacate next when their “exhausted” meters are about equal, do same for third and fourth employee, this way they should end their vacation at around the same time and demand next vacation around the same time too. Remember when this will happen (they demand it once per year) so that it doesn’t hit you in the middle of game development.

If their “time for vacation” happens to be around M6 or M7, this is bad, because you’ll probably be developing a game there later because best way to hype your game – G3 – happens at M6W1. If this is the case, you will need to gradually delay their vacation each time so that they vacation somewhere around M9. If an exhausted employee is doing anything other than training, developing and contract work – it is fine, so make use of that (its okay to research or create engine or fix bugs with exhausted employees).

You will have to sync your employee’s vacations once more when you hire 2 last staff members.

22. Now develop medium games for publishers, because that allows you to rack in fans much faster than self-published small games. Try to pick a contract that gives you best royalties – rating requirement is irrelevant (even if you fail you pay not that much for it to be an issue), and make sure required topic/genre is a great combo and required audience fits the topic and the platform. Also prefer a platform with higher market share (Gameling, for example). You can research a new genre if that means getting good contract. Note that you would have problems developing anything except Adventure, Casual and RPG properly, because you would be rather likely to fail to meet the design/tech balance. So expect worse scores at Strategy, Simulation and Action genres.

You can also save before opening “find publishing deals” and reload if you don’t like the list (but you could also consider this cheating, I personally never do it).

Watch out with your first medium release, do not overshoot with the Game Score through the roof, check it and release with bugs if needed.

Remember, until you get 100K fans, your review rating for medium games is capped at 9. This means that if you get enough Game Score to beat your Target Score, you get an 8+, and if you get enough Game Score to get an 8+ under normal conditions, you’ll get a 7+.

Well, this is basically it. You should now be on your steady way towards profits and prosperity. Now, we will talk about general strategy for the whole game.

1. After each game release train your employees twice – once in their lowest Design/Tech stat and once in Research. This will make them generate so many research bubbles that you will hardly have problems with researching later on in the game. If you have an employee with very bad speed (less than 250), train his speed instead of main stat from time to time. Always use most expensive training option available.

2. Do research after you trained everybody twice – this way you can assign research to those who finished training first (which are those who happened to scratch their heads least) and minimize overall team downtime.

3. Your research priorities are as follows:

Unique stuff like Marketing, Large games, Casual genre;
Next version of 3D graphics;
Other features.
If you have over 100 research points and nothing to do with them, you could consider researching new topics, but this is not really that important. Only research after you’ve trained twice with everybody – this way you can assign research to those who finished training first (who happened to scratch their heads least) and minimize overall team downtime.

4. When you research new graphics version (and ONLY when you do), consider creating new custom engine and putting every feature you have researched by this point into it. Do not put 2D graphics in as soon as you get 3D graphics, and do not put older graphics versions in – only newest.

5. Only add features to your games when you see that you cannot keep releasing 8+ reviewed games with your training only. Like, if you see that your ratings are low (not 8+) even though you have developed a perfect game (balance OK, time allocation OK, etc.), consider adding a new feature into your next game. Start with cheapest features in order to not overshoot with Game Score. Basically, as long as you train your employees every time, you can let go without features for a long period of time and keep getting good scores.

6. It does not matter which employee you assign to what field, but be consistent. If you assign your best dude always to graphics (and something else in stage 3), do it always like that. Consistency is the priority. Do not overuse your employees so you can get the “great management” XP bonus every time.

7. Remember too publisher contracts for Medium games until you have 100K fans, then self-publish Medium (with proper marketing, see below) until you unlock large, if you have 400K fans self-publish Large, otherwise take contracts for Large until you do, then self-publish Large.

8. When you self-publish medium and large games, market like this: 500K Campaign at the beginning of Stage 2, then 50K Campaign every now and then (find out for yourself the interval, if you do it to soon you will see no effect, if you do it correctly you will see immediate increase in hype by several dozen). If you want more hype you can do another 500K Campaign at the beginning of Stage 3, but I don’t think it’s worth it. Make sure that G3 (happens at M6 W1 every year) will happen during your development (if you can wait a little bit for it, or postpone some research bunch, do it) because that’s the cheapest hype you can get. For large games you can do 150K instead of 50K Campaign, for AAA games – 2M Campaign instead of 500K campaign (“Special AAA marketing” is bullshit, do not do it).

9. When choosing booth size at G3, choose the smallest until amount of visitors becomes less than one and a half of your total fans. From there on increase to medium booth, and when that cannot satisfy your fans too – go for large booth. Do not choose anything if you cannot have a game in development during the time when G3 happens (but you better do have a game in development when G3 happens).

10) Do not train Boost. It is useless. You do not need it. Do not train specialists until you want to develop AAA games.

11. On random events: accept offers like “install conditioners” or “new hardware” or “sponsor women”, but do not pay 120K to Nigerian scam, do not sue people for pirating your games, and do not stop those who develop fan sequels.

12. When you are offered to go to the big office, do so at once!

Immediately hire two new employees, one Design focused (spend 1.2M on finding him) and one Tech focused. Here, pick one who has closest D/T to 700, because you need him to unlock Hardware/R&D. Train him to get 700, train him as specialist in his field, then start training his other stat only until he becomes a balanced employee.

Don’t forget you need to develop one game with them in which your ratings will be capped at 7+.

13. At R&D Research Internet and Grid first, then research everything else as you please, except Own Convention. I haven’t found benefit of Own Convention, it costs a lot to organize and G3’s largest booth seems to give the same effect (at least until you have more than 1.5M fans, I haven’t went further than that). Make sure to lower the budget back to 0 when you finish research – you don’t need extra research points at that bizarre cost.

14. Developing your own console is very cool and profitable but very pricey – probably need ~200M to make the best one (and conquer market with it). Put maximum into Q&A budget and all features you can – development budget of your hardware lab would take a significant amount of money so no point saving on features. Probably best to wait with your console until you research 3D v7. After you develop a console a budget of ~500K seems to be enough to fix everything that arrives for service.

15. When you research AAA games, prepare three specialists. I found out that looking at many possible genre combos, most important specialist is Graphics (used everywhere), then Level Design and Gameplay, then Sound and AI, then Engine and Dialogues, and Story/Quests and World Design are most useless. Since you only need 3, you can ignore everything else, it is not important, you only need 3 specialists on 3 important fields to make a 9+ AAA game.

16. Don’t forget that 3D Graphics v6 and v7 are researched in R&D lab.

That’s basically it. You should keep getting steadily good reviews, with occasional great reviews. Once you get good at calculating, you can increase your amount of 9+ reviews compared to amount of 8+ reviews. You can then make use of bugs every time in order to get 9+ reviews every time! Save/Loading helps but you can go on without it if you calculate thoroughly. Well done, you now excel at this game.

By the way, if you do an MMO, you can break the game even further – MMO is basically a linearly increasing income/expense, so if you don’t watch it, you go bankrupt but if you do release expansions every now and then, you start to get insane amount of money after several expansions. Better do an MMO on your own console.