From 62070d6a347e7795e0b21b762bebfecf69c9e0b6 Mon Sep 17 00:00:00 2001 From: hidden Date: Sun, 23 Oct 2016 23:50:39 +0800 Subject: [PATCH 01/38] add index and arch_install --- arch/arch_install.org | 60 +++++++++++++++++++++++++++++++++++++++++++ index.html | 10 ++++++++ 2 files changed, 70 insertions(+) create mode 100644 arch/arch_install.org create mode 100644 index.html diff --git a/arch/arch_install.org b/arch/arch_install.org new file mode 100644 index 00000000..89df3abe --- /dev/null +++ b/arch/arch_install.org @@ -0,0 +1,60 @@ +* arch linux install +** system install +*** download iso +#+begin_src bash +wget http://mirror.lzu.edu.cn/archlinux/iso/2016.10.01/archlinux-2016.10.01-dual.iso +md5sum archlinux-2016.10.01-dual.iso # make sure md5sum is true +#+end_src + +*** install arch system +running in iso # get a shell +#+begin_src shell +loadkeys us # set key layout +ping -c 2 qq.com # make sure connect to internet +timedatectl set-ntp true # update system time +fdisk -l # view disk part +fdisk /dev/sda # part install disk + --> n \n p \n \n +512M \n \n + --> n \n p \n \n \n w +fdisk -l # tow part disk +# sda 8:0 0 20G 0 disk +# ├─sda1 8:1 0 512M 0 part +# ├─sda2 8:2 0 15.5G 0 part +mkfs.fat /dev/sda1 # fomat part to fat32(boot) +mkfs.ext4 /dev/sda2 # fomat part to ext4(root) +mount /dev/sda2 /mnt # / part +mkdir -p /mnt/boot # make boot dir +mount /dev/sda1 /mnt/boot # sda1 is boot part +sed -i '/Score/{/China/!{n;s/^/#/}}' /etc/pacman.d/mirrorlist # command other score url +pacstrap /mnt base base-devel net-tools # start install system to disk +genfstab -U /mnt >> /mnt/etc/fstab # add mount table +arch_chroot /mnt # change root directory to install disk +echo flytrap > /etc/hostname # set hostname +passwd # input the same password to stdin, set root password +pacman -S zsh # install zsh +chsh -s /bin/zsh # change default shell to zsh +systemctl enable dhcpcd # the boot is start dhcp +pacman -S grub # install grub +grub-install --boot-directory=/boot /dev/sda # install grub to disk +grub-mkconfig -o /boot/grub/grub.cfg # retouch grub config file +exit # exit cur shell +reboot +#+end_src +system install ok!!! +Use root user login to system. +#+begin_src shell +echo $SHELL # /bin/zsh +# hwclock --systohc --utc +#+end_src +*** install arch desktop +i3 install ok!!! +#+begin_src shell +pacman -S xorg-server xorg-xinit # install xorg server and xinit +pacman -S i3 # install i3 desktop system +pacman -S xf86-video-vesa # device open sorce +cd /etc/X11/xinit/ # change xinit setting +# command last five line and add two line: +i3-wm & +exec i3 +startx +#+end_src diff --git a/index.html b/index.html new file mode 100644 index 00000000..79ae4117 --- /dev/null +++ b/index.html @@ -0,0 +1,10 @@ +!DOCTYPE html> + + +   +  flytrap github blog + + + Flytrap Github Blog Learning. + + From bfd74dff729ddb2cd9d6b9e12d0c1277ed4ba097 Mon Sep 17 00:00:00 2001 From: hidden Date: Sun, 23 Oct 2016 23:54:18 +0800 Subject: [PATCH 02/38] index change --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 79ae4117..be274117 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ -!DOCTYPE html> +   From e2d8c429b08f692899b6400947d9761cd5f605b6 Mon Sep 17 00:00:00 2001 From: hidden Date: Mon, 24 Oct 2016 22:53:35 +0800 Subject: [PATCH 03/38] add arch install usb --- arch/arch_install.org | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/arch/arch_install.org b/arch/arch_install.org index 89df3abe..0bacb19b 100644 --- a/arch/arch_install.org +++ b/arch/arch_install.org @@ -12,7 +12,7 @@ running in iso # get a shell loadkeys us # set key layout ping -c 2 qq.com # make sure connect to internet timedatectl set-ntp true # update system time -fdisk -l # view disk part +lsblk /dev/sda # view disk part fdisk /dev/sda # part install disk --> n \n p \n \n +512M \n \n --> n \n p \n \n \n w @@ -58,3 +58,35 @@ i3-wm & exec i3 startx #+end_src +*** install arch to usb +install arch to usb + +#+begin_src shell +mount ~/soft/iso/archlinux-2016.10.01-dual.iso /mnt/iso/ # mount iso to disk +unsquashfs -d /tmp/arch ./x86_64/airootfs.sfs # system install env ready +fdisk /dev/sdc # part disk +fdisk /dev/sdc # part install disk + --> n \n p \n \n +256M \n \n + --> n \n p \n \n \n w +lsblk /dev/sdc # tow part disk +# sdc 8:32 1 7.4G 0 disk +# ├─sdc1 8:33 1 256M 0 part +# └─sdc2 8:34 1 7.1G 0 part +cd /tmp/arch # change pwd to arch env +cp /etc/resolv.conf etc/ +mount --rbind /proc/ proc/ +mount --rbind /sys/ sys/ +mount --rbind /dev/ dev/ +mount --rbind /run/ run/ +chroot . # change path +mkfs.fat /dev/sdc1 +mkfs.ext4 /dev/sdc2 +mount /dev/sdc2 /mnt/usb/ +mkdir -p /mnt/usb/boot/efi +mount /dev/sdc1 /mnt/usb/ +mount /dev/sdc1 /mnt/usb/boot/efi/ +mount --rbind /mnt mnt/ +sed -i '/Score/{/China/!{n;s/^/#/}}' /etc/pacman.d/mirrorlist +pacstrap /mnt base base-devel net-tools +... +#+end_src From 78687c17bec27f68aa1e226d3374860b2eb21a40 Mon Sep 17 00:00:00 2001 From: flytrap Date: Mon, 24 Oct 2016 23:10:52 +0800 Subject: [PATCH 04/38] Create CNAME --- CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 CNAME diff --git a/CNAME b/CNAME new file mode 100644 index 00000000..49767f75 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +blog.flytrap.top \ No newline at end of file From ecc637e9620ed67bd8478afed33269a5d3b16ddb Mon Sep 17 00:00:00 2001 From: flytrap Date: Mon, 24 Oct 2016 23:13:44 +0800 Subject: [PATCH 05/38] Replace master branch with page content via GitHub --- index.html | 56 +++++- javascripts/scale.fix.js | 17 ++ params.json | 6 + stylesheets/github-light.css | 124 ++++++++++++++ stylesheets/styles.css | 324 +++++++++++++++++++++++++++++++++++ 5 files changed, 523 insertions(+), 4 deletions(-) create mode 100644 javascripts/scale.fix.js create mode 100644 params.json create mode 100644 stylesheets/github-light.css create mode 100644 stylesheets/styles.css diff --git a/index.html b/index.html index be274117..3648ad41 100644 --- a/index.html +++ b/index.html @@ -1,10 +1,58 @@ - + -   -  flytrap github blog + + + Flytrap.GitHub.io by flytrap + + + + + - Flytrap Github Blog Learning. +
+
+

Flytrap.GitHub.io

+

+ + +

View My GitHub Profile

+ +
+
+

+Welcome to GitHub Pages.

+ +

This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new gh-pages branch locally. If you’re using GitHub Desktop, simply sync your repository and you’ll see the new branch.

+ +

+Designer Templates

+ +

We’ve crafted some handsome templates for you to use. Go ahead and click 'Continue to layouts' to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved.

+ +

+Creating pages manually

+ +

If you prefer to not use the automatic generator, push a branch named gh-pages to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.

+ +

+Authors and Contributors

+ +

You can @mention a GitHub username to generate a link to their profile. The resulting <a> element will link to the contributor’s GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.

+ +

+Support or Contact

+ +

Having trouble with Pages? Check out our documentation or contact support and we’ll help you sort it out.

