Skip to content

Instantly share code, notes, and snippets.

View zdtsw's full-sized avatar

Wen Zhou zdtsw

View GitHub Profile
@zdtsw
zdtsw / mobike business case
Last active May 1, 2017 20:09
some thoughts/guess about mobike in China mainland
I am on my vacation in China , mostly in Shanghai this time.
Since "unknown" reason, I could ot use gist so I attached gistbox for some thought I got for the "mobike".
In short, mobike is the short of mobile bike (my understanding) which can be
1. easy to use: you can park it everywhere and get it almost everywhere in the city
2. easy to pay: with your mobile app
3. cheap to use: it charges by half hour, the current rate is 0.5CNY per half hour
4. low maintainance: it does not need you to care/maintain it
What you need to use mobike is:
1. you pay deposite 299CNY for your account
2. you have mobile mobile app installed on your phone which can access internet
@zdtsw
zdtsw / Idea for "startup company"
Last active May 14, 2017 11:26
mobile payment
A little comparision and thoughts about mobile payment after my travel in China mainland and back to Swede.
In Sweden, it is not populuar to use cash, 90% of the payment is done by credit card or debt card in person.
When it comes to online shoping, either credit card/debt card, bank transfer, or Klara.
The brief of how Klara works: Klara is like a broker/midman in the whole purchase.
- Klara requires your personal number;
- You as buyer order what you want and confirm to use Klara as payment
- Klara pay for you to seller or use its credit to get seller ships goods to you
- You receive goods and confirm it then you pay to Klara
@zdtsw
zdtsw / Git Command Collection(from job experience)
Last active February 11, 2020 13:21
Collection about Git and its friends
Could not add an empty folder and "git commit" it.
Background: I add an empty folder "SOURCES" for rpmbuild use. Suppose the Jenkins job would create the tar from source code and put it into "SOURCES" thats why need a place holder in git/Jenkins workspace
Problem: git commit does not show my "git add SOURCES" as anything can be commited
Solution: either put an empty file . e.g .gitignore in the SOURCES to make it like a non-empty folder to commit
Rename a local branch
git branch -m old-name new-name
Rename a remote branch
git push origin :old-name new-name
@zdtsw
zdtsw / Linux Tips (from job experience)
Last active June 6, 2017 18:39
Some LInux Tricks from work experience
Check totally mem usage on server:
>free | grep Mem | awk '{print $3/$2 * 100.0}'
Cleanup disk on Deb
>sudo apt autoremove
>sudo du -sh /var/cache/apt; sudo apt-get clean (this does cleanup cache for apt, but do not rm the /var/cache/apt, this might be problem)
>du -sh ~/.cache/thumbnails/; rm -rf !$
echo "Hello Wolrd"
Spent quite long time to try to figure out how to setup this Linux + Window Jenkins env.
My user case is, I only want to maintain Linux Jenkins setup, namely Linux on both Jenkins slaves and master.
The current setup is mixed Linux and Windows Jenkins slaves.
On the windows slave, we run a very simple powershell which does two things: psexec to another Windows target to run a bat and get the logs back
So my idea is to move this powershell to Linux slave to run. since powershell is supporting Linux (https://github.com/PowerShell/PowerShell)
But then I realize psexec is still needed on Windows then powershell is not the bottleneck for the change I want to do.
psexec is the key, which enable remote run bat on the Windows target from a Windows.
So we need to find a tool which allow us to run remote bat from a Linux. As if it is a powershell (as-is no need change) or re-write
into a shell script (just call the new tool , plus fetch log)
@zdtsw
zdtsw / 2017GoogleI_IOKeyNotes
Last active May 19, 2017 19:14
Key notes from 2017 Google I/O
AI, VR, machine learning is #1 day's key
1. camera on your phone can tell you what it captures which uses Google Len
-- Do not like this at all !!!! Feel no privacy if I use Andriod to take any picture.
2. Google assistant supports more language input and output and availab eon iphone
-- Well, if they want to have bigger market then must be like French, Spanish and German. But China market is blocked so no Chinese for sure
3. Gmail has built-in response to the mail your receive
-- This also is similar to Allo's Google Assistant function. But does it mean, Google reads all your gmail :D (even everyone konws this already)
@zdtsw
zdtsw / string
Created May 23, 2017 10:20
Markup : raw string and utf-8
.
@zdtsw
zdtsw / Restore broken binary tool
Last active May 23, 2017 19:01
Read something online , maybe useful related to software management tool
first to find the package's name by search broken binayr/tool; then reinstall
all below are using "ping" as example
CentOS/RHEL >yum provides /bin/ping ;sudo yum reinstall iputils
arch> pacman -Qo /bin/ping; sudo pacman -S iputils
Ubuntu/debian > dpkg -S /bin/ping; sudo apt-get --reinstall install iputils-ping
I like ADD in one way, it can do the "decompress" for you as "tar -x" otherwise I prefer COPY which can do the recursive copy
files under the folder
in my experience, to do a lot of "COPY" would create too many layers and eating up build the server. so it is good to create a
tar ball out of the Dockerfile and feed Dockerfile with "ADD"
but be careful the path where you want to decompress the tar ball.
e.g ADD mytarball.tar.gz /dashing