+
+ +
+ + diff --git a/javascripts/scale.fix.js b/javascripts/scale.fix.js new file mode 100644 index 00000000..87a40ca7 --- /dev/null +++ b/javascripts/scale.fix.js @@ -0,0 +1,17 @@ +var metas = document.getElementsByTagName('meta'); +var i; +if (navigator.userAgent.match(/iPhone/i)) { + for (i=0; i` element will link to the contributor’s GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out our [documentation](https://help.github.com/pages) or [contact support](https://github.com/contact) and we’ll help you sort it out.\r\n", + "note": "Don't delete this file! It's used internally to help with page regeneration." +} \ No newline at end of file diff --git a/stylesheets/github-light.css b/stylesheets/github-light.css new file mode 100644 index 00000000..0c6b24d8 --- /dev/null +++ b/stylesheets/github-light.css @@ -0,0 +1,124 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 GitHub, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +.pl-c /* comment */ { + color: #969896; +} + +.pl-c1 /* constant, variable.other.constant, support, meta.property-name, support.constant, support.variable, meta.module-reference, markup.raw, meta.diff.header */, +.pl-s .pl-v /* string variable */ { + color: #0086b3; +} + +.pl-e /* entity */, +.pl-en /* entity.name */ { + color: #795da3; +} + +.pl-smi /* variable.parameter.function, storage.modifier.package, storage.modifier.import, storage.type.java, variable.other */, +.pl-s .pl-s1 /* string source */ { + color: #333; +} + +.pl-ent /* entity.name.tag */ { + color: #63a35c; +} + +.pl-k /* keyword, storage, storage.type */ { + color: #a71d5d; +} + +.pl-s /* string */, +.pl-pds /* punctuation.definition.string, string.regexp.character-class */, +.pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */, +.pl-sr /* string.regexp */, +.pl-sr .pl-cce /* string.regexp constant.character.escape */, +.pl-sr .pl-sre /* string.regexp source.ruby.embedded */, +.pl-sr .pl-sra /* string.regexp string.regexp.arbitrary-repitition */ { + color: #183691; +} + +.pl-v /* variable */ { + color: #ed6a43; +} + +.pl-id /* invalid.deprecated */ { + color: #b52a1d; +} + +.pl-ii /* invalid.illegal */ { + color: #f8f8f8; + background-color: #b52a1d; +} + +.pl-sr .pl-cce /* string.regexp constant.character.escape */ { + font-weight: bold; + color: #63a35c; +} + +.pl-ml /* markup.list */ { + color: #693a17; +} + +.pl-mh /* markup.heading */, +.pl-mh .pl-en /* markup.heading entity.name */, +.pl-ms /* meta.separator */ { + font-weight: bold; + color: #1d3e81; +} + +.pl-mq /* markup.quote */ { + color: #008080; +} + +.pl-mi /* markup.italic */ { + font-style: italic; + color: #333; +} + +.pl-mb /* markup.bold */ { + font-weight: bold; + color: #333; +} + +.pl-md /* markup.deleted, meta.diff.header.from-file */ { + color: #bd2c00; + background-color: #ffecec; +} + +.pl-mi1 /* markup.inserted, meta.diff.header.to-file */ { + color: #55a532; + background-color: #eaffea; +} + +.pl-mdr /* meta.diff.range */ { + font-weight: bold; + color: #795da3; +} + +.pl-mo /* meta.output */ { + color: #1d3e81; +} + diff --git a/stylesheets/styles.css b/stylesheets/styles.css new file mode 100644 index 00000000..2e1768e1 --- /dev/null +++ b/stylesheets/styles.css @@ -0,0 +1,324 @@ +@font-face { + font-family: 'Noto Sans'; + font-weight: 400; + font-style: normal; + src: url('../fonts/Noto-Sans-regular/Noto-Sans-regular.eot'); + src: url('../fonts/Noto-Sans-regular/Noto-Sans-regular.eot?#iefix') format('embedded-opentype'), + local('Noto Sans'), + local('Noto-Sans-regular'), + url('../fonts/Noto-Sans-regular/Noto-Sans-regular.woff2') format('woff2'), + url('../fonts/Noto-Sans-regular/Noto-Sans-regular.woff') format('woff'), + url('../fonts/Noto-Sans-regular/Noto-Sans-regular.ttf') format('truetype'), + url('../fonts/Noto-Sans-regular/Noto-Sans-regular.svg#NotoSans') format('svg'); +} + +@font-face { + font-family: 'Noto Sans'; + font-weight: 700; + font-style: normal; + src: url('../fonts/Noto-Sans-700/Noto-Sans-700.eot'); + src: url('../fonts/Noto-Sans-700/Noto-Sans-700.eot?#iefix') format('embedded-opentype'), + local('Noto Sans Bold'), + local('Noto-Sans-700'), + url('../fonts/Noto-Sans-700/Noto-Sans-700.woff2') format('woff2'), + url('../fonts/Noto-Sans-700/Noto-Sans-700.woff') format('woff'), + url('../fonts/Noto-Sans-700/Noto-Sans-700.ttf') format('truetype'), + url('../fonts/Noto-Sans-700/Noto-Sans-700.svg#NotoSans') format('svg'); +} + +@font-face { + font-family: 'Noto Sans'; + font-weight: 400; + font-style: italic; + src: url('../fonts/Noto-Sans-italic/Noto-Sans-italic.eot'); + src: url('../fonts/Noto-Sans-italic/Noto-Sans-italic.eot?#iefix') format('embedded-opentype'), + local('Noto Sans Italic'), + local('Noto-Sans-italic'), + url('../fonts/Noto-Sans-italic/Noto-Sans-italic.woff2') format('woff2'), + url('../fonts/Noto-Sans-italic/Noto-Sans-italic.woff') format('woff'), + url('../fonts/Noto-Sans-italic/Noto-Sans-italic.ttf') format('truetype'), + url('../fonts/Noto-Sans-italic/Noto-Sans-italic.svg#NotoSans') format('svg'); +} + +@font-face { + font-family: 'Noto Sans'; + font-weight: 700; + font-style: italic; + src: url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.eot'); + src: url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.eot?#iefix') format('embedded-opentype'), + local('Noto Sans Bold Italic'), + local('Noto-Sans-700italic'), + url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.woff2') format('woff2'), + url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.woff') format('woff'), + url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.ttf') format('truetype'), + url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.svg#NotoSans') format('svg'); +} + +body { + background-color: #fff; + padding:50px; + font: 14px/1.5 "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + color:#727272; + font-weight:400; +} + +h1, h2, h3, h4, h5, h6 { + color:#222; + margin:0 0 20px; +} + +p, ul, ol, table, pre, dl { + margin:0 0 20px; +} + +h1, h2, h3 { + line-height:1.1; +} + +h1 { + font-size:28px; +} + +h2 { + color:#393939; +} + +h3, h4, h5, h6 { + color:#494949; +} + +a { + color:#39c; + text-decoration:none; +} + +a:hover { + color:#069; +} + +a small { + font-size:11px; + color:#777; + margin-top:-0.3em; + display:block; +} + +a:hover small { + color:#777; +} + +.wrapper { + width:860px; + margin:0 auto; +} + +blockquote { + border-left:1px solid #e5e5e5; + margin:0; + padding:0 0 0 20px; + font-style:italic; +} + +code, pre { + font-family:Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal, Consolas, Liberation Mono, DejaVu Sans Mono, Courier New, monospace; + color:#333; + font-size:12px; +} + +pre { + padding:8px 15px; + background: #f8f8f8; + border-radius:5px; + border:1px solid #e5e5e5; + overflow-x: auto; +} + +table { + width:100%; + border-collapse:collapse; +} + +th, td { + text-align:left; + padding:5px 10px; + border-bottom:1px solid #e5e5e5; +} + +dt { + color:#444; + font-weight:700; +} + +th { + color:#444; +} + +img { + max-width:100%; +} + +header { + width:270px; + float:left; + position:fixed; + -webkit-font-smoothing:subpixel-antialiased; +} + +header ul { + list-style:none; + height:40px; + padding:0; + background: #f4f4f4; + border-radius:5px; + border:1px solid #e0e0e0; + width:270px; +} + +header li { + width:89px; + float:left; + border-right:1px solid #e0e0e0; + height:40px; +} + +header li:first-child a { + border-radius:5px 0 0 5px; +} + +header li:last-child a { + border-radius:0 5px 5px 0; +} + +header ul a { + line-height:1; + font-size:11px; + color:#999; + display:block; + text-align:center; + padding-top:6px; + height:34px; +} + +header ul a:hover { + color:#999; +} + +header ul a:active { + background-color:#f0f0f0; +} + +strong { + color:#222; + font-weight:700; +} + +header ul li + li + li { + border-right:none; + width:89px; +} + +header ul a strong { + font-size:14px; + display:block; + color:#222; +} + +section { + width:500px; + float:right; + padding-bottom:50px; +} + +small { + font-size:11px; +} + +hr { + border:0; + background:#e5e5e5; + height:1px; + margin:0 0 20px; +} + +footer { + width:270px; + float:left; + position:fixed; + bottom:50px; + -webkit-font-smoothing:subpixel-antialiased; +} + +@media print, screen and (max-width: 960px) { + + div.wrapper { + width:auto; + margin:0; + } + + header, section, footer { + float:none; + position:static; + width:auto; + } + + header { + padding-right:320px; + } + + section { + border:1px solid #e5e5e5; + border-width:1px 0; + padding:20px 0; + margin:0 0 20px; + } + + header a small { + display:inline; + } + + header ul { + position:absolute; + right:50px; + top:52px; + } +} + +@media print, screen and (max-width: 720px) { + body { + word-wrap:break-word; + } + + header { + padding:0; + } + + header ul, header p.view { + position:static; + } + + pre, code { + word-wrap:normal; + } +} + +@media print, screen and (max-width: 480px) { + body { + padding:15px; + } + + header ul { + width:99%; + } + + header li, header ul li + li + li { + width:33%; + } +} + +@media print { + body { + padding:0.4in; + font-size:12pt; + color:#444; + } +} From ec59326def8cde94842bd2be04df6566dd586a2a Mon Sep 17 00:00:00 2001 From: flytrap Date: Mon, 24 Oct 2016 23:18:28 +0800 Subject: [PATCH 06/38] Update index.html --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 3648ad41..fffd019b 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - Flytrap.GitHub.io by flytrap + Flytrap @@ -24,7 +24,7 @@

Flytrap.GitHub.io

-Welcome to GitHub Pages.

+Welcome to GitHub Pages.

This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new gh-pages branch locally. If you’re using GitHub Desktop, simply sync your repository and you’ll see the new branch.

From 45f196bb9c0b23369008bb7218df50aef15228af Mon Sep 17 00:00:00 2001 From: hidden Date: Mon, 24 Oct 2016 23:24:08 +0800 Subject: [PATCH 07/38] add doc --- doc/arch/arch_install.org | 92 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 doc/arch/arch_install.org diff --git a/doc/arch/arch_install.org b/doc/arch/arch_install.org new file mode 100644 index 00000000..0bacb19b --- /dev/null +++ b/doc/arch/arch_install.org @@ -0,0 +1,92 @@ +* arch linux install +** system install +*** download iso +#+begin_src bash +wget http://mirror.lzu.edu.cn/archlinux/iso/2016.10.01/archlinux-2016.10.01-dual.iso +md5sum archlinux-2016.10.01-dual.iso # make sure md5sum is true +#+end_src + +*** install arch system +running in iso # get a shell +#+begin_src shell +loadkeys us # set key layout +ping -c 2 qq.com # make sure connect to internet +timedatectl set-ntp true # update system time +lsblk /dev/sda # view disk part +fdisk /dev/sda # part install disk + --> n \n p \n \n +512M \n \n + --> n \n p \n \n \n w +fdisk -l # tow part disk +# sda 8:0 0 20G 0 disk +# ├─sda1 8:1 0 512M 0 part +# ├─sda2 8:2 0 15.5G 0 part +mkfs.fat /dev/sda1 # fomat part to fat32(boot) +mkfs.ext4 /dev/sda2 # fomat part to ext4(root) +mount /dev/sda2 /mnt # / part +mkdir -p /mnt/boot # make boot dir +mount /dev/sda1 /mnt/boot # sda1 is boot part +sed -i '/Score/{/China/!{n;s/^/#/}}' /etc/pacman.d/mirrorlist # command other score url +pacstrap /mnt base base-devel net-tools # start install system to disk +genfstab -U /mnt >> /mnt/etc/fstab # add mount table +arch_chroot /mnt # change root directory to install disk +echo flytrap > /etc/hostname # set hostname +passwd # input the same password to stdin, set root password +pacman -S zsh # install zsh +chsh -s /bin/zsh # change default shell to zsh +systemctl enable dhcpcd # the boot is start dhcp +pacman -S grub # install grub +grub-install --boot-directory=/boot /dev/sda # install grub to disk +grub-mkconfig -o /boot/grub/grub.cfg # retouch grub config file +exit # exit cur shell +reboot +#+end_src +system install ok!!! +Use root user login to system. +#+begin_src shell +echo $SHELL # /bin/zsh +# hwclock --systohc --utc +#+end_src +*** install arch desktop +i3 install ok!!! +#+begin_src shell +pacman -S xorg-server xorg-xinit # install xorg server and xinit +pacman -S i3 # install i3 desktop system +pacman -S xf86-video-vesa # device open sorce +cd /etc/X11/xinit/ # change xinit setting +# command last five line and add two line: +i3-wm & +exec i3 +startx +#+end_src +*** install arch to usb +install arch to usb + +#+begin_src shell +mount ~/soft/iso/archlinux-2016.10.01-dual.iso /mnt/iso/ # mount iso to disk +unsquashfs -d /tmp/arch ./x86_64/airootfs.sfs # system install env ready +fdisk /dev/sdc # part disk +fdisk /dev/sdc # part install disk + --> n \n p \n \n +256M \n \n + --> n \n p \n \n \n w +lsblk /dev/sdc # tow part disk +# sdc 8:32 1 7.4G 0 disk +# ├─sdc1 8:33 1 256M 0 part +# └─sdc2 8:34 1 7.1G 0 part +cd /tmp/arch # change pwd to arch env +cp /etc/resolv.conf etc/ +mount --rbind /proc/ proc/ +mount --rbind /sys/ sys/ +mount --rbind /dev/ dev/ +mount --rbind /run/ run/ +chroot . # change path +mkfs.fat /dev/sdc1 +mkfs.ext4 /dev/sdc2 +mount /dev/sdc2 /mnt/usb/ +mkdir -p /mnt/usb/boot/efi +mount /dev/sdc1 /mnt/usb/ +mount /dev/sdc1 /mnt/usb/boot/efi/ +mount --rbind /mnt mnt/ +sed -i '/Score/{/China/!{n;s/^/#/}}' /etc/pacman.d/mirrorlist +pacstrap /mnt base base-devel net-tools +... +#+end_src From 2a052cebe774218744e28e1156178dd3e5d73a4a Mon Sep 17 00:00:00 2001 From: flytrap Date: Mon, 24 Oct 2016 23:28:12 +0800 Subject: [PATCH 08/38] Replace master branch with page content via GitHub --- index.html | 8 ++++---- params.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index fffd019b..a1c6b8d5 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - Flytrap + Flytrap by flytrap @@ -15,7 +15,7 @@
-

Flytrap.GitHub.io

+

Flytrap

@@ -24,9 +24,9 @@

Flytrap.GitHub.io

-Welcome to GitHub Pages.

+Welcome to flytrap blog. -

This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new gh-pages branch locally. If you’re using GitHub Desktop, simply sync your repository and you’ll see the new branch.

+

This automatic page generator is the easiest way to create beautiful pages for all of your projects.

Designer Templates

diff --git a/params.json b/params.json index 59f549ce..e989fd7c 100644 --- a/params.json +++ b/params.json @@ -1,6 +1,6 @@ { - "name": "Flytrap.GitHub.io", + "name": "Flytrap", "tagline": "", - "body": "### Welcome to GitHub Pages.\r\nThis automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here [using GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/), select a template crafted by a designer, and publish. After your page is generated, you can check out the new `gh-pages` branch locally. If you’re using GitHub Desktop, simply sync your repository and you’ll see the new branch.\r\n\r\n### Designer Templates\r\nWe’ve crafted some handsome templates for you to use. Go ahead and click 'Continue to layouts' to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved.\r\n\r\n### Creating pages manually\r\nIf you prefer to not use the automatic generator, push a branch named `gh-pages` to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.\r\n\r\n### Authors and Contributors\r\nYou can @mention a GitHub username to generate a link to their profile. The resulting `` element will link to the contributor’s GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out our [documentation](https://help.github.com/pages) or [contact support](https://github.com/contact) and we’ll help you sort it out.\r\n", + "body": "### Welcome to flytrap blog.\r\nThis automatic page generator is the easiest way to create beautiful pages for all of your projects. \r\n\r\n### Designer Templates\r\nWe’ve crafted some handsome templates for you to use. Go ahead and click 'Continue to layouts' to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved.\r\n\r\n### Creating pages manually\r\nIf you prefer to not use the automatic generator, push a branch named `gh-pages` to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.\r\n\r\n### Authors and Contributors\r\nYou can @mention a GitHub username to generate a link to their profile. The resulting `` element will link to the contributor’s GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out our [documentation](https://help.github.com/pages) or [contact support](https://github.com/contact) and we’ll help you sort it out.\r\n", "note": "Don't delete this file! It's used internally to help with page regeneration." } \ No newline at end of file From 0b4e82362fcdb8f1d81af3acac724e593265de14 Mon Sep 17 00:00:00 2001 From: hidden Date: Mon, 24 Oct 2016 23:32:42 +0800 Subject: [PATCH 09/38] mv doc docs --- docs/arch/arch_install.org | 92 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 docs/arch/arch_install.org diff --git a/docs/arch/arch_install.org b/docs/arch/arch_install.org new file mode 100644 index 00000000..0bacb19b --- /dev/null +++ b/docs/arch/arch_install.org @@ -0,0 +1,92 @@ +* arch linux install +** system install +*** download iso +#+begin_src bash +wget http://mirror.lzu.edu.cn/archlinux/iso/2016.10.01/archlinux-2016.10.01-dual.iso +md5sum archlinux-2016.10.01-dual.iso # make sure md5sum is true +#+end_src + +*** install arch system +running in iso # get a shell +#+begin_src shell +loadkeys us # set key layout +ping -c 2 qq.com # make sure connect to internet +timedatectl set-ntp true # update system time +lsblk /dev/sda # view disk part +fdisk /dev/sda # part install disk + --> n \n p \n \n +512M \n \n + --> n \n p \n \n \n w +fdisk -l # tow part disk +# sda 8:0 0 20G 0 disk +# ├─sda1 8:1 0 512M 0 part +# ├─sda2 8:2 0 15.5G 0 part +mkfs.fat /dev/sda1 # fomat part to fat32(boot) +mkfs.ext4 /dev/sda2 # fomat part to ext4(root) +mount /dev/sda2 /mnt # / part +mkdir -p /mnt/boot # make boot dir +mount /dev/sda1 /mnt/boot # sda1 is boot part +sed -i '/Score/{/China/!{n;s/^/#/}}' /etc/pacman.d/mirrorlist # command other score url +pacstrap /mnt base base-devel net-tools # start install system to disk +genfstab -U /mnt >> /mnt/etc/fstab # add mount table +arch_chroot /mnt # change root directory to install disk +echo flytrap > /etc/hostname # set hostname +passwd # input the same password to stdin, set root password +pacman -S zsh # install zsh +chsh -s /bin/zsh # change default shell to zsh +systemctl enable dhcpcd # the boot is start dhcp +pacman -S grub # install grub +grub-install --boot-directory=/boot /dev/sda # install grub to disk +grub-mkconfig -o /boot/grub/grub.cfg # retouch grub config file +exit # exit cur shell +reboot +#+end_src +system install ok!!! +Use root user login to system. +#+begin_src shell +echo $SHELL # /bin/zsh +# hwclock --systohc --utc +#+end_src +*** install arch desktop +i3 install ok!!! +#+begin_src shell +pacman -S xorg-server xorg-xinit # install xorg server and xinit +pacman -S i3 # install i3 desktop system +pacman -S xf86-video-vesa # device open sorce +cd /etc/X11/xinit/ # change xinit setting +# command last five line and add two line: +i3-wm & +exec i3 +startx +#+end_src +*** install arch to usb +install arch to usb + +#+begin_src shell +mount ~/soft/iso/archlinux-2016.10.01-dual.iso /mnt/iso/ # mount iso to disk +unsquashfs -d /tmp/arch ./x86_64/airootfs.sfs # system install env ready +fdisk /dev/sdc # part disk +fdisk /dev/sdc # part install disk + --> n \n p \n \n +256M \n \n + --> n \n p \n \n \n w +lsblk /dev/sdc # tow part disk +# sdc 8:32 1 7.4G 0 disk +# ├─sdc1 8:33 1 256M 0 part +# └─sdc2 8:34 1 7.1G 0 part +cd /tmp/arch # change pwd to arch env +cp /etc/resolv.conf etc/ +mount --rbind /proc/ proc/ +mount --rbind /sys/ sys/ +mount --rbind /dev/ dev/ +mount --rbind /run/ run/ +chroot . # change path +mkfs.fat /dev/sdc1 +mkfs.ext4 /dev/sdc2 +mount /dev/sdc2 /mnt/usb/ +mkdir -p /mnt/usb/boot/efi +mount /dev/sdc1 /mnt/usb/ +mount /dev/sdc1 /mnt/usb/boot/efi/ +mount --rbind /mnt mnt/ +sed -i '/Score/{/China/!{n;s/^/#/}}' /etc/pacman.d/mirrorlist +pacstrap /mnt base base-devel net-tools +... +#+end_src From ecf094efee09be4b5634561335010f6b173ab89f Mon Sep 17 00:00:00 2001 From: hidden Date: Tue, 25 Oct 2016 21:40:16 +0800 Subject: [PATCH 10/38] add doc.index.html --- docs/index.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/index.html diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 00000000..d8f8d469 --- /dev/null +++ b/docs/index.html @@ -0,0 +1 @@ +docs From 34cb30d7afff59036f28d893753f679a81947475 Mon Sep 17 00:00:00 2001 From: hidden Date: Tue, 25 Oct 2016 21:41:29 +0800 Subject: [PATCH 11/38] del arch doc --- arch/arch_install.org | 92 --------------------------------------- doc/arch/arch_install.org | 92 --------------------------------------- 2 files changed, 184 deletions(-) delete mode 100644 arch/arch_install.org delete mode 100644 doc/arch/arch_install.org diff --git a/arch/arch_install.org b/arch/arch_install.org deleted file mode 100644 index 0bacb19b..00000000 --- a/arch/arch_install.org +++ /dev/null @@ -1,92 +0,0 @@ -* arch linux install -** system install -*** download iso -#+begin_src bash -wget http://mirror.lzu.edu.cn/archlinux/iso/2016.10.01/archlinux-2016.10.01-dual.iso -md5sum archlinux-2016.10.01-dual.iso # make sure md5sum is true -#+end_src - -*** install arch system -running in iso # get a shell -#+begin_src shell -loadkeys us # set key layout -ping -c 2 qq.com # make sure connect to internet -timedatectl set-ntp true # update system time -lsblk /dev/sda # view disk part -fdisk /dev/sda # part install disk - --> n \n p \n \n +512M \n \n - --> n \n p \n \n \n w -fdisk -l # tow part disk -# sda 8:0 0 20G 0 disk -# ├─sda1 8:1 0 512M 0 part -# ├─sda2 8:2 0 15.5G 0 part -mkfs.fat /dev/sda1 # fomat part to fat32(boot) -mkfs.ext4 /dev/sda2 # fomat part to ext4(root) -mount /dev/sda2 /mnt # / part -mkdir -p /mnt/boot # make boot dir -mount /dev/sda1 /mnt/boot # sda1 is boot part -sed -i '/Score/{/China/!{n;s/^/#/}}' /etc/pacman.d/mirrorlist # command other score url -pacstrap /mnt base base-devel net-tools # start install system to disk -genfstab -U /mnt >> /mnt/etc/fstab # add mount table -arch_chroot /mnt # change root directory to install disk -echo flytrap > /etc/hostname # set hostname -passwd # input the same password to stdin, set root password -pacman -S zsh # install zsh -chsh -s /bin/zsh # change default shell to zsh -systemctl enable dhcpcd # the boot is start dhcp -pacman -S grub # install grub -grub-install --boot-directory=/boot /dev/sda # install grub to disk -grub-mkconfig -o /boot/grub/grub.cfg # retouch grub config file -exit # exit cur shell -reboot -#+end_src -system install ok!!! -Use root user login to system. -#+begin_src shell -echo $SHELL # /bin/zsh -# hwclock --systohc --utc -#+end_src -*** install arch desktop -i3 install ok!!! -#+begin_src shell -pacman -S xorg-server xorg-xinit # install xorg server and xinit -pacman -S i3 # install i3 desktop system -pacman -S xf86-video-vesa # device open sorce -cd /etc/X11/xinit/ # change xinit setting -# command last five line and add two line: -i3-wm & -exec i3 -startx -#+end_src -*** install arch to usb -install arch to usb - -#+begin_src shell -mount ~/soft/iso/archlinux-2016.10.01-dual.iso /mnt/iso/ # mount iso to disk -unsquashfs -d /tmp/arch ./x86_64/airootfs.sfs # system install env ready -fdisk /dev/sdc # part disk -fdisk /dev/sdc # part install disk - --> n \n p \n \n +256M \n \n - --> n \n p \n \n \n w -lsblk /dev/sdc # tow part disk -# sdc 8:32 1 7.4G 0 disk -# ├─sdc1 8:33 1 256M 0 part -# └─sdc2 8:34 1 7.1G 0 part -cd /tmp/arch # change pwd to arch env -cp /etc/resolv.conf etc/ -mount --rbind /proc/ proc/ -mount --rbind /sys/ sys/ -mount --rbind /dev/ dev/ -mount --rbind /run/ run/ -chroot . # change path -mkfs.fat /dev/sdc1 -mkfs.ext4 /dev/sdc2 -mount /dev/sdc2 /mnt/usb/ -mkdir -p /mnt/usb/boot/efi -mount /dev/sdc1 /mnt/usb/ -mount /dev/sdc1 /mnt/usb/boot/efi/ -mount --rbind /mnt mnt/ -sed -i '/Score/{/China/!{n;s/^/#/}}' /etc/pacman.d/mirrorlist -pacstrap /mnt base base-devel net-tools -... -#+end_src diff --git a/doc/arch/arch_install.org b/doc/arch/arch_install.org deleted file mode 100644 index 0bacb19b..00000000 --- a/doc/arch/arch_install.org +++ /dev/null @@ -1,92 +0,0 @@ -* arch linux install -** system install -*** download iso -#+begin_src bash -wget http://mirror.lzu.edu.cn/archlinux/iso/2016.10.01/archlinux-2016.10.01-dual.iso -md5sum archlinux-2016.10.01-dual.iso # make sure md5sum is true -#+end_src - -*** install arch system -running in iso # get a shell -#+begin_src shell -loadkeys us # set key layout -ping -c 2 qq.com # make sure connect to internet -timedatectl set-ntp true # update system time -lsblk /dev/sda # view disk part -fdisk /dev/sda # part install disk - --> n \n p \n \n +512M \n \n - --> n \n p \n \n \n w -fdisk -l # tow part disk -# sda 8:0 0 20G 0 disk -# ├─sda1 8:1 0 512M 0 part -# ├─sda2 8:2 0 15.5G 0 part -mkfs.fat /dev/sda1 # fomat part to fat32(boot) -mkfs.ext4 /dev/sda2 # fomat part to ext4(root) -mount /dev/sda2 /mnt # / part -mkdir -p /mnt/boot # make boot dir -mount /dev/sda1 /mnt/boot # sda1 is boot part -sed -i '/Score/{/China/!{n;s/^/#/}}' /etc/pacman.d/mirrorlist # command other score url -pacstrap /mnt base base-devel net-tools # start install system to disk -genfstab -U /mnt >> /mnt/etc/fstab # add mount table -arch_chroot /mnt # change root directory to install disk -echo flytrap > /etc/hostname # set hostname -passwd # input the same password to stdin, set root password -pacman -S zsh # install zsh -chsh -s /bin/zsh # change default shell to zsh -systemctl enable dhcpcd # the boot is start dhcp -pacman -S grub # install grub -grub-install --boot-directory=/boot /dev/sda # install grub to disk -grub-mkconfig -o /boot/grub/grub.cfg # retouch grub config file -exit # exit cur shell -reboot -#+end_src -system install ok!!! -Use root user login to system. -#+begin_src shell -echo $SHELL # /bin/zsh -# hwclock --systohc --utc -#+end_src -*** install arch desktop -i3 install ok!!! -#+begin_src shell -pacman -S xorg-server xorg-xinit # install xorg server and xinit -pacman -S i3 # install i3 desktop system -pacman -S xf86-video-vesa # device open sorce -cd /etc/X11/xinit/ # change xinit setting -# command last five line and add two line: -i3-wm & -exec i3 -startx -#+end_src -*** install arch to usb -install arch to usb - -#+begin_src shell -mount ~/soft/iso/archlinux-2016.10.01-dual.iso /mnt/iso/ # mount iso to disk -unsquashfs -d /tmp/arch ./x86_64/airootfs.sfs # system install env ready -fdisk /dev/sdc # part disk -fdisk /dev/sdc # part install disk - --> n \n p \n \n +256M \n \n - --> n \n p \n \n \n w -lsblk /dev/sdc # tow part disk -# sdc 8:32 1 7.4G 0 disk -# ├─sdc1 8:33 1 256M 0 part -# └─sdc2 8:34 1 7.1G 0 part -cd /tmp/arch # change pwd to arch env -cp /etc/resolv.conf etc/ -mount --rbind /proc/ proc/ -mount --rbind /sys/ sys/ -mount --rbind /dev/ dev/ -mount --rbind /run/ run/ -chroot . # change path -mkfs.fat /dev/sdc1 -mkfs.ext4 /dev/sdc2 -mount /dev/sdc2 /mnt/usb/ -mkdir -p /mnt/usb/boot/efi -mount /dev/sdc1 /mnt/usb/ -mount /dev/sdc1 /mnt/usb/boot/efi/ -mount --rbind /mnt mnt/ -sed -i '/Score/{/China/!{n;s/^/#/}}' /etc/pacman.d/mirrorlist -pacstrap /mnt base base-devel net-tools -... -#+end_src From 8030d689ddc339384ab5a33b92dd88370e194704 Mon Sep 17 00:00:00 2001 From: flytrap Date: Tue, 22 Nov 2016 23:02:50 +0800 Subject: [PATCH 12/38] change index.html --- index.html | 161 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 117 insertions(+), 44 deletions(-) diff --git a/index.html b/index.html index a1c6b8d5..412d390e 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,6 @@ - + Flytrap by flytrap @@ -8,51 +8,124 @@ - - - -
-
+ + +
+

Flytrap

- -

View My GitHub Profile

- -
-
-

-Welcome to flytrap blog.

- -

This automatic page generator is the easiest way to create beautiful pages for all of your projects.

- -

-Designer Templates

- -

We’ve crafted some handsome templates for you to use. Go ahead and click 'Continue to layouts' to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved.

- -

-Creating pages manually

- -

If you prefer to not use the automatic generator, push a branch named gh-pages to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.

- -

-Authors and Contributors

- -

You can @mention a GitHub username to generate a link to their profile. The resulting <a> element will link to the contributor’s GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.

- -

-Support or Contact

- -

Having trouble with Pages? Check out our documentation or contact support and we’ll help you sort it out.

-
- +
+
+

让我触摸你的真实 +

+


+

你靠什么谋生,我不感兴趣,
我想知道你渴望什么,
你是不是敢梦想你心中的渴望。

你几岁,我不感兴趣 ,
我想知道你是不是愿意冒险,
看起来像傻瓜的危险,
为了爱,为了你的梦想,为了生命的奇遇。

什么星球跟你的月亮平行,
我不感兴趣,
我想知道你是不是触摸到你忧伤的核心,
你是不是被生命的背叛开敞了心胸,
或是变得枯萎,因为怕更多的伤痛。

我想知道你是不是能跟痛苦共处,
不管是你的或是我的,
而不想去隐藏它、消除它、整修它。

我想知道你是不是能跟喜悦共处,
不管是你的或是我的,
你是不是能跟狂野共舞,
让激情充满了你的指尖到趾间,
而不是警告我们要小心,要实际,要记得作为人的局限。

你跟我说的故事是否真实,
我不感兴趣,
我想要知道你是否能够为了对自己真诚而让别人失望,
你是不是能忍受背叛的指控,
而不背叛自己的灵魂。

我想要知道你是不是能够忠实而足以信赖,
我想要知道你是不是能看到美,
虽然不是每天都美丽,
你是不是能从生命的所在找到你的源头。

我也想要知道你是不是能跟失败共存,
不管是你的还是我的,
而还能站在湖岸,
对着满月的银光呐喊「是啊!」

你在哪里学习?学什么?跟谁学?
我不感兴趣,
我想要知道,
当所有的一切都消逝时,
是什么在你的内心支撑着你。

我想要知道你是不是能跟你自己单独相处,
你是不是真的喜欢做自己的伴侣,
在空虚的时刻里。

一个孤独者的心声,追本溯源的我们,对心灵的沉思,或许可以得到更多的答案。
+

- - - +
+

+ Hosted on GitHub Pages — Theme by orderedlist + +

+
+
+ + + From a871313fe025867713f0d4efc959698cc9cb0aee Mon Sep 17 00:00:00 2001 From: flytrap Date: Sun, 27 Nov 2016 15:32:25 +0800 Subject: [PATCH 13/38] add python phenomenon --- python/some_python_phenomenon.org | 99 +++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 python/some_python_phenomenon.org diff --git a/python/some_python_phenomenon.org b/python/some_python_phenomenon.org new file mode 100644 index 00000000..32ca2cac --- /dev/null +++ b/python/some_python_phenomenon.org @@ -0,0 +1,99 @@ +* loop +** code +#+begin_src python +>items():pass +> +>y +>{'a': 1, 'b': 2} +#+end_src +** analysis +#+begin_src python +>x.iterms() # (('a', 1), ('b', 2)) +>k = 'a' +>y['a'] = 1 +>pass +>k = 'b' +>y['b'] = 2 +#+end_src + +* bool +** code +#+begin_src python +>"Hello" + True +>TypeError: Can't convert 'bool' object to str implicitly +>"Hello" * True +>'Hello' +#+end_src +** analysis +#+begin_src python +>int(True) # True 真實值爲1,參見python C源碼定義, True就是整型的特殊值. +>1 +#+end_src + +* hash +** code +#+begin_src python +>def greet(): return +>d = {greet: 1} +>d +>{: 1} +#+end_src +** analysis +#+begin_src python +>hasattr(greet, '__hash__') # True +>greet.__hash__() # -9223363285414220592 +#+end_src +function 是可哈希的,在其生成的一瞬間,就已經固定不變,包括其中參數的id + +* int +#+begin_src python +>x = 1 +>y = 1 +>x is y +>True +>x = 999 +>y = 999 +>x is y +>False +#+end_src +** analysis +詭異? +其實python在初始化的時候就把一部分整型對象生成好了(這個叫小整型對象池), +但是不可能所有的都生成,官方會測試出一個最佳值來在源碼中寫死; +大於其值,則重新生成,小於等於則直接返回給你,所以,你懂得. +999明顯大於,而1,明顯是直接返回的,只是內部引用增加了而已 +正常編譯應該是[-5,256]. +測試代碼: +#+begin_src python +# 1) +>x = -5 +>x is int(str(x)) # False +# 2) +>test_int = lambda x: x is int(str(x)) +>test_int(256) # True +# [-5, 256] return True +# <=-6, >=257 return False +#+end_src + +* tuple +** code +#+begin_src python +>a = [1, 0] +>a[0], a[a[0]] = a[a[0]], a[0] +>a +>[1, 0] +>a[a[0]], a[0] = a[0], a[a[0]] +>a +>[0, 1] +#+end_src +** analysis +不好理解?其實就是表達式看起來復雜了點兒,道理很簡單,看代碼 +#+begin_src python +>a[0], a[a[0]] = a[a[0]], a[0] +>>a[0] = a[a[0]]; a[a[0]] = a[0] +# 其實,這個時候最後一個a[0] 可以確定是1了,而第二個a[a[0]], 是a[0]賦值過一次之後才得到a[0] +>>>a[0] = a[1] # a[0]=0; a[0] = 1 # a-->[1, 0] +# 這個好理解 +>a[a[0]], a[0] = a[0], a[a[0]] +>>a[1] = 1; a[0] = a[1] # a-->[0, 1] +#+end_src From e09bc8c7e9ea24217b3ed0080d86f3c81baa2cf7 Mon Sep 17 00:00:00 2001 From: flytrap Date: Sun, 27 Nov 2016 15:37:07 +0800 Subject: [PATCH 14/38] test some-python html --- python/some_python_phenomenon.html | 360 +++++++++++++++++++++++++++++ 1 file changed, 360 insertions(+) create mode 100644 python/some_python_phenomenon.html diff --git a/python/some_python_phenomenon.html b/python/some_python_phenomenon.html new file mode 100644 index 00000000..7cbf9586 --- /dev/null +++ b/python/some_python_phenomenon.html @@ -0,0 +1,360 @@ + + + + +some_python_phenomenon + + + + + + + +
+

some_python_phenomenon

+ +
+

1 loop

+
+
+

1.1 code

+
+
+ +
>items():pass
+>
+>y
+>{'a': 1, 'b': 2}
+
+
+
+
+
+

1.2 analysis

+
+
+ +
>x.iterms()  # (('a', 1), ('b', 2))
+>k = 'a'
+>y['a'] = 1
+>pass
+>k = 'b'
+>y['b'] = 2
+
+
+
+
+
+ +
+

2 bool

+
+
+

2.1 code

+
+
+ +
>"Hello" + True
+>TypeError: Can't convert 'bool' object to str implicitly
+>"Hello" * True
+>'Hello'
+
+
+
+
+
+

2.2 analysis

+
+
+ +
>int(True)  # True 真實值爲1,參見python C源碼定義, True就是整型的特殊值.
+>1
+
+
+
+
+
+ +
+

3 hash

+
+
+

3.1 code

+
+
+ +
>def greet(): return
+>d = {greet: 1}
+>d
+>{<function __main__.greet>: 1}
+
+
+
+
+
+

3.2 analysis

+
+
+ +
>hasattr(greet, '__hash__')  # True
+>greet.__hash__()  # -9223363285414220592
+
+
+

+function 是可哈希的,在其生成的一瞬間,就已經固定不變,包括其中參數的id +

+
+
+
+ +
+

4 int

+
+
+ +
>x = 1
+>y = 1
+>x is y
+>True
+>x = 999
+>y = 999
+>x is y
+>False
+
+
+
+
+

4.1 analysis

+
+

+詭異? +其實python在初始化的時候就把一部分整型對象生成好了(這個叫小整型對象池), +但是不可能所有的都生成,官方會測試出一個最佳值來在源碼中寫死; +大於其值,則重新生成,小於等於則直接返回給你,所以,你懂得. +999明顯大於,而1,明顯是直接返回的,只是內部引用增加了而已 +正常編譯應該是[-5,256]. +測試代碼: +

+
+ +
# 1)
+>x = -5
+>x is int(str(x))  # False
+# 2)
+>test_int = lambda x: x is int(str(x))
+>test_int(256)  # True
+# [-5, 256] return True
+# <=-6, >=257  return False
+
+
+
+
+
+ +
+

5 tuple

+
+
+

5.1 code

+
+
+ +
>a = [1, 0]
+>a[0], a[a[0]] = a[a[0]], a[0]
+>a
+>[1, 0]
+>a[a[0]], a[0] = a[0], a[a[0]]
+>a
+>[0, 1]
+
+
+
+
+
+

5.2 analysis

+
+

+不好理解?其實就是表達式看起來復雜了點兒,道理很簡單,看代碼 +

+
+ +
>a[0], a[a[0]] = a[a[0]], a[0]
+>>a[0] = a[a[0]]; a[a[0]] = a[0]
+# 其實,這個時候最後一個a[0] 可以確定是1了,而第二個a[a[0]], 是a[0]賦值過一次之後才得到a[0]
+>>>a[0] = a[1]  # a[0]=0;  a[0] = 1  # a-->[1, 0]
+# 這個好理解
+>a[a[0]], a[0] = a[0], a[a[0]]
+>>a[1] = 1; a[0] = a[1]  # a-->[0, 1]
+
+
+
+
+
+
+
+

Created: 2016-11-27 Sun 15:36

+

Emacs 25.1.1 (Org mode 8.2.10)

+

Validate

+
+ + From f6d2ad2d727c04a53324a348cb48709d1b71dab3 Mon Sep 17 00:00:00 2001 From: flytrap Date: Sun, 27 Nov 2016 23:20:04 +0800 Subject: [PATCH 15/38] add emacs keys --- .gitignore | 3 ++ emacs/emacs_keys.org | 79 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 .gitignore create mode 100644 emacs/emacs_keys.org diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..b99d03dd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# ignore file +.idea/ +*~ diff --git a/emacs/emacs_keys.org b/emacs/emacs_keys.org new file mode 100644 index 00000000..6b083810 --- /dev/null +++ b/emacs/emacs_keys.org @@ -0,0 +1,79 @@ +* base +** normal +| C-g | keyboard-quit | | +| C-x C-f | find-file | | +| C-x C-v | find-alternate-file | | +| C-x i | insert-file | | +| C-x C-s | save-buffer | | +| C-x C-w | write-file | other file | +| C-x C-c | save-buffers-kill-emacs | | +| C-h | help-command | | +| C-h f | describe-function | | +| C-h k | describe-key | | +| C-h t | help-with-tutorial | | +| C-h i | info-goto-emacs-command-mode | | + +* file editor +** normal +| C-f | forward-char | | +| C-b | backward-char | | +| C-p | previous-line | | +| C-n | next-line | | +| ESC e | forward-sentence | | +| ESC a | backward-sentend | | +| ESC } | forward-paragraph | | +| ESC { | backward-paragraph | | +| C-v | scroll-up | | +| Esc v | scroll-down | | +| C-x ] | forward-page | curor | +| C-x [ | backward-page | curor | +| ESC < | beginning-of-buffer | file-header | +| ESC > | end-of-buffer | file-end | +| | goto-line | point lines | +| | goto-char | point char | +| C-l | recenter | flush pic | +| ESC n | digit-argument | repeat command | +| C-u n | universal-argument | repeat command(defualt 4) | +** delete +| C-d | delete-char | | +| DEL | delete-backward-char | | +| ESC d | kill-word | | +| ESC DEL | backward-kill-word | | +| C-k | kill-line | del to end line | +| ESC k | kill-sentence | | +| C-x DEL | backward-kill-sentence | sentence | +| C-y/SHIFT-INSERT | yank | resore | +| C-w/SHIFT-DELETE | kill-region | file->cut | +| | kill-paragraph | | +| | backward-kill-paragraph | | +** block +| C-@/C-SPACE | set-mark-command | +| C-x C-x | exchange-point-and-mark | +| ESC w/C-INSERT | kill-ring-save | +| ESC h | mark-paragraph | +| C-x C-p | mark-page | +| C-x h | mark-whole-buffer | +| ESC y | yank-pop | +** editor +| C-t | transpose-chars | change char | +| ESC t | transpose-words | change word | +| C-x C-t | transpose-lines | change line | +| | transpose-sentences | | +| | transpose-paragraphs | | + +| ESC c | cpitalize-word | +| ESC n | upcase-word | +| ESC - ECS c | negitive-argument;captitalize-word | +| ESC - ESC u | negitive-argument;upcase-word | +| ESC - ESC l | negtive-argument;downcase-word | + +** other +| INSERT | overwrite-mode | | +| | rever-buffer | reload file | +| C-x n | advertised-undo | revoked | +| C-_/C-/ | undo | | +| | revert-buffer | resotre to disk | +| | recover-file | show auto save | +* replace +** normal + From 614a2fcdfda0c5f4903605d807c2d6516e265a6a Mon Sep 17 00:00:00 2001 From: flytrap Date: Sun, 27 Nov 2016 23:22:00 +0800 Subject: [PATCH 16/38] add emace key html --- emacs/emacs_keys.html | 679 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 679 insertions(+) create mode 100644 emacs/emacs_keys.html diff --git a/emacs/emacs_keys.html b/emacs/emacs_keys.html new file mode 100644 index 00000000..c19030f0 --- /dev/null +++ b/emacs/emacs_keys.html @@ -0,0 +1,679 @@ + + + + +emacs_keys + + + + + + + +
+

emacs_keys

+ +
+

1 base

+
+
+

1.1 normal

+
+ + + +++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
C-gkeyboard-quit 
C-x C-ffind-file 
C-x C-vfind-alternate-file 
C-x iinsert-file 
C-x C-ssave-buffer 
C-x C-wwrite-fileother file
C-x C-csave-buffers-kill-emacs 
C-hhelp-command 
C-h fdescribe-function 
C-h kdescribe-key 
C-h thelp-with-tutorial 
C-h iinfo-goto-emacs-command-mode 
+
+
+
+ +
+

2 file editor

+
+
+

2.1 normal

+
+ + + +++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
C-fforward-char 
C-bbackward-char 
C-pprevious-line 
C-nnext-line 
ESC eforward-sentence 
ESC abackward-sentend 
ESC }forward-paragraph 
ESC {backward-paragraph 
C-vscroll-up 
Esc vscroll-down 
C-x ]forward-pagecuror
C-x [backward-pagecuror
ESC <beginning-of-bufferfile-header
ESC >end-of-bufferfile-end
 goto-linepoint lines
 goto-charpoint char
C-lrecenterflush pic
ESC ndigit-argumentrepeat command
C-u nuniversal-argumentrepeat command(defualt 4)
+
+
+
+

2.2 delete

+
+ + + +++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
C-ddelete-char 
DELdelete-backward-char 
ESC dkill-word 
ESC DELbackward-kill-word 
C-kkill-linedel to end line
ESC kkill-sentence 
C-x DELbackward-kill-sentencesentence
C-y/SHIFT-INSERTyankresore
C-w/SHIFT-DELETEkill-regionfile->cut
 kill-paragraph 
 backward-kill-paragraph 
+
+
+
+

2.3 block

+
+ + + +++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
C-@/C-SPACEset-mark-command
C-x C-xexchange-point-and-mark
ESC w/C-INSERTkill-ring-save
ESC hmark-paragraph
C-x C-pmark-page
C-x hmark-whole-buffer
ESC yyank-pop
+
+
+
+

2.4 editor

+
+ + + +++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
C-ttranspose-charschange char
ESC ttranspose-wordschange word
C-x C-ttranspose-lineschange line
 transpose-sentences 
 transpose-paragraphs 
+ + + + +++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ESC ccpitalize-word
ESC nupcase-word
ESC - ECS cnegitive-argument;captitalize-word
ESC - ESC unegitive-argument;upcase-word
ESC - ESC lnegtive-argument;downcase-word
+
+
+ +
+

2.5 other

+
+ + + +++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
INSERToverwrite-mode 
 rever-bufferreload file
C-x nadvertised-undorevoked
C-_/C-/undo 
 revert-bufferresotre to disk
 recover-fileshow auto save
+
+
+
+
+

3 replace

+
+
+

3.1 normal

+
+
+
+
+

Created: 2016-11-27 Sun 23:21

+

Emacs 25.1.1 (Org mode 8.2.10)

+

Validate

+
+ + From ce8145d5e4597e379131d93c53bae4f3b742a6c8 Mon Sep 17 00:00:00 2001 From: flytrap Date: Mon, 28 Nov 2016 23:24:12 +0800 Subject: [PATCH 17/38] add flask env org --- python/flask/flask_env.html | 201 ++++++++++++++++++++++++++++++++++++ python/flask/flask_env.org | 19 ++++ 2 files changed, 220 insertions(+) create mode 100644 python/flask/flask_env.html create mode 100644 python/flask/flask_env.org diff --git a/python/flask/flask_env.html b/python/flask/flask_env.html new file mode 100644 index 00000000..847189b9 --- /dev/null +++ b/python/flask/flask_env.html @@ -0,0 +1,201 @@ + + + + +flask_env + + + + + + + +
+

flask_env

+ +
+

1 flask env install

+
+
+

1.1 install virtualenv

+
+
+ +
pip install virtualenv
+
+
+
+
+
+

1.2 install flask

+
+
+ +
virtualenv --no-download flask_env  # create virtualenv no download
+source flask_env/bin/activate
+pip install flask  # bask pkg
+
+
+
+
+
+

1.3 install flask ext

+
+
+ +
pip install flask-Bootstrap  # bootstrap forward
+pip install flask-Script  # auto
+pip install flask-Moment  # locate time
+pip install flask-WTF  # form auth
+pip install Flask-SQLAlchemy  # database manager
+
+
+
+
+
+
+
+

Created: 2016-11-28 Mon 23:23

+

Emacs 25.1.1 (Org mode 8.2.10)

+

Validate

+
+ + diff --git a/python/flask/flask_env.org b/python/flask/flask_env.org new file mode 100644 index 00000000..ff551142 --- /dev/null +++ b/python/flask/flask_env.org @@ -0,0 +1,19 @@ +* flask env install +** install virtualenv +#+begin_src bash +pip install virtualenv +#+end_src +** install flask +#+begin_src bash +virtualenv --no-download flask_env # create virtualenv no download +source flask_env/bin/activate +pip install flask # bask pkg +#+end_src +** install flask ext +#+begin_src bash +pip install flask-Bootstrap # bootstrap forward +pip install flask-Script # auto +pip install flask-Moment # locate time +pip install flask-WTF # form auth +pip install Flask-SQLAlchemy # database manager +#+end_src From a58aad95b5a015a5348e6791588eaf7afe14918a Mon Sep 17 00:00:00 2001 From: flytrap Date: Tue, 29 Nov 2016 00:15:48 +0800 Subject: [PATCH 18/38] change proxychains link --- linux/proxychains.html | 218 ++++++++++++++++++++++++++++++++++++ linux/proxychains.org | 27 +++++ python/flask/flask_env.html | 21 +++- python/flask/flask_env.org | 11 ++ 4 files changed, 275 insertions(+), 2 deletions(-) create mode 100644 linux/proxychains.html create mode 100644 linux/proxychains.org diff --git a/linux/proxychains.html b/linux/proxychains.html new file mode 100644 index 00000000..cac58a56 --- /dev/null +++ b/linux/proxychains.html @@ -0,0 +1,218 @@ + + + + +proxychains + + + + + + + +
+

proxychains

+ +
+

1 proxychains

+
+
+

1.1 desc

+
+

+小夥伴都知道在瀏覽器中配置代理,在各種軟件中配置代理,可是終端呢? +很簡單,就這麼幹,這篇文章就是爲你解決這個問題的。 +

+
+
+
+

1.2 proxychains install

+
+
+ +
pacman -Syu proxychains  # arch
+apt-get install proxychains  # debian, ubuntu
+yum/dnf install proxychains  # redhat, centos, fedora
+
+
+

+非root用戶,自動前面追加sudo +裝不了?沒關系,檢查自己的源。 +

+
+
+
+

1.3 proxychains setting

+
+
+ +
vim + /etc/proxychains.conf
+
+[ProxyList]
+http   0.0.0.0 80
+socks4 0.0.0.0 4444
+socks5 0.0.0.0 5555
+# 只要一行,選擇自己的代理類型,修改之.
+格式:代理類型 ip 端口
+
+
+
+
+
+

1.4 proxychains use

+
+
+ +
proxychains command  # proxychains 後面跟上你的命令就行咯.
+
+
+
+
+
+
+
+

Created: 2016-11-29 Tue 00:15

+

Emacs 25.1.1 (Org mode 8.2.10)

+

Validate

+
+ + diff --git a/linux/proxychains.org b/linux/proxychains.org new file mode 100644 index 00000000..eda3d33d --- /dev/null +++ b/linux/proxychains.org @@ -0,0 +1,27 @@ +* proxychains +** desc +小夥伴都知道在瀏覽器中配置代理,在各種軟件中配置代理,可是終端呢? +很簡單,就這麼幹,這篇文章就是爲你解決這個問題的。 +** proxychains install +#+begin_src bash +pacman -Syu proxychains # arch +apt-get install proxychains # debian, ubuntu +yum/dnf install proxychains # redhat, centos, fedora +#+end_src +非root用戶,自動前面追加sudo +裝不了?沒關系,檢查自己的源。 +** proxychains setting +#+begin_src bash +vim + /etc/proxychains.conf + +[ProxyList] +http 0.0.0.0 80 +socks4 0.0.0.0 4444 +socks5 0.0.0.0 5555 +# 只要一行,選擇自己的代理類型,修改之. +格式:代理類型 ip 端口 +#+end_src +** proxychains use +#+begin_src bash +proxychains command # proxychains 後面跟上你的命令就行咯. +#+end_src diff --git a/python/flask/flask_env.html b/python/flask/flask_env.html index 847189b9..d0f0e628 100644 --- a/python/flask/flask_env.html +++ b/python/flask/flask_env.html @@ -4,7 +4,7 @@ flask_env - + + + + +
+

install_flash

+
+

Table of Contents

+ +
+
+

1 linux install flash

+
+
+

1.1 firefox

+
+
+ +
# download install_flash_player_11_linux.x86_64.tar.gz
+mkdir firefox_flash
+tar zxvf install_flash_player_11_linux.x86_64.tar.gz -C firefox_flash
+cd firefox_flash
+sudo cp usr/* /usr/  # cp flash lib
+sudo cp libflashplayer.so /usr/lib/mozilla/plugins/
+# restart firefox
+
+
+
+
+
+
+
+

Created: 2016-12-04 Sun 13:41

+

Emacs 25.1.1 (Org mode 8.2.10)

+

Validate

+
+ + diff --git a/linux/install_flash.org b/linux/install_flash.org new file mode 100644 index 00000000..fea15c08 --- /dev/null +++ b/linux/install_flash.org @@ -0,0 +1,12 @@ +* linux install flash +** firefox +#+begin_src bash +# download install_flash_player_11_linux.x86_64.tar.gz +mkdir firefox_flash +tar zxvf install_flash_player_11_linux.x86_64.tar.gz -C firefox_flash +cd firefox_flash +sudo cp usr/* /usr/ # cp flash lib +sudo cp libflashplayer.so /usr/lib/mozilla/plugins/ +# restart firefox +#+end_src + From 75b436695484e7f993e61e6a53d161c6f450211c Mon Sep 17 00:00:00 2001 From: flytrap Date: Sun, 4 Dec 2016 22:20:43 +0800 Subject: [PATCH 24/38] mv arch linux install --- linux/arch/arch_install.html | 298 ++++++++++++++++++++++++++ {docs => linux}/arch/arch_install.org | 0 2 files changed, 298 insertions(+) create mode 100644 linux/arch/arch_install.html rename {docs => linux}/arch/arch_install.org (100%) diff --git a/linux/arch/arch_install.html b/linux/arch/arch_install.html new file mode 100644 index 00000000..6014aabc --- /dev/null +++ b/linux/arch/arch_install.html @@ -0,0 +1,298 @@ + + + + +arch_install + + + + + + + +
+

arch_install

+ +
+

1 arch linux install

+
+
+

1.1 system install

+
+
+

1.1.1 download iso

+
+
+ +
wget http://mirror.lzu.edu.cn/archlinux/iso/2016.10.01/archlinux-2016.10.01-dual.iso
+md5sum archlinux-2016.10.01-dual.iso  #  make sure md5sum is true
+
+
+
+
+ +
+

1.1.2 install arch system

+
+

+running in iso # get a shell +

+
+ +
loadkeys us  # set key layout
+ping -c 2 qq.com # make sure connect to internet
+timedatectl set-ntp true  # update system time
+lsblk /dev/sda  # view disk part
+fdisk /dev/sda  # part install disk
+  --> n \n p \n \n +512M \n \n
+  --> n \n p \n \n \n w
+fdisk -l  #  tow part disk
+# sda      8:0    0    20G  0 disk
+# ├─sda1   8:1    0   512M  0 part
+# ├─sda2   8:2    0  15.5G  0 part
+mkfs.fat /dev/sda1   # fomat part to fat32(boot)
+mkfs.ext4 /dev/sda2  # fomat part to ext4(root)
+mount /dev/sda2 /mnt  # / part
+mkdir -p /mnt/boot   # make boot dir
+mount /dev/sda1 /mnt/boot  # sda1 is boot part
+sed -i '/Score/{/China/!{n;s/^/#/}}' /etc/pacman.d/mirrorlist  # command other score url
+pacstrap /mnt base base-devel net-tools  # start install system to disk
+genfstab -U /mnt >> /mnt/etc/fstab  # add mount table
+arch_chroot /mnt  # change root directory to install disk
+echo flytrap > /etc/hostname  # set hostname
+passwd  # input the same password to stdin, set root password
+pacman -S zsh  # install zsh
+chsh -s /bin/zsh  # change default shell to zsh
+systemctl enable dhcpcd  # the boot is start dhcp
+pacman -S grub  # install grub
+grub-install --boot-directory=/boot /dev/sda  # install grub to disk
+grub-mkconfig -o /boot/grub/grub.cfg  # retouch grub config file
+exit  # exit cur shell
+reboot
+
+
+

+system install ok!!! +Use root user login to system. +

+
+ +
echo $SHELL  # /bin/zsh
+# hwclock --systohc --utc
+
+
+
+
+
+

1.1.3 install arch desktop

+
+

+i3 install ok!!! +

+
+ +
pacman -S xorg-server xorg-xinit # install xorg server and xinit
+pacman -S i3  # install i3 desktop system
+pacman -S xf86-video-vesa  # device open sorce
+cd /etc/X11/xinit/  # change xinit setting
+# command last five line and add two line:
+i3-wm &
+exec i3
+startx
+
+
+
+
+
+

1.1.4 install arch to usb

+
+

+install arch to usb +

+ +
+ +
mount ~/soft/iso/archlinux-2016.10.01-dual.iso /mnt/iso/  # mount iso to disk
+unsquashfs -d /tmp/arch ./x86_64/airootfs.sfs  # system install env ready
+fdisk /dev/sdc  # part disk
+fdisk /dev/sdc  # part install disk
+  --> n \n p \n \n +256M \n \n
+  --> n \n p \n \n \n w
+lsblk /dev/sdc  #  tow part disk
+# sdc      8:32   1  7.4G  0 disk
+# ├─sdc1   8:33   1  256M  0 part
+# └─sdc2   8:34   1  7.1G  0 part
+cd /tmp/arch  # change pwd to arch env
+cp /etc/resolv.conf etc/
+mount --rbind /proc/ proc/
+mount --rbind /sys/ sys/
+mount --rbind /dev/ dev/
+mount --rbind /run/ run/
+chroot .  # change path
+mkfs.fat /dev/sdc1
+mkfs.ext4 /dev/sdc2
+mount /dev/sdc2 /mnt/usb/
+mkdir -p /mnt/usb/boot/efi
+mount /dev/sdc1 /mnt/usb/
+mount /dev/sdc1 /mnt/usb/boot/efi/
+mount --rbind /mnt mnt/
+sed -i '/Score/{/China/!{n;s/^/#/}}' /etc/pacman.d/mirrorlist
+pacstrap /mnt base base-devel net-tools
+...
+
+
+
+
+
+
+
+
+

Created: 2016-12-04 Sun 22:20

+

Emacs 25.1.1 (Org mode 8.2.10)

+

Validate

+
+ + diff --git a/docs/arch/arch_install.org b/linux/arch/arch_install.org similarity index 100% rename from docs/arch/arch_install.org rename to linux/arch/arch_install.org From 2eba671eb1727e1753ea2e5f3122d55debaa53c8 Mon Sep 17 00:00:00 2001 From: flytrap Date: Sun, 4 Dec 2016 23:59:19 +0800 Subject: [PATCH 25/38] create site map python code --- site_map_py/CreateSiteMap/CreateSiteMap.py | 57 ++++ site_map_py/CreateSiteMap/__init__.py | 2 + site_map_py/CreateSiteMap/common.py | 25 ++ site_map_py/CreateSiteMap/template.html | 305 +++++++++++++++++++++ 4 files changed, 389 insertions(+) create mode 100644 site_map_py/CreateSiteMap/CreateSiteMap.py create mode 100644 site_map_py/CreateSiteMap/__init__.py create mode 100644 site_map_py/CreateSiteMap/common.py create mode 100644 site_map_py/CreateSiteMap/template.html diff --git a/site_map_py/CreateSiteMap/CreateSiteMap.py b/site_map_py/CreateSiteMap/CreateSiteMap.py new file mode 100644 index 00000000..442989cb --- /dev/null +++ b/site_map_py/CreateSiteMap/CreateSiteMap.py @@ -0,0 +1,57 @@ +# coding: utf8 +# auto: flytrap +import os + +from common import get_files + +Exclude_html = ['index.html', 'template.html'] + + +class SiteMap(object): + def __init__(self, index_dir, template_html): + self.index_dir = index_dir + self.template_html = template_html + self.check_path() + + def check_path(self): + assert os.path.isdir(self.index_dir) + assert os.path.isfile(self.template_html) + + def create_site_map(self): + files = self.get_html_path() + self.create_link_block(files) + + def get_html_path(self): + file_list = get_files(self.index_dir, '.html') + file_names = map(lambda filename: filename.split(self.index_dir)[1], file_list) + return filter(lambda filename: filename not in Exclude_html, file_names) + + def create_link_block(self, files): + d = {} + d.update(self.get_file_dict(files)) + print(len(d)) + + def get_file_dict(self, files, from_=None): + f_dict = dict() + for filename in files: + path_li = filename.split(os.sep)[1:] + if len(path_li) > 1: + if path_li[0] not in f_dict: + f_dict[path_li[0]] = [] + f_dict[path_li[0]].append(self.get_file_dict(path_li[1:], path_li[0])) + elif len(path_li) == 0 and from_: + f_dict[from_] = filename + else: + continue + return f_dict + + def create_links(self, path_li, num): + if len(path_li) == 1: + return '
  • 1.1. install virtualenv
  • ' + + +if __name__ == '__main__': + index_path = '/home/flytrap/Documents/code/git/flytrap.github.io' + template_html_path = 'template.html' + sm = SiteMap(index_path, template_html_path) + sm.create_site_map() diff --git a/site_map_py/CreateSiteMap/__init__.py b/site_map_py/CreateSiteMap/__init__.py new file mode 100644 index 00000000..4cf66adb --- /dev/null +++ b/site_map_py/CreateSiteMap/__init__.py @@ -0,0 +1,2 @@ +# coding: utf8 +# auto: flytrap diff --git a/site_map_py/CreateSiteMap/common.py b/site_map_py/CreateSiteMap/common.py new file mode 100644 index 00000000..ba60adc2 --- /dev/null +++ b/site_map_py/CreateSiteMap/common.py @@ -0,0 +1,25 @@ +# coding: utf8 +# auto: flytrap +import os + + +def get_files(directory, suffix=''): + # get dir files and filter suffix + assert os.path.isdir(directory) + return get_dir_file(directory, suffix) + + +def get_dir_file(dir_file, suffix=''): + files = [] + if os.path.isdir(dir_file): + for f in os.listdir(dir_file): + files.extend(get_dir_file(os.path.join(dir_file, f), suffix)) + elif os.path.isfile(dir_file) and dir_file.lower().endswith(suffix.lower()): + files.append(dir_file) + return files + + +if __name__ == '__main__': + index_path = '/home/flytrap/Documents/code/git/flytrap.github.io' + pp = get_files(index_path, '.html') + print(len(pp)) diff --git a/site_map_py/CreateSiteMap/template.html b/site_map_py/CreateSiteMap/template.html new file mode 100644 index 00000000..ee418cdd --- /dev/null +++ b/site_map_py/CreateSiteMap/template.html @@ -0,0 +1,305 @@ + + + + + {{ title }} + + + + + + + +
    +

    {{ title }}

    +
    +

    Blog list

    + +
    +
    +
    +

    Created: 2016-12-04

    +

    Emacs 25.1.1 (Org mode 8.2.10)

    +

    Validate

    +
    + + From 00b1221efaf168734a3a77ce8b482c85259548b0 Mon Sep 17 00:00:00 2001 From: flytrap Date: Thu, 8 Dec 2016 00:48:45 +0800 Subject: [PATCH 26/38] create site map --- index.html | 1 + site_map.html | 305 +++++++++++++++++++++ site_map_py/CreateSiteMap/CreateSiteMap.py | 87 ++++-- site_map_py/CreateSiteMap/template.html | 8 +- 4 files changed, 375 insertions(+), 26 deletions(-) create mode 100644 site_map.html diff --git a/index.html b/index.html index 412d390e..ca71067b 100644 --- a/index.html +++ b/index.html @@ -15,6 +15,7 @@

    Flytrap

    View My GitHub Profile

    +

    Flytrap Site Map

    + + + + {{ title }} + + + + + + + +

    +

    {{ title }}

    +
    +

    Blog list

    + +
    +
    +
    +

    Created: 2016-12-04

    +

    Emacs 25.1.1 (Org mode 8.2.10)

    +

    Validate

    +
    + + diff --git a/site_map_py/CreateSiteMap/CreateSiteMap.py b/site_map_py/CreateSiteMap/CreateSiteMap.py index 442989cb..74e73c85 100644 --- a/site_map_py/CreateSiteMap/CreateSiteMap.py +++ b/site_map_py/CreateSiteMap/CreateSiteMap.py @@ -1,9 +1,13 @@ # coding: utf8 # auto: flytrap import os +import re from common import get_files +title_re1 = re.compile('(.*?)') +title_re2 = re.compile('{{ title }}') +links_re = re.compile('{{ blog_links }}') Exclude_html = ['index.html', 'template.html'] @@ -11,6 +15,8 @@ class SiteMap(object): def __init__(self, index_dir, template_html): self.index_dir = index_dir self.template_html = template_html + self.site_map_path = os.path.join(self.index_dir, 'site_map.html') + self.title = 'Flytrap Site Map' self.check_path() def check_path(self): @@ -19,35 +25,78 @@ def check_path(self): def create_site_map(self): files = self.get_html_path() - self.create_link_block(files) + links_html = self.create_link_block(files) + with open(self.template_html) as f: + html_text = f.read() + site_map_html = links_re.sub(links_html, html_text) + title_re2.sub(self.title, links_html) + with open(self.site_map_path, 'w') as site_map_file: + site_map_file.write(site_map_html) + print('site create ok...') def get_html_path(self): file_list = get_files(self.index_dir, '.html') file_names = map(lambda filename: filename.split(self.index_dir)[1], file_list) - return filter(lambda filename: filename not in Exclude_html, file_names) + return filter(lambda filename: filename.split('/')[-1] not in Exclude_html, file_names) def create_link_block(self, files): - d = {} - d.update(self.get_file_dict(files)) - print(len(d)) + path_dict = self.path_links_dict(files) + html_text = self.create_html(path_dict) + return html_text - def get_file_dict(self, files, from_=None): - f_dict = dict() + def create_html(self, path_dict): + html_text = '' + if isinstance(path_dict, dict): + for cat, blog_list in path_dict.iteritems(): + html_text += '
      ' + html_text += '
    • %s' % cat + html_text += self.create_html(blog_list) + html_text += '
    ' + elif isinstance(path_dict, list): + html_text += '
      ' + for blog in path_dict: + if isinstance(blog, basestring): + html_text += self.create_html_links(blog) + else: + html_text += self.create_html(blog) # dict + html_text += '
    ' + return html_text + + def path_links_dict(self, files): + path_dict = {} for filename in files: - path_li = filename.split(os.sep)[1:] - if len(path_li) > 1: - if path_li[0] not in f_dict: - f_dict[path_li[0]] = [] - f_dict[path_li[0]].append(self.get_file_dict(path_li[1:], path_li[0])) - elif len(path_li) == 0 and from_: - f_dict[from_] = filename - else: + html_path = filename.split('/') + f_len = len(html_path) - 1 + if html_path[1] not in path_dict: + path_dict[html_path[1]] = [] + if f_len == 2: + path_dict[html_path[1]].append(filename) continue - return f_dict + for i in xrange(f_len): + path_dict[html_path[1]].append((self._links_dict(html_path[2:], filename))) + break + return path_dict + + def _links_dict(self, html_path, filename): + path_dict = {} + if len(html_path) <= 2: + path_dict[html_path[0]] = [filename] + else: + path_dict[html_path[0]] = self._links_dict(html_path[1:], filename) + return path_dict - def create_links(self, path_li, num): - if len(path_li) == 1: - return '
  • 1.1. install virtualenv
  • ' + def create_html_links(self, path_li): + file_path = self.index_dir + path_li + title = '' + if os.path.isfile(file_path): + with open(file_path) as f: + html = f.read() + html_title = title_re1.findall(html) + if html_title: + title = html_title[0] + if not title: + title = path_li.split('/')[-1].split('.html')[0] + return '
  • %s
  • \n' % (path_li, title) if __name__ == '__main__': diff --git a/site_map_py/CreateSiteMap/template.html b/site_map_py/CreateSiteMap/template.html index ee418cdd..303e799d 100644 --- a/site_map_py/CreateSiteMap/template.html +++ b/site_map_py/CreateSiteMap/template.html @@ -285,13 +285,7 @@

    {{ title }}

    Blog list

    - + {{ blog_links }}
    From 870b2bd877ee291d6f076955a758405956392437 Mon Sep 17 00:00:00 2001 From: flytrap Date: Thu, 8 Dec 2016 00:52:31 +0800 Subject: [PATCH 27/38] fix site_map title --- site_map.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site_map.html b/site_map.html index 090b639e..19601d2c 100644 --- a/site_map.html +++ b/site_map.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - {{ title }} + Flytrap Site Map From 4b66e266cedc49f173f29e57672135f7dc1d2f84 Mon Sep 17 00:00:00 2001 From: flytrap Date: Thu, 8 Dec 2016 00:54:49 +0800 Subject: [PATCH 28/38] fix site_map.html --- site_map.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site_map.html b/site_map.html index 19601d2c..e4983b1c 100644 --- a/site_map.html +++ b/site_map.html @@ -281,7 +281,7 @@
    -

    {{ title }}

    +

    Flytrap Site Map

    Blog list

    From 4caa3c1089f3fd3127434584166ec79e6a7be8a3 Mon Sep 17 00:00:00 2001 From: flytrap Date: Thu, 8 Dec 2016 22:12:58 +0800 Subject: [PATCH 29/38] change map site --- .gitignore | 1 + site_map.html | 1 + site_map_py/CreateSiteMap/CreateSiteMap.py | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b99d03dd..fc5d3435 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ # ignore file .idea/ *~ +*.pyc diff --git a/site_map.html b/site_map.html index e4983b1c..642552bb 100644 --- a/site_map.html +++ b/site_map.html @@ -288,6 +288,7 @@

    Blog list

    • linux
      • install_flash
      • proxychains
      • diff --git a/site_map_py/CreateSiteMap/CreateSiteMap.py b/site_map_py/CreateSiteMap/CreateSiteMap.py index 74e73c85..94cc0478 100644 --- a/site_map_py/CreateSiteMap/CreateSiteMap.py +++ b/site_map_py/CreateSiteMap/CreateSiteMap.py @@ -29,7 +29,7 @@ def create_site_map(self): with open(self.template_html) as f: html_text = f.read() site_map_html = links_re.sub(links_html, html_text) - title_re2.sub(self.title, links_html) + site_map_html = title_re2.sub(self.title, site_map_html) with open(self.site_map_path, 'w') as site_map_file: site_map_file.write(site_map_html) print('site create ok...') @@ -67,6 +67,11 @@ def path_links_dict(self, files): for filename in files: html_path = filename.split('/') f_len = len(html_path) - 1 + if f_len == 1: + if '/' not in path_dict: + path_dict['/'] = [] + path_dict['/'].append(filename) + continue if html_path[1] not in path_dict: path_dict[html_path[1]] = [] if f_len == 2: From 66c6e6ca15dd5bec989b4ad66462317152785496 Mon Sep 17 00:00:00 2001 From: flytrap Date: Mon, 2 Jan 2017 23:08:26 +0800 Subject: [PATCH 30/38] add python art --- python/pep8_pycodestyle.html | 219 +++++++++++++++++++++++++++++++++++ python/pep8_pycodestyle.org | 26 +++++ python/py3_2_diff.org | 14 +++ 3 files changed, 259 insertions(+) create mode 100644 python/pep8_pycodestyle.html create mode 100644 python/pep8_pycodestyle.org create mode 100644 python/py3_2_diff.org diff --git a/python/pep8_pycodestyle.html b/python/pep8_pycodestyle.html new file mode 100644 index 00000000..0c81a3b0 --- /dev/null +++ b/python/pep8_pycodestyle.html @@ -0,0 +1,219 @@ + + + + +pep8_pycodestyle + + + + + + + +
        +

        pep8_pycodestyle

        + +
        +

        1 pep8(pycodestyle)

        +
        +
        +

        1.1 Summary

        +
        +

        +doc:Python style guide checker +用於檢查python代碼是否符合pep8標準, +該項目目前更名爲pycodestyle. +

        +
        +
        +
        +

        1.2 install

        +
        +
        + +
        pip install pep8
        +
        +
        +
        +
        +
        +

        1.3 directory tree

        +
        +
        + +
        ls pep8*
        +
        +pep8.py
        +
        +pep8-1.7.0.dist-info
        +
        +
        +

        +可以看到只有這一個文件. +

        +
        +
        + +
        +

        1.4 usage

        +
        +
        + +
        python -m pep8 python_file_name.py
        +python_file_name.py:101:6: E225 missing whitespace around operator
        +--show-source  # 顯示代碼
        +
        +
        +

        +這是最簡單的用法。當然還有很多選項,詳情請參考官方文檔,這裏只是聲明這個模塊的存在。 +

        +
        +
        +
        +
        +
        +

        Created: 2017-01-02 Mon 22:12

        +

        Emacs 25.1.1 (Org mode 8.2.10)

        +

        Validate

        +
        + + diff --git a/python/pep8_pycodestyle.org b/python/pep8_pycodestyle.org new file mode 100644 index 00000000..a0fd5648 --- /dev/null +++ b/python/pep8_pycodestyle.org @@ -0,0 +1,26 @@ +* pep8(pycodestyle) +** Summary +doc:Python style guide checker +用於檢查python代碼是否符合pep8標準, +該項目目前更名爲pycodestyle. +** install +#+begin_src python +pip install pep8 +#+end_src +** directory tree +#+begin_src shell +ls pep8* + +pep8.py + +pep8-1.7.0.dist-info +#+end_src +可以看到只有這一個文件. + +** usage +#+begin_src shell +python -m pep8 python_file_name.py +python_file_name.py:101:6: E225 missing whitespace around operator +--show-source # 顯示代碼 +#+end_src +這是最簡單的用法。當然還有很多選項,詳情請參考官方文檔,這裏只是聲明這個模塊的存在。 diff --git a/python/py3_2_diff.org b/python/py3_2_diff.org new file mode 100644 index 00000000..57f18c0b --- /dev/null +++ b/python/py3_2_diff.org @@ -0,0 +1,14 @@ +* python2 and python3 lib different points +** Summary +記錄一些遇到的不同的包的位置。 +其實說白了python3所做的事情就是把這些包分了一下類,把原來的零散的包,歸納到了一起。 +** urllib +*** python2 +#+begin_src python +urllib. +urllib2. +#+end_src +*** python3 +#+begin_src python +urllib. +#+end_src From a691c50e9443e140e05edb12d5fc26ee99608aaf Mon Sep 17 00:00:00 2001 From: flytrap Date: Tue, 3 Jan 2017 22:19:33 +0800 Subject: [PATCH 31/38] recreate site_map and change CreateSiteMap 2 to 3 --- site_map.html | 11 ++++++----- site_map_py/CreateSiteMap/CreateSiteMap.py | 19 +++++++++++++++---- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/site_map.html b/site_map.html index 642552bb..67708e87 100644 --- a/site_map.html +++ b/site_map.html @@ -285,13 +285,14 @@

        Flytrap Site Map

        diff --git a/site_map_py/CreateSiteMap/CreateSiteMap.py b/site_map_py/CreateSiteMap/CreateSiteMap.py index 94cc0478..d3de3228 100644 --- a/site_map_py/CreateSiteMap/CreateSiteMap.py +++ b/site_map_py/CreateSiteMap/CreateSiteMap.py @@ -1,10 +1,18 @@ # coding: utf8 # auto: flytrap +import sys import os import re from common import get_files +if sys.version > '3': + PY3 = True + basestring = str +else: + PY3 = False + + title_re1 = re.compile('(.*?)') title_re2 = re.compile('{{ title }}') links_re = re.compile('{{ blog_links }}') @@ -12,6 +20,7 @@ class SiteMap(object): + def __init__(self, index_dir, template_html): self.index_dir = index_dir self.template_html = template_html @@ -36,7 +45,8 @@ def create_site_map(self): def get_html_path(self): file_list = get_files(self.index_dir, '.html') - file_names = map(lambda filename: filename.split(self.index_dir)[1], file_list) + file_names = map(lambda filename: filename.split( + self.index_dir)[1], file_list) return filter(lambda filename: filename.split('/')[-1] not in Exclude_html, file_names) def create_link_block(self, files): @@ -47,7 +57,7 @@ def create_link_block(self, files): def create_html(self, path_dict): html_text = '' if isinstance(path_dict, dict): - for cat, blog_list in path_dict.iteritems(): + for cat, blog_list in path_dict.items(): html_text += '
          ' html_text += '
        • %s' % cat html_text += self.create_html(blog_list) @@ -77,8 +87,9 @@ def path_links_dict(self, files): if f_len == 2: path_dict[html_path[1]].append(filename) continue - for i in xrange(f_len): - path_dict[html_path[1]].append((self._links_dict(html_path[2:], filename))) + for i in range(f_len): + path_dict[html_path[1]].append( + (self._links_dict(html_path[2:], filename))) break return path_dict From a2eae8677273cdec325f49e8c3a02d17c438816f Mon Sep 17 00:00:00 2001 From: flytrap Date: Wed, 11 Jan 2017 21:25:23 +0800 Subject: [PATCH 32/38] add elpy goto define --- emacs/elpy/python_goto_define.html | 345 +++++++++++++++++++++++++++++ emacs/elpy/python_goto_define.org | 113 ++++++++++ site_map.html | 11 +- 3 files changed, 464 insertions(+), 5 deletions(-) create mode 100644 emacs/elpy/python_goto_define.html create mode 100644 emacs/elpy/python_goto_define.org diff --git a/emacs/elpy/python_goto_define.html b/emacs/elpy/python_goto_define.html new file mode 100644 index 00000000..7c3de351 --- /dev/null +++ b/emacs/elpy/python_goto_define.html @@ -0,0 +1,345 @@ + + + + +python_goto_define + + + + + + + +
          +

          python_goto_define

          + +
          +

          1 python 跳到代碼定義處

          +
          +
          +

          1.1 summary

          +
          +

          +這裏使用的插件是elpy,代碼跳轉使用的是jedi +問題:No definition found +代碼結構: +

          +
          + +
          ╰─➤  tree elpy_q 
          +elpy_q
          +├── __init__.py
          +├── __main__.py
          +├── sub
          +│   ├── __init__.py
          +│   └── sub.py
          +└── sub2
          +    ├── __init__.py
          +    └── sub2.py
          +
          +2 directories, 6 files
          +
          +
          +
          +
          +
          +

          1.2 code

          +
          +
          +

          1.2.1 main.py

          +
          +
          + +
          1│from sub2.sub2 import test2
          +2│
          +3│
          +4│test2()
          +
          +
          +
          +
          +
          +

          1.2.2 sub.py

          +
          +
          + +
          1│import os
          +2│
          +3│
          +4│def test():
          +5│    print('sub: ' + os.getcwd())
          +
          +
          +
          +
          +
          +

          1.2.3 sub2.py

          +
          +
          + +
          1│from sub.sub import test
          +2│
          +3│
          +4│def test2():
          +5│    print('sub2 call sub')
          +6│    test()
          +
          +
          +

          +在文件sub2中跳轉到test位置,提示: +No definition found . +但是呢,sub1中明明是有的。 +

          +
          +
          +
          +
          +

          1.3 analysis

          +
          +
          + +
          1707│(defun elpy-goto-definition ()
          +1708│  "Go to the definition of the symbol at point, if found."
          +1709│  (interactive)
          +1710│  (let ((location (elpy-rpc-get-definition)))
          +1711│    (if location
          +1712│        (elpy-goto-location (car location) (cadr location))
          +1713│      (error "No definition found"))))
          +
          +
          +
          + +
          2721│(defun elpy-rpc--get-rpc-buffer ()                                                                                                              
          +2722│  "Return the RPC buffer associated with the current buffer,                                                                                    
          +2723│creating one if necessary."                                                                                                                     
          +2724│  (when (not (elpy-rpc--process-buffer-p elpy-rpc--buffer))                                                                                     
          +2725│    (setq elpy-rpc--buffer                                                                                                                      
          +2726│          (or (elpy-rpc--find-buffer (elpy-library-root)                                                                                        
          +2727│                                     elpy-rpc-python-command)                                                                                   
          +2728│              (elpy-rpc--open (elpy-library-root)                                                                                               
          +2729│                              elpy-rpc-python-command))))
          +
          +
          +
          + +
          1226│(defun elpy-library-root ()                                                                                                                     
          +1227│  "Return the root of the Python package chain of the current buffer.                                                                           
          +1228│                                                                                                                                                
          +1229│That is, if you have /foo/package/module.py, it will return /foo,                                                                               
          +1230│so that import package.module will pick up module.py."                                                                                          
          +1231│  (locate-dominating-file default-directory                                                                                                     
          +1232│                          (lambda (dir)                                                                                                         
          +1233│                            (not (file-exists-p                                                                                                 
          +1234│                                  (format "%s/__init__.py"                                                                                      
          +1235│                                          dir))))))
          +
          +
          +

          +最後終於找到了elpy-library-root這個函數。 +代碼都快讀完了都沒有發現啥問題,不知道讀到這裏的聰明的你有沒有看出啥來。 +

          +
          + +
          27│    def __init__(self, project_root):                                                                                                           
          +28│        self.project_root = project_root
          +29│        self.completions = {}                                                                                                                   
          +30│        sys.path.append(project_root)
          +
          +
          +

          +甚至在這裏把項目的路徑根都保存出來啦。 +發現一個問題,出現的這個路徑是有問題的,總是我項目的父路徑,爲什麼呢? +

          +
          + +
          27│    def __init__(self, project_root):                                                                                                           
          +28│        self.project_root = project_root
          +29│        self.completions = {}                                                                                                                   
          +30│        sys.path.append(project_root)
          +
          +
          +

          +甚至在這裏把項目的路徑根都保存出來啦。 +發現一個問題,出現的這個路徑是有問題的,總是我項目的父路徑,爲什麼呢? +重點來了。 +

          +
          + +
          (locate-dominating-file default-directory
          +			  (lambda (dir)
          +			    (not (file-exists-p
          +				  (format "%s/__init__.py"
          +					  dir))))))
          +
          +
          +

          +這個方法是用來幹嘛的?看半天沒看明白,後來才明白,是根據第二個參數向上級目錄遍歷, +直到找到滿足條件的目錄,然後把他的父目錄返回,就是我項目的父目錄。 +我們看到這個匿名函數是幹嘛的? +是檢查該目錄下有沒有"init.py"文件,思考一下,作者爲啥這麼寫呢。 +其實想想也挺簡單的,檢查這是不是一個包嘛,如果是包,就默認去找上級沒有"init.py". +

          +
          +
          +
          +

          1.4 Reflection

          +
          +

          +代碼不規範,主函數怎麼能定義在包裏呢? +

          +
          +
          +
          +
          +
          +

          Created: 2017-01-11 Wed 21:20

          +

          Emacs 25.1.1 (Org mode 8.2.10)

          +

          Validate

          +
          + + diff --git a/emacs/elpy/python_goto_define.org b/emacs/elpy/python_goto_define.org new file mode 100644 index 00000000..e523986c --- /dev/null +++ b/emacs/elpy/python_goto_define.org @@ -0,0 +1,113 @@ +* python 跳到代碼定義處 +** summary +這裏使用的插件是elpy,代碼跳轉使用的是jedi +問題:No definition found +代碼結構: +#+begin_src shell +╰─➤ tree elpy_q +elpy_q +├── __init__.py +├── __main__.py +├── sub +│   ├── __init__.py +│   └── sub.py +└── sub2 + ├── __init__.py + └── sub2.py + +2 directories, 6 files +#+end_src +** code +*** __main__.py +#+begin_src python + 1│from sub2.sub2 import test2 + 2│ + 3│ + 4│test2() +#+end_src +*** sub.py +#+begin_src python + 1│import os + 2│ + 3│ + 4│def test(): + 5│ print('sub: ' + os.getcwd()) +#+end_src +*** sub2.py +#+begin_src python + 1│from sub.sub import test + 2│ + 3│ + 4│def test2(): + 5│ print('sub2 call sub') + 6│ test() +#+end_src +在文件sub2中跳轉到test位置,提示: +No definition found . +但是呢,sub1中明明是有的。 +** analysis +#+begin_src elisp +1707│(defun elpy-goto-definition () +1708│ "Go to the definition of the symbol at point, if found." +1709│ (interactive) +1710│ (let ((location (elpy-rpc-get-definition))) +1711│ (if location +1712│ (elpy-goto-location (car location) (cadr location)) +1713│ (error "No definition found")))) +#+end_src +#+begin_src elisp +2721│(defun elpy-rpc--get-rpc-buffer () +2722│ "Return the RPC buffer associated with the current buffer, +2723│creating one if necessary." +2724│ (when (not (elpy-rpc--process-buffer-p elpy-rpc--buffer)) +2725│ (setq elpy-rpc--buffer +2726│ (or (elpy-rpc--find-buffer (elpy-library-root) +2727│ elpy-rpc-python-command) +2728│ (elpy-rpc--open (elpy-library-root) +2729│ elpy-rpc-python-command)))) +#+end_src +#+begin_src elisp +1226│(defun elpy-library-root () +1227│ "Return the root of the Python package chain of the current buffer. +1228│ +1229│That is, if you have /foo/package/module.py, it will return /foo, +1230│so that import package.module will pick up module.py." +1231│ (locate-dominating-file default-directory +1232│ (lambda (dir) +1233│ (not (file-exists-p +1234│ (format "%s/__init__.py" +1235│ dir)))))) +#+end_src +最後終於找到了elpy-library-root這個函數。 +代碼都快讀完了都沒有發現啥問題,不知道讀到這裏的聰明的你有沒有看出啥來。 +#+begin_src python + 27│ def __init__(self, project_root): + 28│ self.project_root = project_root + 29│ self.completions = {} + 30│ sys.path.append(project_root) +#+end_src +甚至在這裏把項目的路徑根都保存出來啦。 +發現一個問題,出現的這個路徑是有問題的,總是我項目的父路徑,爲什麼呢? +#+begin_src elisp + 27│ def __init__(self, project_root): + 28│ self.project_root = project_root + 29│ self.completions = {} + 30│ sys.path.append(project_root) +#+end_src +甚至在這裏把項目的路徑根都保存出來啦。 +發現一個問題,出現的這個路徑是有問題的,總是我項目的父路徑,爲什麼呢? +重點來了。 +#+begin_src elisp +(locate-dominating-file default-directory + (lambda (dir) + (not (file-exists-p + (format "%s/__init__.py" + dir)))))) +#+end_src +這個方法是用來幹嘛的?看半天沒看明白,後來才明白,是根據第二個參數向上級目錄遍歷, +直到找到滿足條件的目錄,然後把他的父目錄返回,就是我項目的父目錄。 +我們看到這個匿名函數是幹嘛的? +是檢查該目錄下有沒有"__init__.py"文件,思考一下,作者爲啥這麼寫呢。 +其實想想也挺簡單的,檢查這是不是一個包嘛,如果是包,就默認去找上級沒有"__init__.py". +** Reflection +代碼不規範,主函數怎麼能定義在包裏呢? diff --git a/site_map.html b/site_map.html index 67708e87..de286632 100644 --- a/site_map.html +++ b/site_map.html @@ -285,14 +285,15 @@

          Flytrap Site Map

          From 3edcbe2582958f7e278a15e9e32292e73d4c3fa3 Mon Sep 17 00:00:00 2001 From: flytrap Date: Sat, 4 Feb 2017 13:31:52 +0800 Subject: [PATCH 33/38] add duoshuo --- duoshuo.tmp | 16 +++ emacs/elpy/python_goto_define.html | 16 +++ emacs/emacs_keys.html | 16 +++ index.html | 7 -- linux/arch/arch_install.html | 16 +++ linux/install_flash.html | 16 +++ linux/proxychains.html | 16 +++ live/summary-2016.html | 166 +++++++++++++++++++++++++++++ live/summary-2016.org | 38 +++++++ python/flask/flask_env.html | 16 +++ python/pep8_pycodestyle.html | 16 +++ python/some_python_phenomenon.html | 16 +++ 12 files changed, 348 insertions(+), 7 deletions(-) create mode 100644 duoshuo.tmp create mode 100644 live/summary-2016.html create mode 100644 live/summary-2016.org diff --git a/duoshuo.tmp b/duoshuo.tmp new file mode 100644 index 00000000..33016239 --- /dev/null +++ b/duoshuo.tmp @@ -0,0 +1,16 @@ + +
          + + + + diff --git a/emacs/elpy/python_goto_define.html b/emacs/elpy/python_goto_define.html index 7c3de351..5f8769ea 100644 --- a/emacs/elpy/python_goto_define.html +++ b/emacs/elpy/python_goto_define.html @@ -342,4 +342,20 @@

          1.4 Reflection

          Validate

    + +
    + + + + diff --git a/emacs/emacs_keys.html b/emacs/emacs_keys.html index 3198acea..23d56de1 100644 --- a/emacs/emacs_keys.html +++ b/emacs/emacs_keys.html @@ -3239,4 +3239,20 @@

    7.2 w3

    Validate

    + +
    + + + + diff --git a/index.html b/index.html index ca71067b..37cf0cb7 100644 --- a/index.html +++ b/index.html @@ -119,14 +119,7 @@

    Flytrap

    style="color: rgb(12, 12, 12); font-family: punctuation, 微软雅黑, Tohoma; line-height: 22.4px; background-color: rgb(255, 255, 255);">一个孤独者的心声,追本溯源的我们,对心灵的沉思,或许可以得到更多的答案。

    -
    -

    - Hosted on GitHub Pages — Theme by orderedlist - -

    -
    - diff --git a/linux/arch/arch_install.html b/linux/arch/arch_install.html index 6014aabc..56192b04 100644 --- a/linux/arch/arch_install.html +++ b/linux/arch/arch_install.html @@ -295,4 +295,20 @@

    1.1.4 install arch to u

    Validate

    + +
    + + + + diff --git a/linux/install_flash.html b/linux/install_flash.html index a6e72593..548ff272 100644 --- a/linux/install_flash.html +++ b/linux/install_flash.html @@ -176,4 +176,20 @@

    1.1 firefox

    Validate

    + +
    + + + + diff --git a/linux/proxychains.html b/linux/proxychains.html index cac58a56..e729c2e4 100644 --- a/linux/proxychains.html +++ b/linux/proxychains.html @@ -215,4 +215,20 @@

    1.4 proxychains use

    Validate

    + +
    + + + + diff --git a/live/summary-2016.html b/live/summary-2016.html new file mode 100644 index 00000000..ed8db228 --- /dev/null +++ b/live/summary-2016.html @@ -0,0 +1,166 @@ + + + + +flytrap 2016 + + + + + + + +
    +

    flytrap 2016

    +
    +

    Table of Contents

    + +
    +
    +

    1 虚度2016

    +
    +
    +

    1.1 读了基本不错的书

    +
    +
    +
    +
    +

    Created: 2017-02-02 Thu 20:43

    +

    Emacs 25.1.1 (Org mode 8.2.10)

    +

    Validate

    +
    + + diff --git a/live/summary-2016.org b/live/summary-2016.org new file mode 100644 index 00000000..88cff271 --- /dev/null +++ b/live/summary-2016.org @@ -0,0 +1,38 @@ +#+TITLE:flytrap 2016 +* 虚度2016 +** 读了几本不错的书 +*** 技术类: +- 代码整洁之道 +- python源码剖析 +- http权威指南 +- sqlite权威指南 +- +*** 人物/历史: +- 卑鄙圣人曹操 +- 人类简史 +- + +** 入门了一些新的语言 +- command lisp (这个值得研究) +- elisp (为了emacs嘛,这个是必须的, 算是离不开了) +- java (spark 工作需要,虽然写了没多久,算是入门吧) + +** 看了一些源码 +*** python +- python2 c源码,大致过了一遍,收获颇多. +- sqlmap 主要精力在整体框架上,略有收获 +*** elsip +- elpy 由一个函数跳转问题引发的,不得不通读源码,大致了解了作者的思路,挺不错的插件. + +** 文档 +- python3 +- elpy +- + +** 收获 +- python 并发处理(多进程) +- emacs(代码跳转,补齐,pep8) +- spark map,reduce思维 +- 代码整洁,工程管理 +- docker 环境搭建 +- arch i3 深入理解linux工作细节 diff --git a/python/flask/flask_env.html b/python/flask/flask_env.html index 667333f9..47dcc2f7 100644 --- a/python/flask/flask_env.html +++ b/python/flask/flask_env.html @@ -215,4 +215,20 @@

    1.3 install flask ext

    Validate

    + +
    + + + + diff --git a/python/pep8_pycodestyle.html b/python/pep8_pycodestyle.html index 0c81a3b0..bc8fa6e8 100644 --- a/python/pep8_pycodestyle.html +++ b/python/pep8_pycodestyle.html @@ -216,4 +216,20 @@

    1.4 usage

    Validate

    + +
    + + + + diff --git a/python/some_python_phenomenon.html b/python/some_python_phenomenon.html index 7cbf9586..c6d63f66 100644 --- a/python/some_python_phenomenon.html +++ b/python/some_python_phenomenon.html @@ -357,4 +357,20 @@

    5.2 analysis

    Validate

    + +
    + + + + From 56ddadc221ec5e1be831d6fdd862f151c52c32c2 Mon Sep 17 00:00:00 2001 From: flytrap Date: Sat, 4 Feb 2017 17:59:34 +0800 Subject: [PATCH 34/38] add summary 2016 --- live/summary-2016.html | 168 ++++++++++++++++++++++++++++++++++++++++- live/summary-2016.org | 51 ++++++++++--- site_map.html | 15 ++-- 3 files changed, 214 insertions(+), 20 deletions(-) diff --git a/live/summary-2016.html b/live/summary-2016.html index ed8db228..bcf57a2c 100644 --- a/live/summary-2016.html +++ b/live/summary-2016.html @@ -4,7 +4,7 @@ flytrap 2016 - + + + + +
    +

    laptop-mode

    + +
    +

    1 laptop-mode

    +
    +
    +

    1.1 install

    +
    +
    + +
    yaourt -Ss laptop-mode
    +yaourt -Syu laptop-mode-tools
    +
    +
    +
    +
    +
    +

    1.2 startup laptop-mode

    +
    +
    + +
    systemctl start laptop-mode
    +systemctl enable laptop-mode
    +
    +
    +
    +
    + +
    +

    1.3 setting

    +
    +
    +

    1.3.1 set brightness

    +
    +

    +editor /etc/laptop-mode/conf.d/lcd-brightness.conf +

    +
    + +
    CONTROL_BRIGHTNESS=1
    +
    +BATT_BRIGHTNESS_COMMAND="echo 100"
    +LM_AC_BRIGHTNESS_COMMAND="echo 100"
    +NOLM_AC_BRIGHTNESS_COMMAND="echo 100"
    +BRIGHTNESS_OUTPUT="/sys/class/backlight/intel_backlight/brightness"
    +
    +
    +
    +
    +
    +

    1.3.2 set network

    +
    +

    +editor /etc/laptop-mode/conf.d/ethernet.conf +

    +
    + +
    ETHERNET_DEVICES="enp0s25"  # set network device
    +
    +
    + +
    + +
    <!-- 多说评论框 start -->
    +	<div class="ds-thread" data-thread-key="11" data-title="laptop-mode" data-url="http://blog.flytrap.top/linux/arch/laptop-mode.html"></div>
    +<!-- 多说评论框 end -->
    +<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
    +<script type="text/javascript">
    +var duoshuoQuery = {short_name:"flytrap"};
    +	(function() {
    +		var ds = document.createElement('script');
    +		ds.type = 'text/javascript';ds.async = true;
    +		ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
    +		ds.charset = 'UTF-8';
    +		(document.getElementsByTagName('head')[0] 
    +		 || document.getElementsByTagName('body')[0]).appendChild(ds);
    +	})();
    +	</script>
    +<!-- 多说公共JS代码 end -->
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Created: 2017-02-26 Sun 23:09

    +

    Emacs 25.1.1 (Org mode 8.2.10)

    +

    Validate

    +
    + + diff --git a/linux/arch/laptop-mode.org b/linux/arch/laptop-mode.org new file mode 100644 index 00000000..e583fa31 --- /dev/null +++ b/linux/arch/laptop-mode.org @@ -0,0 +1,47 @@ +* laptop-mode +** install +#+begin_src shell +yaourt -Ss laptop-mode +yaourt -Syu laptop-mode-tools +#+end_src +** startup laptop-mode +#+begin_src shell +systemctl start laptop-mode +systemctl enable laptop-mode +#+end_src + +** setting +*** set brightness +editor /etc/laptop-mode/conf.d/lcd-brightness.conf +#+begin_src bash +CONTROL_BRIGHTNESS=1 + +BATT_BRIGHTNESS_COMMAND="echo 100" +LM_AC_BRIGHTNESS_COMMAND="echo 100" +NOLM_AC_BRIGHTNESS_COMMAND="echo 100" +BRIGHTNESS_OUTPUT="/sys/class/backlight/intel_backlight/brightness" +#+end_src +*** set network +editor /etc/laptop-mode/conf.d/ethernet.conf +#+begin_src bash +ETHERNET_DEVICES="enp0s25" # set network device +#+end_src + +#+begin_src html + +
    + + + + +#+end_src From da6a6c88dc4a3a0a706b257820d8112f6eb3c226 Mon Sep 17 00:00:00 2001 From: flytrap Date: Sun, 26 Feb 2017 23:14:41 +0800 Subject: [PATCH 37/38] change laptop-mod --- linux/arch/laptop-mode.html | 66 +++++++++++++++++++++++++------------ linux/arch/laptop-mode.org | 2 +- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/linux/arch/laptop-mode.html b/linux/arch/laptop-mode.html index 1082cdf7..a86c84f9 100644 --- a/linux/arch/laptop-mode.html +++ b/linux/arch/laptop-mode.html @@ -4,7 +4,7 @@ laptop-mode - +