commit a5dd73f274df4fa7b20f944d7e04fa94d1f4f8cf Author: Denis Zheleztsov Date: Mon Oct 18 19:45:57 2021 +0300 Initial public Some content was deleted before this project has been moved to public diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7083002 --- /dev/null +++ b/LICENSE @@ -0,0 +1,231 @@ +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 +Copyright © 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for software and other kinds of works. + +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on the Program. + +To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. + +1. Source Code. +The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. + +A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. + +The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +2. Basic Permissions. +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. + +4. Conveying Verbatim Copies. +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. + +c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. + +6. Conveying Non-Source Forms. +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: + +a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. + +d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. + +A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. + +7. Additional Terms. +“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or authors of the material; or + +e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. + +8. Termination. +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. + +9. Acceptance Not Required for Having Copies. +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. + +11. Patents. +A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. + +In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. + +A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. + +14. Revised Versions of this License. +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. + +15. Disclaimer of Warranty. +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . + +The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . diff --git a/README.md b/README.md new file mode 100644 index 0000000..e798575 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# blog + +## How to build + +You needs an old Hugo version 0.21. + +``` +./hugo --baseURL "https://difrex.lessmore.pw/" --themesDir ./themes -t slim +``` diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..19bb430 --- /dev/null +++ b/config.toml @@ -0,0 +1,10 @@ +baseURL = "http://difrex.lessmore.pw/" +languageCode = "ru-RU" +title = "difrex | more" + +[params] + github = "Difrex" + email = "difrex@lessmore.pw" + content = false + summary = true + FooterMsg = "difrex@lessmore.pw 2017 CC-by-NC 4.0" diff --git a/content/post/api-poiska-na-dynamic.md b/content/post/api-poiska-na-dynamic.md new file mode 100644 index 0000000..13b1c27 --- /dev/null +++ b/content/post/api-poiska-na-dynamic.md @@ -0,0 +1,114 @@ ++++ +date = "2017-12-12T00:58:13+03:00" +draft = false +title = "API поиска на dynamic.lessmore.pw" +tags = ["elasticsearch", "idec"] ++++ + +## Поиск на dynamic.lessmore.pw + +Как это ваще устроено??? На самом деле [API](https://dynamic.lessmore.pw/search) -- это открытый всем Elasticsearch, который предоставляет +гору возможностей для поиска за счет движка Lucene. Давайте что-нибудь найдем! + +Вот в [этом](ii://XWShDDcuR4C8PcrTFdGl) вот комменте я пообещал рассказать как это все сделать. Приступим. + +Давайте для начала попробуем поискать этот самый коммент: ii://XWShDDcuR4C8PcrTFdGl. Здесь и далее мы будем использовать только +*curl*. + +``` sh +curl -XPOST -d '{"query": {"query_string" : {"fields" : ["msgid"], "query" :"XWShDDcuR4C8PcrTFdGl"}}}' https://dynamic.lessmore.pw/search +``` + +Нам вернется такой вот ответ +``` json +{ + "took": 2, + "timed_out": false, + "_shards": { + "total": 5, + "successful": 5, + "skipped": 0, + "failed": 0 + }, + "hits": { + "total": 1, + "max_score": 8.316952, + "hits": [ + { + "_index": "idec_net", + "_type": "post", + "_id": "XWShDDcuR4C8PcrTFdGl", + "_score": 8.316952, + "_source": { + "echo": "idec.talks", + "subg": "Re: Совет нодов", + "to": "Peter", + "author": "Difrex(mobile)", + "message": "\nПостараюсь завтра написать пост с обзором в ii://develop.16. Ну, и ссылку в этот тред скину.", + "date": "1513020107", + "msgid": "XWShDDcuR4C8PcrTFdGl", + "tags": "", + "repto": "h97Frgqdtapl4AI11aUj", + "address": "tavern,23" + } + } + ] + } +} +``` +Вот и он! + +Нам вернулось одно сообщение, что не удивительно, т.к. ID в сети уникальны, а мы искали именно по нему. + +А теперь давайте выведем все последние(5) сообщения(по дате) из эхи *idec.talks*: +``` sh +curl -XPOST -d '{"sort": [{"date": {"order": "desc"}}, {"_score": {"order": "desc" }}], "size": 5}' https://dynamic.lessmore.pw/search -H 'Content-type: application/json' +{ + "took": 2, + "timed_out": false, + "_shards": { + "total": 5, + "successful": 5, + "skipped": 0, + "failed": 0 + } +... +``` + +Смотрите, тут мы отсортировали(на стороне сервера) сообщения по дате в порядке убывания и ограничили лимит в 5 сообщений. +Попробуйте перевести это на SQL(```select * from idec.talks order by date desc limit 5```). + +А теперь выполним более сложный поиск: мы найдем сообщения по строке! Т.е. выполним полнотекстовый поиск! + +Запрос будет выглядеть так: +``` json +{ + "sort": [ + { + "date": { + "order": "desc" + } + }, + { + "_score": { + "order": "desc" + } + } + ], + "query": { + "simple_query_string": { + "query": "обзор" + } + }, + "size": 5 +} +``` +Отправляем его POST-ом в https://dynamic.lessmore.pw/search. + +В ответ нам на это вернется список из 5 сообщений отсортированных по дате, где найдены вхождения слова "обзор". +Кстати, верхнее сообщение(b2rhH6sOfzEzgGZzLT51(на данный момент)) из эхи habra.16 и с заголовком +"Обзор литературы по языку Python для начинающих". + +Вот так вот. Чтобы делать более лучшие вещи читайте документацию(query DSL) по Elasticsearch. + +// Да, если вашей эхи нет в индексе, то убедитесь, что она есть в list.txt diff --git a/content/post/apparmor-firefox.md b/content/post/apparmor-firefox.md new file mode 100644 index 0000000..453b58d --- /dev/null +++ b/content/post/apparmor-firefox.md @@ -0,0 +1,237 @@ ++++ +date = "2018-11-27T11:22:39+03:00" +draft = false +title = "Ограничиваем в правах Firefox с помощью apparmor" +tags = ["linux", "firefox", "apparmor", "archlinux"] +comments = true ++++ + +>AppArmor — программный инструмент упреждающей защиты, основанный на политиках безопасности, которые определяют, +>к каким системным ресурсам и с какими привилегиями может получить доступ то или иное приложение. +>В AppArmor включён набор стандартных профилей, а также инструменты статического анализа и инструменты, основанные на обучении, +>позволяющие ускорить и упростить построение новых профилей. + +*© Wikipedia.org* + +Самое опасное приложение на десктопе, как я считаю, -- это браузер. На меня напал очередной приступ паранои и я написал профиль +apparmor для Firefox. + +## tl;dr + + +Ставим утилиты: +```sh +pacman -S apparmor audit +``` + +Apparmor входит в ядро, так что нужно только его включить передав соответствующие параметры в cmdline Linux. +Правим /etc/default/grub: +``` +GRUB_CMDLINE_LINUX="apparmor=1 security=apparmor audit=1" +``` + +Включаем сервисы: +``` +systemctl enable apparmor +systemctl enable auditd +``` + +Разрешаем себе читать audit.log +``` +groupadd -r audit +gpasswd -a USERNAME audit +``` + +В /etc/audit/auditd.conf прописываем только что созданную группу: `log_group = audit` + +**Перезагружаемся** + +Проверяем статус apparmor: +``` +apparmor_status +apparmor module is loaded. +62 profiles are loaded. +49 profiles are in enforce mode. +... +SKIP +... +``` + +Пишем профиль **/etc/apparmor.d/usr.bin.firefox** +``` +#include + +/usr/bin/firefox { + #include + #include + + # Даем доступ к видео, памяти и tty + /dev/dri/** wr, + /dev/dri/ r, + /dev/shm/ r, + /dev/tty* rw, + /dev/shm/* rw, + + # Даем доступ к конфигам, а так же сети и SSL + /etc/fonts/** r, + /etc/drirc r, + /etc/mime.types r, + /etc/pulse/client.conf r, + /etc/nsswitch.conf r, + /etc/ca-certificates/** r, + /etc/resolv.conf r, + /etc/host.conf r, + /etc/ssl/openssl.cnf r, + /etc/hosts r, + /etc/gai.conf r, + /etc/machine-id r, + + # Разрешаем исполнение самого себя + # /usr/bin/bash ix, + /usr/bin/firefox rix, + /usr/bin/chrome-gnome-shell rix, + # Разрешаем грепать + /bin/grep ixr, + + # Доступ к библиотека на чтение/подключение + /usr/lib/* rm, + /usr/lib/dri/* rm, + /usr/lib/python3.7/** rm, + /usr/lib/firefox/** rixm, + + # Доступ к системным FS + /sys/devices/system/cpu/present r, + /proc/** r, + /sys/devices/** r, + + /usr/share/hunspell/ r, + /usr/share/fonts/** rwkl, + /usr/share/sounds/** r, + # тут 1000 нужно заменить на id своего юзера + /run/user/1000/** r, + + # Разрешаем писать во временную директорию + /tmp/** rwk, + + # Даем права на чтение/запись/лок/линкинг + /run/user/1000/** rwkl, + # Разрешаем писать в сокет dbus + /var/run/dbus/system_bus_socket w, + + # Шрифты/значки и.т.д + /var/cache/fontconfig/** r, + /var/lib/flatpak/exports/** r, + /usr/share/fonts/ r, + /usr/share/icons/** r, + /usr/share/glib-2.0/** r, + /usr/lib/firefox/** rwkix, + /usr/share/ca-certificates/** r, + /usr/lib/gtk-3.0/** rmk, + /usr/share/applications/kde4/ r, + /usr/share/pixmaps/ r, + /usr/share/icons/ r, + /usr/share/libthai/thbrk.tri r, + /usr/local/share/applications/ r, + /usr/local/share/applications/* r, + /usr/local/share/mime/mime.cache r, + /usr/share/applications/ r, + /usr/share/applications/* r, + /usr/share/gdm/applications/ r, + /usr/share/gdm/applications/* r, + /usr/share/locale-langpack/** r, + /usr/share/gtk-3.0/** r, + /usr/share/mime/** r, + /usr/share/myspell/** r, + /usr/share/themes/** r, + + # Назначаем Firefox влядельцем ~/.mozilla и даем ему там все права + # кроме исполнения и подключения библиотек + owner @{HOME}/.mozilla/** rwkl, + @{HOME}/.cache/fontconfig/** r, + @{HOME}/.cache/mozilla/** rwk, + @{HOME}/.cache/thumbnails/** r, + @{HOME}/.config/dconf/* rkw, + @{HOME}/.fonts/ r, + @{HOME}/.local/share/icons/** r, + @{HOME}/.cache/mesa_shader_cache/index rwk, + @{HOME}/.local/lib/python3.7/** rm, + @{HOME}/.config/fcitx/dbus/* r, + @{HOME}/.local/share/recently-used.xbel rk, + + # Определяем каталоги в домашней директории куда можно ходить + # Firefox и с какими правами. + # В моем случае браузер не может даже получить список + # каталогов, но может читать в разрешенных местах и писать в ~/Загрузки + @{HOME}/Изображения/ r, + @{HOME}/Документы/ r, + @{HOME}/Загрузки/ r, + @{HOME}/Видео/ r, + @{HOME}/Музыка/ r, + @{HOME}/soft/ r, + @{HOME}/Изображения/** r, + @{HOME}/Документы/** r, + @{HOME}/Музыка/** r, + @{HOME}/Загрузки/** rwk, + @{HOME}/Видео/** r, + @{HOME}/soft/** r, + + # Кэши и локальные конфиги + @{HOME}/.local/share/fonts/ r, + @{HOME}/.fonts/** r, + @{HOME}/.ICEauthority r, + @{HOME}/.Xauthority r, + @{HOME}/.adobe/**/ r, + @{HOME}/.config/* r, + @{HOME}/.cache/* wrk, + @{HOME}/.config/gtk-2.0/* r, + @{HOME}/.config/gtk-3.0/* r, + @{HOME}/.fonts.conf r, + @{HOME}/.icons/ r, + @{HOME}/.local/share/applications/ r, + @{HOME}/.local/share/applications/* r, + @{HOME}/.local/share/fonts/** r, + @{HOME}/.local/share/icons/ r, + @{HOME}/.local/share/mime/mime.cache r, + @{HOME}/.pulse-cookie krw, + @{HOME}/.config/pulse/** krw, +} +``` + +**PULL THE LEVER** +``` +aa-enforce /etc/apparmor.d/usr.bin.firefox +Назначение /etc/apparmor.d/usr.bin.firefox принудительного режима. +``` + +Теперь можно запустить браузер и проверить его работоспособность. +Наблюдаем через `tail -f /var/log/audit/audit.log | grep DENIED` что было запрещенно Firefox. + +Для меня, например, это: +```text +type=AVC msg=audit(1543307263.804:81037): apparmor="DENIED" operation="open" profile="/usr/bin/firefox" name="/etc/passwd" pid=31159 comm="firefox" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0 +type=AVC msg=audit(1543307263.884:81039): apparmor="DENIED" operation="exec" profile="/usr/bin/firefox" name="/usr/bin/lsb_release" pid=31177 comm="firefox" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0 +type=AVC msg=audit(1543307263.991:81040): apparmor="DENIED" operation="open" profile="/usr/bin/firefox" name="/dev/" pid=31156 comm="firefox" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0 +type=AVC msg=audit(1543307266.698:81043): apparmor="DENIED" operation="open" profile="/usr/bin/firefox" name="/usr/bin/" pid=31493 comm="chrome-gnome-sh" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0 +type=AVC msg=audit(1543307266.944:81044): apparmor="DENIED" operation="exec" profile="/usr/bin/firefox" name="/usr/bin/ldconfig" pid=31533 comm="chrome-gnome-sh" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0 +type=AVC msg=audit(1543307266.968:81045): apparmor="DENIED" operation="exec" profile="/usr/bin/firefox" name="/usr/bin/gcc" pid=31534 comm="chrome-gnome-sh" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0 +``` + +Зачем браузеру запускать компилятор я категорически не понимаю. + +Смотрим еще раз в `apparmor_status`, в конце должно быть что-то подобное: +```text +... +9 processes are in enforce mode. + /usr/lib/firefox/firefox (587) /usr/bin/firefox + /usr/lib/firefox/firefox (3857) /usr/bin/firefox + /usr/lib/firefox/firefox (31156) /usr/bin/firefox + /usr/lib/firefox/firefox (31212) /usr/bin/firefox + /usr/lib/firefox/firefox (31298) /usr/bin/firefox + /usr/bin/python3.7 (31491) /usr/bin/firefox + /usr/lib/firefox/firefox (31516) /usr/bin/firefox + /usr/bin/ntpd (1462) /usr/{bin,sbin}/{,open}ntpd + /usr/bin/dnsmasq (1510) dnsmasq +``` + +Все довольно просто в отличии от того же SELinux. +А еще у apparmor есть очень хорошая документация с [quick guide](https://gitlab.com/apparmor/apparmor/wikis/QuickProfileLanguage). diff --git a/content/post/eshell.md b/content/post/eshell.md new file mode 100644 index 0000000..7e219b2 --- /dev/null +++ b/content/post/eshell.md @@ -0,0 +1,60 @@ ++++ +date = "2018-07-26T16:04:27+03:00" +draft = false +title = "eshell в качестве шелла" +tags = ["emacs", "linux"] +comments = true + ++++ + +Я тут подумал: а чей-то я использую в качестве шелла zsh, когда можно юзать емаксовый eshell? + +Быстренький гайд. + +## Делай раз + +Для начала, чтобы темы отображались правильно нужно сгенерировать terminfo. +В 26.1 емаксе можно работать с 24-битным терминалом. Напишем файл terminfo-24.src: + +```sh +# Use colon separators. +xterm-24bit|xterm with 24-bit direct color mode, + use=xterm-256color, + setb24=\E[48:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm, + setf24=\E[38:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm, +# Use semicolon separators. +xterm-24bits|xterm with 24-bit direct color mode, + use=xterm-256color, + setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm, + setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm, +``` + +Генерируем: +```sh +tic -x -o ~/.terminfo terminfo-24bit.src +``` + +Экспортируем переменную окружения: +```sh +export TERM=xterm-24bit +``` + +Теперь при запуске GNU Emacs в терминале(```emacs[client] -nw```) вместо покореженных цветов при ```TERM=xterm-256color``` + +![256color](/images/emacs-colors/emacs256.png) + +будет красиво + +![24bit](/images/emacs-colors/emacs24bit.png) + +Это тема *solarized-dark*, кстати. + +## Делай два + +Но запускать Емакс в терминале при наличии иксов несколько странно. По-этому нужно пускать сразу ```(eshell)```. +В параметрах терминала в качесте комманды прописываем ```/bin/sh -c "export TERM=xterm-24bit; emacsclient -nw -c -e \"(eshell 'N)\""``` и у нас будет сразу пускаться eshell. Неплохо, не правда ли? :) + +Либо можно пойти еще дальше и перебиндить стандартнуй комбинацию клавишь на запуск сразу eshell в графическом Emacs. +Так, например, для i3wm: ```bindsym $mod+Return exec emacsclient -c -e "(eshell 'N)"```. + +Ура! diff --git a/content/post/fest-folk-museum.md b/content/post/fest-folk-museum.md new file mode 100644 index 0000000..c8b5916 --- /dev/null +++ b/content/post/fest-folk-museum.md @@ -0,0 +1,93 @@ ++++ +date = "2017-05-28T14:04:34+03:00" +draft = false +title = 'Фест Эпоха рыцарства 2017' +comments = true +tags = ["беларусь", "фото", "butterfly temple"] ++++ + +Будет много фоток. Пост весит 16Мб. + + +Под Минском в д. Озерцо проходил фестиваль "Эпоха рыцарства" на котором в первый день я и побывал. + +Было солнечно и тепло. В палатках продовались домашняя медовуха и сбитень. + +Уже на подходе к самому месту проведения заметили палатки и косплееров на коняшках. + +[![](/images/folkfest/1.jpg)](/images/folkfest/1.jpg) + +Сам фестиваль проходил на территории музея народной архитектуры и быта. Там можно походить и заглянуть в некоторые из домов, где попытались воссоздать +старинный быт. Ничего особо примечательного, но красиво. + +[![](/images/folkfest/2.jpg)](/images/folkfest/2.jpg) + +Во второй половине дня начался турнир рыцарей. Это там, где они пиками друг-друга тыкают. +Ведущий что-то постоянно рассказывал и комментировал. +[![](/images/folkfest/3.jpg)](/images/folkfest/3.jpg) + +Вышли сами рыцари с флагами и на конях. +[![](/images/folkfest/4.jpg)](/images/folkfest/4.jpg) + +Вот этот с гусем на голове был особо приколен. +[![](/images/folkfest/5.jpg)](/images/folkfest/5.jpg) +[![](/images/folkfest/6.jpg)](/images/folkfest/6.jpg) + +[![](/images/folkfest/8.jpg)](/images/folkfest/8.jpg) + + +Над этим всем летал дрон и снимал видео. Наверное, его где-то можно будет увидеть. +[![](/images/folkfest/10.jpg)](/images/folkfest/10.jpg) + + +Рыцари скакали на лошадях и перепрыгивали через препятствие. Весело. +[![](/images/folkfest/12.jpg)](/images/folkfest/12.jpg) + +Высоко в небе периодически летали дельтопланы с которых тоже фотографировали фестиваль. +[![](/images/folkfest/13.jpg)](/images/folkfest/13.jpg) + +В конце турнира по сценарию рыцари поссорились и между ними начался махач. +[![](/images/folkfest/14.jpg)](/images/folkfest/14.jpg) +[![](/images/folkfest/15.jpg)](/images/folkfest/15.jpg) + +За этим наблюдали красивые девочки в средневековых костюмах. +[![](/images/folkfest/16.jpg)](/images/folkfest/16.jpg) +[![](/images/folkfest/17.jpg)](/images/folkfest/17.jpg) + +Вечером, на разогреве, выступали фолк-музыканты. Первыми вышли Hardwood. +[![](/images/folkfest/18.jpg)](/images/folkfest/18.jpg) + +Играли довольно неплохо, но вот этой графине походу неособо понравилось. +Позади нее на фоне можно увидеть состязание эльфов-лучников. +[![](/images/folkfest/19.jpg)](/images/folkfest/19.jpg) + +Следующими выступали Стары Ольса. Подтянулись мужики в смешных шапках. Наверняка гномы. +[![](/images/folkfest/20.jpg)](/images/folkfest/20.jpg) + +Выступление проходило весело. +[![](/images/folkfest/21.jpg)](/images/folkfest/21.jpg) +[![](/images/folkfest/22.jpg)](/images/folkfest/22.jpg) + +Барабанщики круты! +[![](/images/folkfest/23.jpg)](/images/folkfest/23.jpg) +[![](/images/folkfest/24.jpg)](/images/folkfest/24.jpg) + +После Стары Ольса на сцену вышли Butterfly Temple. Пока они чекались сходил за сцену. + +Клевые домики. +[![](/images/folkfest/25.jpg)](/images/folkfest/25.jpg) + +Средневековые девченки отошли за сцену покурить и початиться. +[![](/images/folkfest/26.jpg)](/images/folkfest/26.jpg) + +Наконец-то Butterfly настроились и зарубили МИТОЛ! +[![](/images/folkfest/27.jpg)](/images/folkfest/27.jpg) +[![](/images/folkfest/28.jpg)](/images/folkfest/28.jpg) +[![](/images/folkfest/29.jpg)](/images/folkfest/29.jpg) + +Чувак-ведущий залез на столб и пустился в пляс! +[![](/images/folkfest/30.jpg)](/images/folkfest/30.jpg) +[![](/images/folkfest/31.jpg)](/images/folkfest/31.jpg) + +Выступление было драйвовым. Играли Butterfly Temple примерно час. На улице стемнело и температура воздуха опустилась всего до 12 градусов тепла. +Комары озверели, в шортах находиться стало не очень круто и мы поехали домой в Минск. diff --git a/content/post/gnus-multi-accounts.md b/content/post/gnus-multi-accounts.md new file mode 100644 index 0000000..e40ca6d --- /dev/null +++ b/content/post/gnus-multi-accounts.md @@ -0,0 +1,313 @@ ++++ +date = "2018-08-21T10:30:12+03:00" +draft = false +title = "Читаем почту в GNU Emacs" +tags = ["emacs", "linux"] +comments = true ++++ + +И так по обсуждению из вот этого вот [треда](https://dynamic.lessmore.pw/msg/B7Nr84fRN2DxI4mInyuL)(стартовый пост) +у меня получилось настроить Gnus для работы с пятью почтовыми аккаунтами и отказаться от Evolution. + + +На самом деле связка получилась такая: fetchmail забирает письма, раз в 5 минут и запускает procmail +для фильтрации сообщений, procmail сохраняет сообщения в $MAILDIR, дальше уже Gnus читает почту и показывает +ее. Чтобы иметь нормальные уведомления я использую индексер почты **mu**, i3blocks запускает раз в 30 секунд +скрипт проверки на новые письма и отправляет уведовления через libnotify, ну и иконку на панели рисует. + +Вот так примерно это выглядит в ASCII-арте: + +``` ++-----------+ +------------+ +------------+ +------------+ +| fetchmail | |procmail | |Maildir | |Gnus | +| +-----+filters +----+ +----+ | ++----+------+ +------------+ +-----+------+ +------+-----+ + | | | + | | | + | | | + | +--------------+ +-----+------+ +-----+-----+ + | |i3blocks | |mu indexer | |BBDB | + | |libnotify +----------+ | |contacts | + | +--------------+ +-----+------+ +-----------+ + | | + | | + | +-----+------+ + +------------------------------+systemd user| + |and timers | + +------------+ +``` + +> Такие cхемки, кстати, очень удобно рисовать в artist-mode + +Я настраивал все на Arch Linux, но на самом деле это все заработает в любом GNU Linux. + +## Ставим пакеты + +Ставим пакеты: +```sh +pacman -S mu fetchmail procmail msmtp +``` + +Ставим BBDB в Emacs +``` +M-x package-install RET bbdb RET +M-x package-install RET all-the-icons-gnus RET +``` + +BBDB нам нужен для автодополнения контактов в поле To. Да и вообще это хорошая быстрая база контактов +для Emacs. +А вот пакет all-the-icons-gnus рисует красивые иконки :). + +## Правим конфиги + +### fetchmail + +Для начала нам необходимо настроить fetchmail, который будет забирать почту по IMAP/POP. + +Редактируем *~/.fetchmailrc*: +``` +set daemon 300 # fetch mail every 5 minutes +set logfile ~/Mail/fetchmail.log # Logfile + +poll imap.gmail.com with proto IMAP + user 'YOU_USER' there with password 'YOU_PASSWORD' + options ssl keep + mda 'procmail -d %T' +``` + +Подобным образом определяем все свои аккаунты. + +Чтобы не использовать пароли в открытом виде можно наложить [патч](https://jyx.github.io/downloads/patch/fetchmail_gpg.patch) на fetchmail. + +### procmail + +Для фильтрации почты и расскидывания ее по каталогам будем использовать procmail - у него отличная гибкая +система фильтров на регекспах. + +Редактируем *~/.procmailrc*: +``` +MAILDIR=$HOME/Mail # You'd better make sure it exists + +DEFAULT=$MAILDIR/mbox/ +LOGFILE=$MAILDIR/log +LOCKFILE=$HOME/.lockmail + +:0 # socials +* ^From.*@.*(twitter|vk\.com|facebook|golos\.io) +social/ + +:0 # JIRA +* .*Subject.*(\[JIRA\]|\[WGJIRA\]).* +jira/ + +:0 # Gitlab +* ^From.*gitlab@gitlab.* +Gitlab/ +``` + +Свои фильтры пишем дальше аналогично -- тут все просто. Да, и убедитесь, что каталог ```$MAILDIR``` +существует. + +### msmtp + +**msmtp** эта штука, которая позволяет отправлять письма через нужный сервер smtp. Определяет аккаунт +она по полю From. + +Редактируем *~/.msmtprc*: +``` +defaults +auth on +tls on +logfile ~/.msmtp.log +tls_certcheck on +tls_trust_file /etc/ssl/cert.pem + +account difrex +host smtp.googlemail.com +port 587 +from my.mail@gmail.com +user USERNAME +password PASSWORD +``` + +Аналогично для остальных аккаунтов. + +### Systemd + +Теперь необходимо написать нужные юниты и таймеры. Юнит для fetchmail будет выглядеть так: + +*~/.config/systemd/system/fetchmail.service* +```ini +[Unit] +Description=Fetchmail +After=network-online.target + +[Service] +Type=forking +ExecStart=/usr/bin/fetchmail + +[Install] +WantedBy=default.target +``` + +Включаем и запускаем его: +```sh +systemctl --user enable fetchmail.service +systemctl --user start fetchmail.service +``` + +Теперь fetchmail будет стартовать после успешного логина в систему. + +Настроим индексацию почты в mu: + +*~/.config/systemd/user/mu.timer* +```ini +[Unit] +Description=mu mail indexer timer +Documentation=man:mu(1) + +[Timer] +OnCalendar=*:0/5 + +[Install] +WantedBy=timers.target + +``` + +И сервис + +*~/.config/systemd/system/mu.service* +```ini +[Unit] +Description=mu email indexer +After=fetchmail.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/mu index +Environment=MAILDIR=/home/difrex/Mail # тут нужно указать свой MAILDIR +``` + +Включаем и стартуем +```sh +systemctl --user enable mu.timer +systemctl --user start my.timer +``` + +### i3blocks + +Настроим вывод значка с колличеством непрочтенных писем в i3bar и отправку уведомлений. +Для этого напишем простой скрипт на bash. + +*~/.config/i3/mail.sh* +```sh +#!/bin/bash + +MAILDIR=/home/difrex/Mail; export MAILDIR # тут нужно указать свой MAILDIR +COUNT="$(/usr/bin/mu find date:15m..now and flag:unread 2>/dev/null | wc -l)" + +# Write notify lock +write_notify_lock() { + mkdir -p ~/.cache + echo $COUNT > ~/.cache/.mail_notify_lock +} + +# Cleanup lock +clean_notify_lock() { + rm -f ~/.cache/.mail_notify_lock +} + +if [[ $COUNT -gt 0 ]]; then + if [[ ! -f ~/.cache/.mail_notify_lock ]] || [[ $COUNT -gt $(/usr/bin/cat ~/.cache/.mail_notify_lock) ]]; then + write_notify_lock + /usr/bin/notify-send 'New mail' "$(/usr/bin/mu find date:15m..now and flag:unread 2>/dev/null | tail -1)" + fi +else + if [[ -f ~/.cache/.mail_notify_lock ]]; then + clean_notify_lock + fi +fi + +echo $COUNT +``` + +> Не забываем сделать скрипт исполняемым + +И в конфиг *i3blocks.conf* нужно добать секцию с нашим скриптом: +```ini +[mail] +label= +interval=30 +command=~/.config/i3/mail.sh +``` + +Выглядит иконка в баре вот так: ![i3bar mail icon](/images/gnus/i3bar.png) + +А уведомление в dunst так: ![dunst notification](/images/gnus/dunst.png) + +## Gnus + +Переходим к самому интересному, а именно к настройке Gnus. + +Редактируем файл *~/.gnus.el*. + +```lisp +;;; .gnus.el --- GNUs configuration +;;; Commentary: +;;; Code: + +(require 'all-the-icons-gnus) ;; Наводим красоту +(all-the-icons-gnus-setup) + +(setq user-mail-address "my_email@example.com") ;; Будет по-умолчанию в поле From +(setq user-full-name "Denis Zheleztsov") ;; Устанавливаем, как нас зовут + +;; Показываем, что нужно смотреть в MAILDIR +(setq gnus-select-method + '(nnmaildir "mail" (directory "~/Mail")) + mail-sources '((maildir :path "~/Mail" :subdirs ("cur" "new"))) + mail-source-delete-incoming nil) + +;; arbitrary name after "nnmaildir+" +(setq gnus-message-archive-group "nnmaildir+mail:outbox") +(setq message-sendmail-envelope-from 'header) +(setq mail-envelope-from 'header) +(setq message-send-mail-function 'message-send-mail-with-sendmail) + +;; Устанавливаем в качестве программы для отправки писем msmtp +(setq sendmail-program "/usr/bin/msmtp") +(setq message-sendmail-envelope-from 'header) + +;; Сортируем письма по дате +(setq gnus-thread-sort-functions '(gnus-thread-sort-by-most-recent-date)) + +;; Добавляем автодополнение по TAB для поля To +(add-hook 'message-mode-hook + (function (lambda() + (local-set-key (kbd "") 'bbdb-complete-mail)))) + +;; Если адресса получателя нет в базе BBDB - добавляем +(add-hook 'message-setup-hook 'bbdb-mail-aliases) + +;; Добавляем в базу контактов адресатов из входящей почты +(bbdb-initialize 'gnus 'message) +(bbdb-mua-auto-update-init 'gnus) +(setq bbdb-mua-auto-update-p 'create) + +;; Говорим демону Gnus проверять новую почту каждые пять минут +(gnus-demon-add-handler 'gnus-demon-scan-news 5 t) +(gnus-demon-init) + +;;; .gnus.el ends here +``` + +Все! Нажимаем ```M-x RET gnus RET``` и радуемся. + +Так выглядит буфер с группами и непрочитанными сообщениями: ![gnus groups buffer](/images/gnus/gnus_groups.png) + +А так список сабжей в группе(синим цветом показаны прочитанные сообщения): + +![gnus view group](/images/gnus/gnus_view_group.png) + +> Обновлять групповой буфер можно по **g**, а написать новое сообщение по **m**. +> Отправить набраное сообщение через **C-c C-c**. Ответ на сообщение с цитатой **R**, без - **r**. diff --git a/content/post/go-v-emacs.org b/content/post/go-v-emacs.org new file mode 100644 index 0000000..166d2d4 --- /dev/null +++ b/content/post/go-v-emacs.org @@ -0,0 +1,88 @@ ++++ +date = "2017-10-31T22:19:50+03:00" +draft = false +title = "Go в GNU Emacs" +tags = ["emacs"] +comments = true ++++ + +На самом деле это выжимка вот этой [[http://tleyden.github.io/blog/2014/05/22/configure-emacs-as-a-go-editor-from-scratch/][статьи]]. +Ну, а еще некоторые вещи в ней устарели, по-этому немного обновленная версия. + +* tl;dr + +Поставим нужные пакеты в Емакс +#+BEGIN_SRC emacs-lisp +(use-package exec-path-from-shell) +(use-package rainbow-delimiters) +(use-package go-snippets) +(use-package go-guru) +(use-package go-autocomplete) +#+END_SRC + +Настроим go-mode +#+BEGIN_SRC emacs-lisp +(use-package go-mode + ;; Godef jump key binding + :bind (("M-." . godef-jump) + ("M-*" . pop-tag-mark)) + :init + (setenv "GOPATH" (concat (getenv "HOME") "/.local")) + :config + (defun set-exec-path-from-shell-PATH () + (let ((path-from-shell (replace-regexp-in-string + "[ \t\n]*$" + "" + (shell-command-to-string "/bin/bash -c '. ~/.bashrc && echo $PATH'")))) + (setenv "PATH" path-from-shell) + ;; (setq eshell-path-env path-from-shell) ; for eshell users + (setq exec-path (split-string path-from-shell path-separator)))) + + (when window-system (set-exec-path-from-shell-PATH)) + + (defun my-go-mode-hook () + "My Golang hook." + (setq gofmt-command "goimports") + + ;; Call Gofmt before saving + (add-hook 'before-save-hook 'gofmt-before-save) + + ;; Set compile command + (if (not (string-match "go" compile-command)) + (set (make-local-variable 'compile-command) + "go build -v && go test -v && go vet")) + + ;; Enable rainbow + (rainbow-delimiters-mode-enable) + (auto-complete-for-go) + (yas-initialize)) + + ;; Go autocomplete + (defun auto-complete-for-go () + "Enable golang autocomple." + (auto-complete-mode 1)) + + (add-hook 'go-mode-hook 'auto-complete-for-go) + (add-hook 'completion-at-point-functions 'go-complete-at-point) + (add-hook 'go-mode-hook 'my-go-mode-hook) + (add-hook 'go-mode-hook #'rainbow-delimiters-mode)) +#+END_SRC + +Тут в *:bind* можно прописать свои сочетания клавиш. + +Да, всегда используйте [[https://github.com/jwiegley/use-package][use-package]]. Это сэкономит кучу времени в будущем. + +Теперь добавим GOPATH в ~/.bashrc +#+BEGIN_SRC +echo 'export GOPATH=${HOME}/.local' >> ~/.bashrc +. ~/.bashrc +#+END_SRC + +Выкачиваем зависимости Go +#+BEGIN_SRC +go get -t -v golang.org/x/tools/cmd/goimports +go get -t -v golang.org/x/tools/cmd/guru +go get -t -v github.com/rogpeppe/godef +#+END_SRC + +Готово. Код конфига доступен по [[https://github.com/Difrex/emacs-go][ссылке]]. diff --git a/content/post/gotovim-emacs.md b/content/post/gotovim-emacs.md new file mode 100644 index 0000000..6d1679a --- /dev/null +++ b/content/post/gotovim-emacs.md @@ -0,0 +1,95 @@ ++++ +date = "2017-10-31T17:23:44+03:00" +draft = true +title = "Готовим конфиг GNU Emacs" +tags = ["emacs"] +comments = true ++++ + +Часто конфигурационный файл GNU Emacs выглядит, как помойка - нагромождение копипасты и говнокода. Почти на +каждую строчку ругается flycheck. Все очень плохо. Попробуем это исправить. + +Итак. Создадим чистый ~/.emacs.d/init.el и сразу подключаем репозитории пакетов. + +```lisp +;;; init.el --- main emacs config +;;; Commentary: +;;; Code: + +;; Packages +(require 'package) ;; You might already have this line +(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) + (not (gnutls-available-p)))) + (url (concat (if no-ssl "http" "https") "://melpa.org/packages/"))) + (add-to-list 'package-archives (cons "melpa" url) t)) +(when (< emacs-major-version 24) + ;; For important compatibility libraries like cl-lib + (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) +(package-initialize) ;; You might already have this line + +;;; init.el ends here +``` + +Следующим шагом скажем Gnu Emacs, чтобы он запускал сервер если работает на GNU/Linux или MacOS. + +```lisp +;; define system +(defun system-is-linux() + (string-equal system-type "gnu/linux")) + +(defun system-is-darwin() + (string-equal system-type "darwin")) + +;; Start Emacs as server. Linux and MacOS support +(when (or (system-is-linux) (system-is-darwin)) + (require 'server) + (unless (server-running-p) + (server-start))) +``` + +Прелесть в запуске сервера - мгновенное открытие новых окон емакс и шаринг буферов между ними. +А теперь можно начать готовить красивый конфиг разделенный по назначению. Создаем файлы +~/.emacs.d/config/common/common.el, ~/.emacs.d/config/common/packages-config.el. В packages-config.el выносим код из init.el +и оборачиваем в функцию. packages-config.el станет выглядеть примерно так: + +```lisp +;;; packages-config.el --- repo config +;;; COMMENTARY: +;;; Code: + +(require 'package) + +(defun configure-packages () + "Set MELPA and ELPA repositories." + (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) + (not (gnutls-available-p)))) + (url (concat (if no-ssl "http" "https") "://melpa.org/packages/"))) + (add-to-list 'package-archives (cons "melpa" url) t)) + (when (< emacs-major-version 24) + ;; For important compatibility libraries like cl-lib + (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) + (package-initialize)) + +(provide 'packages-config) + +;;; packages-config.el ends here + +``` + + +В common.el пишем + +```lisp +;;; common.el --- base configuration +;;; COMMENTARY: +;;; Code: + +(require 'packages-config) + +(package-install "use-package") + +(provide 'common) + +;;; common.el ends here +``` + diff --git a/content/post/i3wm-config.md b/content/post/i3wm-config.md new file mode 100644 index 0000000..14e558c --- /dev/null +++ b/content/post/i3wm-config.md @@ -0,0 +1,208 @@ ++++ +date = "2017-05-14T13:14:34+03:00" +draft = false +title = "Пилим i3wm" +comments = true +tags = ["linux", "i3wm", "polybar"] + ++++ + +Я тут на ЛОРе недавно [постил](https://www.linux.org.ru/gallery/screenshots/13401732) скриншот и, вроде, людям понравилось. +Попробую разобрать тут свой конфиг. + +## Софт + +Я использую Ubuntu 16.04, так что все действия актуальны для нее. + +* [i3-gaps](https://github.com/Airblader/i3) + +Это форк оригинального i3, где добавляются гапсы(отступы между окнами). + +Сборку и установку производим так: + +``` +git clone https://github.com/Airblader/i3 -b 4.13 +cd i3 +dpkg-checkbuilddeps # проверяем какие зависимости нужно установить для сборки пакета, устанавливаем их. +dpkg-buildpackage -uc -us # собираем пакет +sudo dpkg -i ../i3-wm_4.13-1_amd64.deb # устанавливаем +``` + +* i3lock + +Это блокировщик экрана. Ставим его из репозитория *universe*. + +* compton + +Тени, прозрачности и прочая красота. Так же ставим из официальных репозиториев. + +* [polybar](https://github.com/jaagr/polybar) + +Панель, которую я использую в качестве замены стандартного i3bar. + +Компиляем +``` +git clone --branch 3.0.5 --recursive https://github.com/jaagr/polybar +mkdir polybar/build +cd polybar/build +cmake .. +make install +``` + +* rofi + +Лаунчер. Так же ставим из репозиториев. + +* feh + +На самом деле - это просмотрщик изображений, но еще он позволяет установить обои. + +* dunst + +Уведомления(libnotify) рабочего стола. + + +## Конфигурация + +Можно приступать к настройке WM. + +~/.config/i3/config +``` +# Клавиша super в качестве модификатора +set $mod Mod4 +# Шрифты +font pango:hack 12 +# Alt в качестве модификатора для управления плавающими окнами +floating_modifier Mod1 +# Терминал +bindsym $mod+Return exec i3-sensible-terminal +# Закрытие окна +bindsym $mod+q kill + +# Запуск лаунчера +bindsym $mod+d exec rofi -show run +``` + +Для настройки цветов лаунчера в ~/.Xresources пишем: +``` +! ------------------------------------------------------------------------------ +! ROFI Color theme +! ------------------------------------------------------------------------------ +rofi.color-enabled: true +rofi.color-window: #393939, #393939, #268bd2 +rofi.color-normal: #393939, #ffffff, #393939, #268bd2, #ffffff +rofi.color-active: #393939, #268bd2, #393939, #268bd2, #205171 +rofi.color-urgent: #393939, #f3843d, #393939, #268bd2, #ffc39c +``` +[![](/images/i3wm/rofi.png)](/images/i3wm/rofi.png) +*Hint*: На сайте rofi можно найти несколько [тем](https://davedavenport.github.io/rofi/p05-Themes.html). + + +Локсрин. Биндим i3lock на $mod+l. +``` +# Lock desktop +bindsym $mod+l exec ~/.config/i3/lock.sh +``` + +Скрипт ~/.config/i3/lock.sh: +```bash +#!/bin/bash + +# Make screenshot +scrot /tmp/screen.png + +# Scale image +convert -scale 10% -scale 1000% /tmp/screen.png /tmp/screen1.png + +# Clean +rm -f /tmp/screen.png + +# Lock screen +i3lock -i /tmp/screen1.png +``` + +Выглядит это так: +[![](/images/i3wm/lock.png)](/images/i3wm/lock.png) + + +Идем дальше по конфигу. + +``` +# Переключение между окнами: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right +``` +Я не использую комбинацию $mod+jklh для переключения между окнами, мне хватает стрелочек. +По-этому можно закомментить дефолтную секцию с этими настройками. + +Я пропущу дальше секции про управление окнами, т.к. конфиг практически ничем не отличается от дефолтоного. Удаляем/комментируем секцию с i3bar. + +Убираем декорации окон +``` +# New window size +new_window pixel +``` + +Мультимедиа кнопки +``` +# Pulse Audio controls +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound + +# Sreen brightness controls +bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness +bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness +``` + +Настройка гапсов +``` +# Эта опция нужна для того, чтобы гапсы отключались, если на эркане всего одно окно. +smart_gaps on + +gaps inner 5 +gaps outer 2 +``` + +Автозапуск приложений +``` +# Обои +exec feh --bg-scale /usr/share/backgrounds/gnome/Godafoss_Iceland.jpg & +# Автоблокировка экрана через 2 минуты +exec xautolock -locker ~/.config/i3/lock.sh -time 2 & +# Апллет для управления network-manager +exec nm-applet & +# Композитор +exec compton & +# Conky +exec conky -c /home/d_zheleztsov/.conkyrc & +# Почему-то без такого костыля у меня dunst запускаться не хочет +exec killall dunst && dunst -conf /home/d_zheleztsov/.config/dunst & + +# Изменение цветовой температуры в зависимости от времени суток +exec redshift & + +# Запускаем приложения на своих рабочих столах +exec --no-startup-id i3-msg 'workspace 1; exec firefox' +exec --no-startup-id i3-msg 'workspace 2; exec gnome-terminal' +exec --no-startup-id i3-msg 'workspace 3; exec emacs25' +exec --no-startup-id i3-msg 'workspace 4; exec pidgin' +exec --no-startup-id i3-msg 'workspace 5; exec evolution' + +# Панель +exec ~/.local/bin/polybar main & +``` + +По поводу конфигурации панели будет хорошо почитать официальную [вики](https://github.com/jaagr/polybar/wiki). + +## Итоговые конфиги + +* i3: [~/.config/i3/config](https://pastebin.com/zYF5c2Yd) +* polybar: [~/.config/polybar/config](https://pastebin.com/i3Mekvuv) +* conky: [~/.conkyrc](https://pastebin.com/gz1kC6PF) + +## Что получилось + +[![](/images/i3wm/result.png)](/images/i3wm/result.png) diff --git a/content/post/logs-to-remote-logstash.md b/content/post/logs-to-remote-logstash.md new file mode 100644 index 0000000..36f3003 --- /dev/null +++ b/content/post/logs-to-remote-logstash.md @@ -0,0 +1,90 @@ ++++ +date = "2017-09-02T16:28:50+03:00" +draft = false +title = "Отправляем логи в удаленный logstash" +tags = ["linux", "elasticsearch", "logstash"] +commets = true ++++ + +Все привыкли пользоваться связкой ELK. А что делать, если хочется отправить логи +в уже существующий ELK с хоста на котором памяти в обрез? + +У меня получилось так, что на виртуалке с сайтиком всего 512Мб памяти и логстешь при запуске просто +выжирал ее всю и падал. Никакие Xmx Xms не помогали. Самое интересное, что логи-то nginx я заставил +писать в JSON, а значит logstash выступает просто проксей до эластика. + +Вот так можно заставить писать nginx в JSON. Добавляем это в nginx.conf. +``` +log_format logstash_json '{ "@timestamp": "$time_iso8601", ' + '"remote_addr": "$remote_addr", ' + '"remote_user": "$remote_user", ' + '"body_bytes_sent": "$body_bytes_sent", ' + '"request_time": "$request_time", ' + '"status": "$status", ' + '"request": "$request", ' + '"request_method": "$request_method", ' + '"http_referrer": "$http_referer", ' + '"http_user_agent": "$http_user_agent" }'; + +``` +А в конфиге сайта +``` +access_log /var/log/nginx/access.log logstash_json; +``` + +Собственно пишем конфиг удаленного логстеша: +``` +input { + tcp { + port => 12222 + host => "10.8.0.10" + codec => "json" + } +} + +output { + elasticsearch { + index => "nginx" + } +} +``` + +Теперь делаем скрипт отправки логов: +```sh +#!/bin/bash + +# /usr/local/bin/logsend.sh + +/usr/bin/tail -f /var/log/nginx/access.log | /bin/nc 10.8.0.10 12222 +``` + +И запиливаем сервис systemd и стартуем его + +``` +[Unit] +Description=Send nginx log to remote logstash + +[Service] +Type=simple +ExecStart=/usr/local/bin/logsend.sh + +[Install] +WantedBy=multi-user.target +``` + +systemctl status logsend +``` +● logsend.service - Send nginx log to remote logstash + Loaded: loaded (/etc/systemd/system/logsend.service; enabled; vendor preset: enabled) + Active: active (running) since Sat 2017-09-02 12:05:01 UTC; 1h 33min ago + Main PID: 28559 (logsend.sh) + Tasks: 3 + Memory: 484.0K + CPU: 12ms + CGroup: /system.slice/logsend.service + ├─28559 /bin/bash /usr/local/bin/logsend.sh + ├─28562 /usr/bin/tail -f /var/log/nginx/access.log + └─28563 /bin/nc 10.8.0.10 12222 +``` + +Использование памяти пол-мегабайта :). diff --git a/content/post/minsk-08-05-17.md b/content/post/minsk-08-05-17.md new file mode 100644 index 0000000..e205f86 --- /dev/null +++ b/content/post/minsk-08-05-17.md @@ -0,0 +1,29 @@ ++++ +date = "2017-05-13T22:36:15+03:00" +draft = false +title = "Минск 08.05.2017" +comments = true +tags = ["фото", "минск", "беларусь"] + ++++ + +Фотки без обработки, тупо RawTherapee -> export. + +## Верхний город + +![](/images/minsk-08-05-17/DSC_0088.jpg) +![](/images/minsk-08-05-17/DSC_0092.jpg) + + +## Центр + +![](/images/minsk-08-05-17/DSC_0096.jpg) +![](/images/minsk-08-05-17/DSC_0100.jpg) +![](/images/minsk-08-05-17/DSC_0103.jpg) + +## Площадь независимости + +![](/images/minsk-08-05-17/DSC_0113.jpg) +![](/images/minsk-08-05-17/DSC_0119.jpg) +![](/images/minsk-08-05-17/DSC_0129.jpg) +![](/images/minsk-08-05-17/DSC_0136.jpg) diff --git a/content/post/pro-idec.md b/content/post/pro-idec.md new file mode 100644 index 0000000..036a685 --- /dev/null +++ b/content/post/pro-idec.md @@ -0,0 +1,80 @@ ++++ +date = "2018-01-12T10:58:39+03:00" +draft = false +title = "Про IDEC" +tags = ["idec"] +comments = true + ++++ + +IDEC - это протокол обмена сообщениями совместимый на базовом уровне с ii. Расшифровывается, как ii-like Data Exchange Convention. +Главная фишка его - это простота и возможность работать поверх чего угодно, например, ssh. +Но практически все реализации сейчас работают поверх http. + +Цитата из официальной [документации](https://ii-net.tk/idec-doc/) + +>Есть несколько серверов (грубо говоря, сайтов), за каждым из которых закреплены свои пользователи (поинты). Поинты пишут сообщения каждый на свой сервер. +>Через каждые 10-20 минут сервера скачивают друг у друга новые сообщения. В итоге на всю сеть одна общая база данных. +>Для установления цепочек синхронизации владельцы серверов сначала договариваются. + +>Всё общение разделено на так называемые эхоконференции или эхи (см. терминология). Эха - это что-то вроде ленты твиттера или темы на форуме. +>Пользователи могут свободно подписываться на интересные им эхи и писать туда сообщения в пределах одной станции. +>Держатели серверов синхронизируют между собой (по общему согласию) самые популярные и нужные пользователям эхи, и сообщения оттуда расходятся по всей сети. + +Так при отключении одного из серверов, сообщения останутся живы на других, что дает нам такие блага, как антицензурируемость и отказоустойчивость. + +## Общение + +В стандарте предусмотрена очень полезная фича, как /list.txt(это может быть на самом деле файл или путь в строке адреса в браузере). +На запрос list.txt сервер возвращает нам список эх(публичных) с описанием и количеством сообщений в них. +Так при первом попадании на сервер, клиент сможет сразу знать какие эхи он хочет читать. + +Стандарт и все реализации серверов поддерживают создание эхи пользователем. Для этого нужно всего лишь написать в нее. Такая эха не +будет отображаться в list.txt и получить из нее сообщения можно, только зная название. Шифрования в стандарте нет, но это и не нужно, +ибо приносит только усложнение. Для приватного общения можно использовать скрытую эху и GPG. + +Личных сообщений нет, но обсуждение стандарта идет. Можно начать с чтения [этого](https://dynamic.lessmore.pw/?j=FGOqT29oVwwBElTJNMjx) треда. + +Каждое сообщение в сети уникально, т.е. ему присвается ID сгенерированный на основе суммы sha256 от контента. Это не спасает от спама, +но позволяет избежать коллизий в сети. + +## Устройство сети + +На протоколе IDEC чаще всего реализуют децентрализованную клиент-сервер сеть. +P2P не предусмотрено, но никто не мешает написать свое расширение, которое реализует P2P обмен. + +Итак, рассмотрим топологию сети от простого к сложному. + +Самая простейшая сеть выглядит так: + +![img](/images/idec/idec1.png) + +У нас есть два клиента, которые обмениваются сообщениями через сервер. Оба клиента получают сообщения из одной и той же эхи. +Все централизовано и при смерти сервера клиенты больше не смогут общаться с друг дугом. Давайте добавим еще один сервер! + +![img](/images/idec/idec2.png) + +Владельцы серверов договорились между собой обмениваться сообщениями эхи pipe.2032, теперь при выходе из строя одного из серверов +сообщения будут доступны на другом сервере. + +Добавим еще сегмент сети + +![img](/images/idec/idec3.png) + +У нас добавился еще один сегмент сети в котором происходит общение в эхах pipe.2032 и linux.14. +Так наш первый сегмент начинает обмениваться сообщениями со вторым. Добавим еще один сегмент. + +![img](/images/idec/idec4.png) + + +И еще + +![img](/images/idec/idec5.png) + +Можно еще добавить связь между серверами внутри кольца и мы получим полностью децентрализованную сеть, которая реализует +распределенную базу данных. + +IDEC позволяет строить любые топологии. Клиент может выступать так же и сервером и забирать сообщения сразу со всех серверов. +А простота протокола позволяет писать ботов очень быстро. + +В следующей статье напишем бота, который будет слать сообщения в указанную нами эху. diff --git a/content/post/python-lsp.md b/content/post/python-lsp.md new file mode 100644 index 0000000..e7fc7e4 --- /dev/null +++ b/content/post/python-lsp.md @@ -0,0 +1,142 @@ ++++ +date = "2018-07-30T15:25:28+03:00" +draft = false +title = "Автодополнение для python с LSP в GNU Emacs" +tags = ["emacs", "python"] +comments = true + ++++ + +The Language Server Protocol (LSP) -- это открытый, основанный на JSON-RPC протокол для использования между редакторами исходного кода и серверами, которые предоставляют специфические для языка программирования функции. Цель протокола заключается в том, чтобы обеспечить поддержку автодополнения языка программирования независимо от любого редактора или среды IDE. + +LSP дает реально крутые штуки, такие как: + +* Показ документации для модуля под курсором +[![documentation](/images/lsp/documentation.png)](/images/lsp/documentation.png) + +* Автодополнение по точке. На самом деле это `company-lsp`, но про это будет дальше. +[![completion](/images/lsp/completion.png)](/images/lsp/completion.png) + +* Интеграция с flycheck +[![flycheck](/images/lsp/flycheck.png)](/images/lsp/flycheck.png) + +И еще кучу всего на самом деле. Все возможные настройки можно будет увидеть по `M-x customize RET lsp RET`. + +## Конфигурация + +Для начала нужно установить сам language server для python. Для Arch/Manjaro установка будет выглядеть так: + +```sh +sudo pacman -S python-language-server +``` + +С системными зависимостями разобрались. Приступаем к `init.el`. Будем использовать `use-package`, потому что +не использовать его -- это отстой. Но каждый решает сам. + +Включаем `lsp-mode`. Да, для lsp нужно что-то, чем определить корневой каталог для проекта. +Я использую везде projectile. + +```lisp +;; LSP settings +(use-package lsp-mode + :ensure t + :config + ;; make sure we have lsp-imenu everywhere we have LSP + (require 'lsp-imenu) + (add-hook 'lsp-after-open-hook 'lsp-enable-imenu) + ;; get lsp-python-enable defined + ;; NB: use either projectile-project-root or ffip-get-project-root-directory + ;; or any other function that can be used to find the root directory of a project + (lsp-define-stdio-client lsp-python "python" + #'projectile-project-root + '("pyls")) + + ;; make sure this is activated when python-mode is activated + ;; lsp-python-enable is created by macro above + (add-hook 'python-mode-hook 'lsp-python-enable) + + ;; lsp extras + (use-package lsp-ui + :ensure t + :config + (setq lsp-ui-sideline-ignore-duplicate t) + (add-hook 'lsp-mode-hook 'lsp-ui-mode)) + + (use-package company-lsp + :config + (push 'company-lsp company-backends)) + + ;; NB: only required if you prefer flake8 instead of the default + ;; send pyls config via lsp-after-initialize-hook -- harmless for + ;; other servers due to pyls key, but would prefer only sending this + ;; when pyls gets initialised (:initialize function in + ;; lsp-define-stdio-client is invoked too early (before server + ;; start)) -- cpbotha + (defun lsp-set-cfg () + (let ((lsp-cfg `(:pyls (:configurationSources ("flake8"))))) + ;; TODO: check lsp--cur-workspace here to decide per server / project + (lsp--set-configuration lsp-cfg))) + (add-hook 'lsp-after-initialize-hook 'lsp-set-cfg)) +``` + +flake8, autopep8, fci, anaconda, rainbow-delimiters(я их везде юзаю): +```lisp +;; Python mode hook +(defun my-python-mode-hook () + "Define hook." + + (use-package flymake-python-pyflakes + :config + (setq flymake-python-pyflakes-executable "flake8") + (setq flymake-python-pyflakes-extra-arguments '("--max-line-length=99")) + (flymake-python-pyflakes-load)) + + (use-package py-autopep8 + :config + (setq py-autopep8-options '("--max-line-length=99")) + (py-autopep8-enable-on-save)) + + ;; Enable rainbow + (use-package rainbow-delimiters) + (rainbow-delimiters-mode-enable) + + (use-package highlight-indent-guides) + (use-package company) + (use-package anaconda-mode) + (use-package company-anaconda + :config + (add-to-list 'company-backends '(company-anaconda :with company-capf))) + + (use-package flycheck-pyflakes + :config + (setq flychek-flake8-maximum-line-lenght 99)) + + (setq-default py-shell-name "ipython") + (setq-default py-which-bufname "IPython") + ;; Fill column indicator + (use-package fill-column-indicator + :init + :config + (setq-default fill-column 99) + (setq fci-rule-width 1) + (setq fci-rule-color "#696969")) + + (fci-mode) + + (anaconda-mode +1) + (anaconda-eldoc-mode) + (highlight-symbol-mode +1) + (highlight-indent-guides-mode) + (company-mode)) + +(use-package python + :mode ("\\.py\\'" . python-mode) + :interpreter ("python" . python-mode) + :init + (add-hook 'python-mode-hook 'my-python-mode-hook)) +``` + +Все! + + +Спасибо вот этому [чуваку](https://vxlabs.com/2018/06/08/python-language-server-with-emacs-and-lsp-mode/). diff --git a/content/post/riga.md b/content/post/riga.md new file mode 100644 index 0000000..bc64d3a --- /dev/null +++ b/content/post/riga.md @@ -0,0 +1,53 @@ ++++ +date = "2017-05-12T14:58:34+03:00" +draft = false +title = "Рига" +tags = ["рига", "фото"] +comments = true ++++ + +Съездили тут на днях погулять в Латвию. Сели в машину и поехали. +Границу пересекали в [Бемякони](https://yandex.by/maps/?ncrnd%3D9700&mode%3Dsearch&text%3D%D0%B1%D0%B5%D0%BC%D1%8F%D0%BA%D0%BE%D0%BD%D0%B8&sll%3D27.561831,53.902257&sspn%3D0.515671,0.201936&ll%3D25.353377,54.249157&z%3D15), туда(к литовцам) въехали за два часа -- нормалек. + +Периодически шел дождь, но в целом погода была ничего. +![](/images/riga/DSC_0008.jpg) + +## Рига + +От границы до Риги дорога заняла часа 4-5. Старый город порадовал, красив. + +![](/images/riga/DSC_0100-1.jpg) +![](/images/riga/DSC_0104.jpg) +![](/images/riga/DSC_0871.jpg) +![](/images/riga/DSC_0071.jpg) +![](/images/riga/DSC_0075.jpg) + + +Заехали на море(Рижский залив точнее). Пустынный солнечный пляж - это прикольно, +но ледяной ветер не давал вдоволь насладиться видом и пробыли мы там всего минут 30. + +![](/images/riga/DSC_0019.jpg) + + +Помимо Риги заезжали еще в несколько мест. + +## Цесис +![](/images/riga/DSC_0952.jpg) +![](/images/riga/DSC_0889.jpg) + +## Бауска +![](/images/riga/DSC_0813.jpg) +![](/images/riga/DSC_0809.jpg) + +## Тракай +![](/images/riga/DSC_0963.jpg) +![](/images/riga/DSC_0982.jpg) + +## Дорога обратно + +По дороге обратно дождь чередовался с солнцем и было красиво. +![](/images/riga/DSC_0183.jpg.jpg) + +Границу пересекли вечером за 3 часа. В Минск приехали уже в час ночи. +![](/images/riga/DSC_0062.jpg.jpg) + diff --git a/content/post/sway-autotiling.md b/content/post/sway-autotiling.md new file mode 100644 index 0000000..e058a2b --- /dev/null +++ b/content/post/sway-autotiling.md @@ -0,0 +1,150 @@ ++++ +date = "2019-04-06T09:13:27+03:00" +draft = false +title = "Автоматический тайлинг в Sway" +tags = ["linux", "sway", "tiling", "i3wm"] +comments = true ++++ + +Я давно использую i3wm в работе, а после выхода версии 1.0 Sway я перешел на него с i3. +Sway -- это пракатически полностью совместимый с i3 композитор Wayland. По-этому перейти на него оказалось +очень просто. Мои конфиги Sway можно посмотреть на [Github](https://github.com/Difrex/sway). + +Почему-то я долгое время думал, что мне в i3/sway не хватает полностью ручного тайлинга, я пробовал +различные оконные менеджеры с ручным тайлингом, такие как, `bspwm`, `herbstlutfwm` и другие, но они не заходили. +Потом я решил попробовать AwesomeWM, все-таки это по сути фреймворк и на Lua можно написать все, что угодно. +В нем мне очень понравилась стандартная возможность автоматического тайлинга. Вот, что мне переодически нужно, подумал я. +Но во всех WM, что я пробовал не было нормальной поддержки скретчпадов - это такие плавающие окна, которые +большую часть времени скрыты, и показать их можно, например по комбинации клавишь. +Что же мне на самом деле хотелось от WM - скретчпады, полуручной и автоматический тайлинг, возможность менять поведение +скриптами на любом языке. По всем параметрам подходил Sway за исключением автоматического тайлинга. Было решено добавить +его самостоятельно. + +После небольшого иследования этого вопроса оказалось, что у sway есть IPC с возможностью подписки на определенные события. +Проблема возникла в том, что существующие биндинги к i3 ipc не подходили, т.к. формат дерева в JSON у Sway отличается, а так же +добавляются новые возможности, типа, получения устройств ввода, чего не было в i3. + +Так я решил написать(и написал) биндинг к Sway IPC на Go. И уже поверх этого начал писать демона, который реализует автоматический тайлинг. + +На данный момент я реализовал `spiral` layout, который работает, так как я хочу и полностью меня устраивает. Так же на начальном этапе +реализован `left` layout. Демонстрацию этих режимов можно посмотреть в видео ниже. + + + +## Как этим воспользоваться? + +Для начала нужно скомпилировать swaymgr. Из зависимостей только Go - поставь его из репозиториев твоего дистрибутива. +``` +git clone https://github.com/Difrex/gosway +cd gosway/swaymgr +go get -t -v ./... +go build -o ~/.local/bin/swaymgr +``` + +Теперь можно добавить swaymgr в конфигурацию sway. Добавь следующие строчки в `~/.config/sway/config` +``` +exec_always ~/.local/bin/swaymgr +bindsym $mod+Alt+m exec ~/.local/bin/swaymgr -s 'set manual' +bindsym $mod+Alt+l exec ~/.local/bin/swaymgr -s 'set left' +bindsym $mod+Alt+s exec ~/.local/bin/swaymgr -s 'set spiral' +``` + +Комбинации клавишь меняй по своему вкусу. + +Swaymgr запоминает свою расскладку для каждого рабочего стола, а состояние хранит в `~/.autotiling.bolt`. +В репозитории ты так же найдешь скрипт, который можно использовать, например, с `i3blocks`. + +## Про внутреннее устройство + +Если вдруг тебе захочется помочь в разработке, то вот небольшой гайд по тому, как правильно это сделать. + +Swaymgr -- это отлельное приложение, которое использует `gosway/ipc`. + +Для того, чтобы взаимодействовать со Sway через unix-socket необходимо два подключения: + +1. Соединение для передачи различных комманд +2. Соединение на которое будут приниматься события от оконного менеджера + +Так же для хранения настроек рабочих столов используется встроенная, минималистичная база данных Bolt. Функция `newManager() (*manager, error)` создает все необходимые подключения и вызывает функцию инициализации интерфейсов `Layout`. +Возвращаемая структура имеет такой вид: +```go +type manager struct { + commandConn *ipc.SwayConnection + listenerConn *ipc.SwayConnection + store *store + layouts map[string]Layout +} +``` + +Главный интерфейс, с помощью которого реализуются все режимы -- Layout, выглядит он так: +Файл `swaymgr/layouts.go` +```go +type Layout interface { + // PlaceWindow must receive an *ipc.Event + // and do the container manipulation + PlaceWindow(*ipc.Event) error + // Manage must store WorkspaceConfig in the database with + // the workspace name, layout name and with the Managed: true + Manage() error +} +``` + +У этого интерфейса есть всего два метода: + +* `Manage() error` -- вызывается тогда, когда текущий рабочий стол переключается в какой-либо режим +* `PlaceWindow(*ipc.Event) error` -- вызывается тогда, когда создается новый контейнер на рабочем столе, который является управляемым. + +### Как работает spiral layout + +Я рассмотрю управлене окнами на примере реализации режима spiral. + +Структура этого режима состоит всего из двух полей: + +* `Conn *ipc.SwayConnection` -- Коммандное подключение к unix-сокету Sway +* `store *store` -- Открытое соединение к базе данных, в котой хранятся текущие настройки рабочих столов + +При наступлении события создания нового окна, и если текущий рабочий стол управляется, данное событие передается в метод `PlaceWindow(event *ipc.Event)`. +Для начала необходимо найти текущее окно на котором находится фокус: +```go +nodes, err := s.Conn.GetFocusedWorkspaceWindows() +if err != nil { + return err +} +var result ipc.Node +for _, node := range nodes { + if node.Focused { + result = node + break + } +} +``` + +Далее вся логика позиционированния окон помещается в 7 строчек: +```go +if result.WindowRect.Width > result.WindowRect.Height { + _, err := s.Conn.RunSwayCommand(fmt.Sprintf("[con_id=%d] split h", event.Container.ID)) + return err +} else { + _, err := s.Conn.RunSwayCommand(fmt.Sprintf("[con_id=%d] split v", event.Container.ID)) + return err +} +``` + +Если у окна с фокусом длина больше ширины, то новый контейнер разделяем по горизонтали, иначе по вертикали. Все. Это работает замечательно и эту логику работы менять я не буду. + +## Зарезервированные режимы + +Я заранее зарезервировал некоторые режимы которые очень хочется реализовать. +Вот они: + +* `type FiberLayout struct{}` -- режим подсмотренный в AwesomeWM. Окна размещаются симметрично друг под другом и вдоль +* `type TopLayout struct{}` -- самое большое окно размещается вверху экрана, остальные внизу разделяясь по горизонтали +* `type BottomLayout struct{}` -- тоже самое, что и для TopLayout, но главное окно находится внизу +* `type RightLayout struct{}` -- тоже самое, что и LeftLayout, но главное окно размещается справа + +Проект на [Github](http://github.com/Difrex/gosway). Учитывай, что это пока самая ранняя реализация и тут могут быть баги в больших +колличествах, правда ничего критичного я пока не находил -- пользоваться можно. +Буду очень рад баг-репортам и фич-реквестам, а так же особенно пулл-реквестам. Лицензия проекта: Apache. diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..91bdc41 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,46 @@ + + + + + {{ partial "head.html" . }} + + + +
+ {{ partial "header.html" . }} +
+
+ {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} {{ range $paginator.Pages }} +
+

{{ .Title }}

+ + {{ if .Params.tags }} + + {{ end }} + {{ if .Site.Params.Summary }} +
+ {{ .Summary }} + +
+ {{ else if .Site.Params.Content }} +
+ {{ .Content }} +
+ {{ end }} +
+ {{ end }} +
+ {{ partial "pagination.html" . }} +
+ {{ partial "footer.html" . }} +
+ + {{ with .Site.Params.AnalyticsID }}{{ partial "analytics.html" . }}{{ end }} + + + + diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml new file mode 100644 index 0000000..9b7e291 --- /dev/null +++ b/layouts/_default/rss.xml @@ -0,0 +1,24 @@ + + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{ .Permalink }} + Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} + Hugo -- gohugo.io{{ with .Site.LanguageCode }} + {{.}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} + {{.}}{{end}}{{ if not .Date.IsZero }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + + {{ range .Data.Pages }} + + {{ .Title }} + {{ .Permalink }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ .Permalink }} + {{ .Content | html }} + + {{ end }} + + diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..98a3fbc --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,26 @@ + + + + + {{ partial "head.html" . }} + + + +
+ {{ partial "header.html" . }} +
+
+

{{ .Title }}

+
+ {{ .Content }} +
+
+
+ {{ partial "footer.html" . }} +
+ + {{ with .Site.Params.AnalyticsID }}{{ partial "analytics.html" . }}{{ end }} + + + + \ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..c71c2ac --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,47 @@ + + + + + {{ partial "head.html" . }} + + + + +
+ {{ partial "header.html" . }} +
+
+ {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} {{ range $paginator.Pages }} +
+

{{ .Title }}

+ + {{ if .Params.tags }} + + {{ end }} + {{ if .Site.Params.Summary }} +
+ {{ .Summary }} + +
+ {{ else if .Site.Params.Content }} +
+ {{ .Content }} +
+ {{ end }} +
+ {{ end }} +
+ {{ partial "pagination.html" . }} +
+ {{ partial "footer.html" . }} +
+ + {{ with .Site.Params.AnalyticsID }}{{ partial "analytics.html" . }}{{ end }} + + + + diff --git a/layouts/pages/single.html b/layouts/pages/single.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/analytics.html b/layouts/partials/analytics.html new file mode 100644 index 0000000..c2434f2 --- /dev/null +++ b/layouts/partials/analytics.html @@ -0,0 +1,10 @@ + diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..6dfcf34 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,11 @@ + diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..a2b0088 --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,17 @@ + + + {{ .Title }} + + + + + + + + + + +{{ if .RSSLink }} + + +{{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..7e97a4f --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1 @@ + diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html new file mode 100644 index 0000000..b5b408a --- /dev/null +++ b/layouts/partials/pagination.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/layouts/post/single.html b/layouts/post/single.html new file mode 100644 index 0000000..ccad759 --- /dev/null +++ b/layouts/post/single.html @@ -0,0 +1,68 @@ + + + + + {{ partial "head.html" . }} + + + + + + + +
+ {{ partial "header.html" . }} +
+
+
+

{{ .Title }}

+ +
+ {{ .Content }} +
+
+ +
+ + +
+ +
+
+ {{ if .Params.comments }} +
+ + + {{ end }} + + + + + {{ with .Site.Params.AnalyticsID }}{{ partial "analytics.html" . }}{{ end }} + + + diff --git a/static/images/Feed-icon.svg b/static/images/Feed-icon.svg new file mode 100644 index 0000000..b325149 --- /dev/null +++ b/static/images/Feed-icon.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/static/images/anomalies/12hours.png b/static/images/anomalies/12hours.png new file mode 100644 index 0000000..f68f132 Binary files /dev/null and b/static/images/anomalies/12hours.png differ diff --git a/static/images/anomalies/1hour.png b/static/images/anomalies/1hour.png new file mode 100644 index 0000000..4d8f24c Binary files /dev/null and b/static/images/anomalies/1hour.png differ diff --git a/static/images/anomalies/1min.png b/static/images/anomalies/1min.png new file mode 100644 index 0000000..135c1fb Binary files /dev/null and b/static/images/anomalies/1min.png differ diff --git a/static/images/anomalies/24hours.png b/static/images/anomalies/24hours.png new file mode 100644 index 0000000..af88eb6 Binary files /dev/null and b/static/images/anomalies/24hours.png differ diff --git a/static/images/anomalies/debug.png b/static/images/anomalies/debug.png new file mode 100644 index 0000000..836dcc0 Binary files /dev/null and b/static/images/anomalies/debug.png differ diff --git a/static/images/anomalies/wodebug.png b/static/images/anomalies/wodebug.png new file mode 100644 index 0000000..5fd8a89 Binary files /dev/null and b/static/images/anomalies/wodebug.png differ diff --git a/static/images/ava.jpg b/static/images/ava.jpg new file mode 100644 index 0000000..db6842d Binary files /dev/null and b/static/images/ava.jpg differ diff --git a/static/images/emacs-colors/emacs24bit.png b/static/images/emacs-colors/emacs24bit.png new file mode 100644 index 0000000..1fafd28 Binary files /dev/null and b/static/images/emacs-colors/emacs24bit.png differ diff --git a/static/images/emacs-colors/emacs256.png b/static/images/emacs-colors/emacs256.png new file mode 100644 index 0000000..6c8a5ae Binary files /dev/null and b/static/images/emacs-colors/emacs256.png differ diff --git a/static/images/folkfest/1.jpg b/static/images/folkfest/1.jpg new file mode 100644 index 0000000..a43396e Binary files /dev/null and b/static/images/folkfest/1.jpg differ diff --git a/static/images/folkfest/10.jpg b/static/images/folkfest/10.jpg new file mode 100644 index 0000000..5dd20eb Binary files /dev/null and b/static/images/folkfest/10.jpg differ diff --git a/static/images/folkfest/11.jpg b/static/images/folkfest/11.jpg new file mode 100644 index 0000000..b61adb2 Binary files /dev/null and b/static/images/folkfest/11.jpg differ diff --git a/static/images/folkfest/12.jpg b/static/images/folkfest/12.jpg new file mode 100644 index 0000000..3866302 Binary files /dev/null and b/static/images/folkfest/12.jpg differ diff --git a/static/images/folkfest/13.jpg b/static/images/folkfest/13.jpg new file mode 100644 index 0000000..9b41114 Binary files /dev/null and b/static/images/folkfest/13.jpg differ diff --git a/static/images/folkfest/14.jpg b/static/images/folkfest/14.jpg new file mode 100644 index 0000000..53d936f Binary files /dev/null and b/static/images/folkfest/14.jpg differ diff --git a/static/images/folkfest/15.jpg b/static/images/folkfest/15.jpg new file mode 100644 index 0000000..fe09223 Binary files /dev/null and b/static/images/folkfest/15.jpg differ diff --git a/static/images/folkfest/16.jpg b/static/images/folkfest/16.jpg new file mode 100644 index 0000000..d8a0563 Binary files /dev/null and b/static/images/folkfest/16.jpg differ diff --git a/static/images/folkfest/17.jpg b/static/images/folkfest/17.jpg new file mode 100644 index 0000000..88cfee7 Binary files /dev/null and b/static/images/folkfest/17.jpg differ diff --git a/static/images/folkfest/18.jpg b/static/images/folkfest/18.jpg new file mode 100644 index 0000000..12d8ed2 Binary files /dev/null and b/static/images/folkfest/18.jpg differ diff --git a/static/images/folkfest/19.jpg b/static/images/folkfest/19.jpg new file mode 100644 index 0000000..2e43bae Binary files /dev/null and b/static/images/folkfest/19.jpg differ diff --git a/static/images/folkfest/2.jpg b/static/images/folkfest/2.jpg new file mode 100644 index 0000000..5cbf5a2 Binary files /dev/null and b/static/images/folkfest/2.jpg differ diff --git a/static/images/folkfest/20.jpg b/static/images/folkfest/20.jpg new file mode 100644 index 0000000..2c531cc Binary files /dev/null and b/static/images/folkfest/20.jpg differ diff --git a/static/images/folkfest/21.jpg b/static/images/folkfest/21.jpg new file mode 100644 index 0000000..45bbf68 Binary files /dev/null and b/static/images/folkfest/21.jpg differ diff --git a/static/images/folkfest/22.jpg b/static/images/folkfest/22.jpg new file mode 100644 index 0000000..0103edd Binary files /dev/null and b/static/images/folkfest/22.jpg differ diff --git a/static/images/folkfest/23.jpg b/static/images/folkfest/23.jpg new file mode 100644 index 0000000..d66fbdc Binary files /dev/null and b/static/images/folkfest/23.jpg differ diff --git a/static/images/folkfest/24.jpg b/static/images/folkfest/24.jpg new file mode 100644 index 0000000..eb4f5ea Binary files /dev/null and b/static/images/folkfest/24.jpg differ diff --git a/static/images/folkfest/25.jpg b/static/images/folkfest/25.jpg new file mode 100644 index 0000000..a1c9974 Binary files /dev/null and b/static/images/folkfest/25.jpg differ diff --git a/static/images/folkfest/26.jpg b/static/images/folkfest/26.jpg new file mode 100644 index 0000000..e67c118 Binary files /dev/null and b/static/images/folkfest/26.jpg differ diff --git a/static/images/folkfest/27.jpg b/static/images/folkfest/27.jpg new file mode 100644 index 0000000..4e55937 Binary files /dev/null and b/static/images/folkfest/27.jpg differ diff --git a/static/images/folkfest/28.jpg b/static/images/folkfest/28.jpg new file mode 100644 index 0000000..0471495 Binary files /dev/null and b/static/images/folkfest/28.jpg differ diff --git a/static/images/folkfest/29.jpg b/static/images/folkfest/29.jpg new file mode 100644 index 0000000..be6797b Binary files /dev/null and b/static/images/folkfest/29.jpg differ diff --git a/static/images/folkfest/3.jpg b/static/images/folkfest/3.jpg new file mode 100644 index 0000000..b9f8bda Binary files /dev/null and b/static/images/folkfest/3.jpg differ diff --git a/static/images/folkfest/30.jpg b/static/images/folkfest/30.jpg new file mode 100644 index 0000000..d00a8ff Binary files /dev/null and b/static/images/folkfest/30.jpg differ diff --git a/static/images/folkfest/31.jpg b/static/images/folkfest/31.jpg new file mode 100644 index 0000000..8fc10dd Binary files /dev/null and b/static/images/folkfest/31.jpg differ diff --git a/static/images/folkfest/4.jpg b/static/images/folkfest/4.jpg new file mode 100644 index 0000000..bf6411b Binary files /dev/null and b/static/images/folkfest/4.jpg differ diff --git a/static/images/folkfest/5.jpg b/static/images/folkfest/5.jpg new file mode 100644 index 0000000..1a3b2ba Binary files /dev/null and b/static/images/folkfest/5.jpg differ diff --git a/static/images/folkfest/6.jpg b/static/images/folkfest/6.jpg new file mode 100644 index 0000000..be04297 Binary files /dev/null and b/static/images/folkfest/6.jpg differ diff --git a/static/images/folkfest/7.jpg b/static/images/folkfest/7.jpg new file mode 100644 index 0000000..e88795e Binary files /dev/null and b/static/images/folkfest/7.jpg differ diff --git a/static/images/folkfest/8.jpg b/static/images/folkfest/8.jpg new file mode 100644 index 0000000..bd5861c Binary files /dev/null and b/static/images/folkfest/8.jpg differ diff --git a/static/images/folkfest/9.jpg b/static/images/folkfest/9.jpg new file mode 100644 index 0000000..c9338a2 Binary files /dev/null and b/static/images/folkfest/9.jpg differ diff --git a/static/images/gnus/dunst.png b/static/images/gnus/dunst.png new file mode 100644 index 0000000..205e58a Binary files /dev/null and b/static/images/gnus/dunst.png differ diff --git a/static/images/gnus/gnus_groups.png b/static/images/gnus/gnus_groups.png new file mode 100644 index 0000000..f92da91 Binary files /dev/null and b/static/images/gnus/gnus_groups.png differ diff --git a/static/images/gnus/gnus_view_group.png b/static/images/gnus/gnus_view_group.png new file mode 100644 index 0000000..bf23226 Binary files /dev/null and b/static/images/gnus/gnus_view_group.png differ diff --git a/static/images/gnus/i3bar.png b/static/images/gnus/i3bar.png new file mode 100644 index 0000000..e5a6d04 Binary files /dev/null and b/static/images/gnus/i3bar.png differ diff --git a/static/images/i3wm/lock.png b/static/images/i3wm/lock.png new file mode 100644 index 0000000..d287644 Binary files /dev/null and b/static/images/i3wm/lock.png differ diff --git a/static/images/i3wm/result.png b/static/images/i3wm/result.png new file mode 100644 index 0000000..b9fbb29 Binary files /dev/null and b/static/images/i3wm/result.png differ diff --git a/static/images/i3wm/rofi.png b/static/images/i3wm/rofi.png new file mode 100644 index 0000000..f24a143 Binary files /dev/null and b/static/images/i3wm/rofi.png differ diff --git a/static/images/idec/idec1.png b/static/images/idec/idec1.png new file mode 100644 index 0000000..8671831 Binary files /dev/null and b/static/images/idec/idec1.png differ diff --git a/static/images/idec/idec2.png b/static/images/idec/idec2.png new file mode 100644 index 0000000..52e3f26 Binary files /dev/null and b/static/images/idec/idec2.png differ diff --git a/static/images/idec/idec3.png b/static/images/idec/idec3.png new file mode 100644 index 0000000..fc3ac6a Binary files /dev/null and b/static/images/idec/idec3.png differ diff --git a/static/images/idec/idec4.png b/static/images/idec/idec4.png new file mode 100644 index 0000000..e0e05e6 Binary files /dev/null and b/static/images/idec/idec4.png differ diff --git a/static/images/idec/idec5.png b/static/images/idec/idec5.png new file mode 100644 index 0000000..a1ecab2 Binary files /dev/null and b/static/images/idec/idec5.png differ diff --git a/static/images/lsp/completion.png b/static/images/lsp/completion.png new file mode 100644 index 0000000..9d7c4d1 Binary files /dev/null and b/static/images/lsp/completion.png differ diff --git a/static/images/lsp/documentation.png b/static/images/lsp/documentation.png new file mode 100644 index 0000000..bfc34cf Binary files /dev/null and b/static/images/lsp/documentation.png differ diff --git a/static/images/lsp/flycheck.png b/static/images/lsp/flycheck.png new file mode 100644 index 0000000..d4f89a7 Binary files /dev/null and b/static/images/lsp/flycheck.png differ diff --git a/static/images/minsk-08-05-17/DSC_0088.jpg b/static/images/minsk-08-05-17/DSC_0088.jpg new file mode 100644 index 0000000..3a661a2 Binary files /dev/null and b/static/images/minsk-08-05-17/DSC_0088.jpg differ diff --git a/static/images/minsk-08-05-17/DSC_0092.jpg b/static/images/minsk-08-05-17/DSC_0092.jpg new file mode 100644 index 0000000..ffff784 Binary files /dev/null and b/static/images/minsk-08-05-17/DSC_0092.jpg differ diff --git a/static/images/minsk-08-05-17/DSC_0096.jpg b/static/images/minsk-08-05-17/DSC_0096.jpg new file mode 100644 index 0000000..a011162 Binary files /dev/null and b/static/images/minsk-08-05-17/DSC_0096.jpg differ diff --git a/static/images/minsk-08-05-17/DSC_0100.jpg b/static/images/minsk-08-05-17/DSC_0100.jpg new file mode 100644 index 0000000..11e8fcb Binary files /dev/null and b/static/images/minsk-08-05-17/DSC_0100.jpg differ diff --git a/static/images/minsk-08-05-17/DSC_0103.jpg b/static/images/minsk-08-05-17/DSC_0103.jpg new file mode 100644 index 0000000..5767da8 Binary files /dev/null and b/static/images/minsk-08-05-17/DSC_0103.jpg differ diff --git a/static/images/minsk-08-05-17/DSC_0113.jpg b/static/images/minsk-08-05-17/DSC_0113.jpg new file mode 100644 index 0000000..63a7e6b Binary files /dev/null and b/static/images/minsk-08-05-17/DSC_0113.jpg differ diff --git a/static/images/minsk-08-05-17/DSC_0119.jpg b/static/images/minsk-08-05-17/DSC_0119.jpg new file mode 100644 index 0000000..6a1dec8 Binary files /dev/null and b/static/images/minsk-08-05-17/DSC_0119.jpg differ diff --git a/static/images/minsk-08-05-17/DSC_0129.jpg b/static/images/minsk-08-05-17/DSC_0129.jpg new file mode 100644 index 0000000..37e439e Binary files /dev/null and b/static/images/minsk-08-05-17/DSC_0129.jpg differ diff --git a/static/images/minsk-08-05-17/DSC_0136.jpg b/static/images/minsk-08-05-17/DSC_0136.jpg new file mode 100644 index 0000000..b70c92a Binary files /dev/null and b/static/images/minsk-08-05-17/DSC_0136.jpg differ diff --git a/static/images/riga/DSC_0008.jpg b/static/images/riga/DSC_0008.jpg new file mode 100644 index 0000000..a49d7f1 Binary files /dev/null and b/static/images/riga/DSC_0008.jpg differ diff --git a/static/images/riga/DSC_0019.jpg b/static/images/riga/DSC_0019.jpg new file mode 100644 index 0000000..f1a380c Binary files /dev/null and b/static/images/riga/DSC_0019.jpg differ diff --git a/static/images/riga/DSC_0062.jpg.jpg b/static/images/riga/DSC_0062.jpg.jpg new file mode 100644 index 0000000..d8936ea Binary files /dev/null and b/static/images/riga/DSC_0062.jpg.jpg differ diff --git a/static/images/riga/DSC_0071.jpg b/static/images/riga/DSC_0071.jpg new file mode 100644 index 0000000..6647bd0 Binary files /dev/null and b/static/images/riga/DSC_0071.jpg differ diff --git a/static/images/riga/DSC_0075.jpg b/static/images/riga/DSC_0075.jpg new file mode 100644 index 0000000..81ad0cc Binary files /dev/null and b/static/images/riga/DSC_0075.jpg differ diff --git a/static/images/riga/DSC_0100-1.jpg b/static/images/riga/DSC_0100-1.jpg new file mode 100644 index 0000000..2c88758 Binary files /dev/null and b/static/images/riga/DSC_0100-1.jpg differ diff --git a/static/images/riga/DSC_0104.jpg b/static/images/riga/DSC_0104.jpg new file mode 100644 index 0000000..5da4142 Binary files /dev/null and b/static/images/riga/DSC_0104.jpg differ diff --git a/static/images/riga/DSC_0183.jpg.jpg b/static/images/riga/DSC_0183.jpg.jpg new file mode 100644 index 0000000..3ae255f Binary files /dev/null and b/static/images/riga/DSC_0183.jpg.jpg differ diff --git a/static/images/riga/DSC_0809.jpg b/static/images/riga/DSC_0809.jpg new file mode 100644 index 0000000..4772eb7 Binary files /dev/null and b/static/images/riga/DSC_0809.jpg differ diff --git a/static/images/riga/DSC_0813.jpg b/static/images/riga/DSC_0813.jpg new file mode 100644 index 0000000..2ea1c37 Binary files /dev/null and b/static/images/riga/DSC_0813.jpg differ diff --git a/static/images/riga/DSC_0871.jpg b/static/images/riga/DSC_0871.jpg new file mode 100644 index 0000000..82d26f8 Binary files /dev/null and b/static/images/riga/DSC_0871.jpg differ diff --git a/static/images/riga/DSC_0889.jpg b/static/images/riga/DSC_0889.jpg new file mode 100644 index 0000000..4ccd4ca Binary files /dev/null and b/static/images/riga/DSC_0889.jpg differ diff --git a/static/images/riga/DSC_0952.jpg b/static/images/riga/DSC_0952.jpg new file mode 100644 index 0000000..2fbbc03 Binary files /dev/null and b/static/images/riga/DSC_0952.jpg differ diff --git a/static/images/riga/DSC_0963.jpg b/static/images/riga/DSC_0963.jpg new file mode 100644 index 0000000..635fbe3 Binary files /dev/null and b/static/images/riga/DSC_0963.jpg differ diff --git a/static/images/riga/DSC_0982.jpg b/static/images/riga/DSC_0982.jpg new file mode 100644 index 0000000..9f94996 Binary files /dev/null and b/static/images/riga/DSC_0982.jpg differ diff --git a/static/video/Swaymgr.mp4 b/static/video/Swaymgr.mp4 new file mode 100644 index 0000000..18915ae Binary files /dev/null and b/static/video/Swaymgr.mp4 differ diff --git a/themes/slim/.gitignore b/themes/slim/.gitignore new file mode 100644 index 0000000..ba49d74 --- /dev/null +++ b/themes/slim/.gitignore @@ -0,0 +1,2 @@ +src +node_modules diff --git a/themes/slim/LICENSE.md b/themes/slim/LICENSE.md new file mode 100644 index 0000000..32fea66 --- /dev/null +++ b/themes/slim/LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 YOUR_NAME_HERE + +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. diff --git a/themes/slim/README.md b/themes/slim/README.md new file mode 100644 index 0000000..fc02f7d --- /dev/null +++ b/themes/slim/README.md @@ -0,0 +1,64 @@ +# Slim + +Slim is a minimal, clean and beautiful theme for [Hugo](http://gohugo.io/). + +![Slim screenshot](https://github.com/zhe/hugo-theme-slim/blob/master/images/screenshot.png) + +[Demo](http://themes.gohugo.io/theme/slim). + +## Installation + +``` +mkdir themes +cd themes +git clone https://github.com/zhe/hugo-theme-slim slim +``` + +See the [official docs](http://gohugo.io/themes/installing) for more information. + +## Configuration +You could add `params` into your site's `config.toml` file: + +``` +[params] + Subtitle = "Your site's subtitle/tagline" + GithubID = "Your Github ID" + TwitterID = "Your Twitter ID" + AnalyticsID = "Your Google Analytics tracking code" + DisqusShortname = "Your Disqus shortname" + Summary = true # takes true or false + Content = false # takes true or false + # if both are set to true, summary is shown. + # FooterMsg = "Copyright Me 2016. Powered by Hugo." +``` + +if you use `config.yaml`, it could look like: + +``` +params: + Subtitle: "Your site's subtitle/tagline" + GithubID: "Your Github ID" + TwitterID: "Your Twitter ID" + AnalyticsID: "Your Google Analytics tracking code" + DisqusShortname: "Your Disqus shortname" + Summary: true # takes true or false + Content: false # takes true or false + # if both are set to true, summary is shown + # FooterMsg: "Custom footer message. Powered by Hugo." +``` + +### Enable Disqus to your post + +1. Add your Disqus Shortname to the site config file; +2. You can enable Disqus per-post, by adding `comments: true` (YAML) or `comments = true` (TOML) in the front matter of your post. To disable it, you can either change the value to `false` or just not include `comments` variable and its value at all. + +## Build your site + +``` +hugo server -t slim +``` + + +## License + +Open sourced under [MIT license](https://github.com/zhe/hugo-theme-slim/blob/master/LICENSE.md). diff --git a/themes/slim/gulpfile.babel.js b/themes/slim/gulpfile.babel.js new file mode 100644 index 0000000..839cf63 --- /dev/null +++ b/themes/slim/gulpfile.babel.js @@ -0,0 +1,31 @@ +// Gulpfile.js for Hugo Theme – Slim +// Git repo: https://github.com/zhe/hugo-theme-slim + +// This gulpfile makes use of new JavaScript features. +// Babel handles this without us having to do anything. It just works. +// You can read more about the new JavaScript features here: +// https://babeljs.io/docs/learn-es2015/ + +import gulp from 'gulp'; +import gulpLoadPlugins from 'gulp-load-plugins'; + +const $ = gulpLoadPlugins(); +const options = { + +}; + +// Compile and prefix stylesheets +gulp.task('style', () => { + return gulp.src('src/sass/*.scss') + .pipe($.sourcemaps.init()) + .pipe($.sass().sync({ + outputStyle: 'expanded', + precision: 10, + includePaths: ['.'], + }).on('error', $.sass.logError)) + .pipe($.autoprefixer({ + browsers: ['last 2 version'], + })) + .pipe($.sourcemaps.write()) + .pipe(gulp.dest('static/css')); +}); diff --git a/themes/slim/images/screenshot.png b/themes/slim/images/screenshot.png new file mode 100644 index 0000000..c542404 Binary files /dev/null and b/themes/slim/images/screenshot.png differ diff --git a/themes/slim/images/tn.png b/themes/slim/images/tn.png new file mode 100644 index 0000000..c92ccb4 Binary files /dev/null and b/themes/slim/images/tn.png differ diff --git a/themes/slim/layouts/_default/list.html b/themes/slim/layouts/_default/list.html new file mode 100644 index 0000000..91bdc41 --- /dev/null +++ b/themes/slim/layouts/_default/list.html @@ -0,0 +1,46 @@ + + + + + {{ partial "head.html" . }} + + + +
+ {{ partial "header.html" . }} +
+
+ {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} {{ range $paginator.Pages }} +
+

{{ .Title }}

+ + {{ if .Params.tags }} + + {{ end }} + {{ if .Site.Params.Summary }} +
+ {{ .Summary }} + +
+ {{ else if .Site.Params.Content }} +
+ {{ .Content }} +
+ {{ end }} +
+ {{ end }} +
+ {{ partial "pagination.html" . }} +
+ {{ partial "footer.html" . }} +
+ + {{ with .Site.Params.AnalyticsID }}{{ partial "analytics.html" . }}{{ end }} + + + + diff --git a/themes/slim/layouts/_default/single.html b/themes/slim/layouts/_default/single.html new file mode 100644 index 0000000..98a3fbc --- /dev/null +++ b/themes/slim/layouts/_default/single.html @@ -0,0 +1,26 @@ + + + + + {{ partial "head.html" . }} + + + +
+ {{ partial "header.html" . }} +
+
+

{{ .Title }}

+
+ {{ .Content }} +
+
+
+ {{ partial "footer.html" . }} +
+ + {{ with .Site.Params.AnalyticsID }}{{ partial "analytics.html" . }}{{ end }} + + + + \ No newline at end of file diff --git a/themes/slim/layouts/index.html b/themes/slim/layouts/index.html new file mode 100644 index 0000000..91bdc41 --- /dev/null +++ b/themes/slim/layouts/index.html @@ -0,0 +1,46 @@ + + + + + {{ partial "head.html" . }} + + + +
+ {{ partial "header.html" . }} +
+
+ {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} {{ range $paginator.Pages }} +
+

{{ .Title }}

+ + {{ if .Params.tags }} + + {{ end }} + {{ if .Site.Params.Summary }} +
+ {{ .Summary }} + +
+ {{ else if .Site.Params.Content }} +
+ {{ .Content }} +
+ {{ end }} +
+ {{ end }} +
+ {{ partial "pagination.html" . }} +
+ {{ partial "footer.html" . }} +
+ + {{ with .Site.Params.AnalyticsID }}{{ partial "analytics.html" . }}{{ end }} + + + + diff --git a/themes/slim/layouts/pages/single.html b/themes/slim/layouts/pages/single.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/slim/layouts/partials/analytics.html b/themes/slim/layouts/partials/analytics.html new file mode 100644 index 0000000..c2434f2 --- /dev/null +++ b/themes/slim/layouts/partials/analytics.html @@ -0,0 +1,10 @@ + diff --git a/themes/slim/layouts/partials/footer.html b/themes/slim/layouts/partials/footer.html new file mode 100644 index 0000000..f2d0326 --- /dev/null +++ b/themes/slim/layouts/partials/footer.html @@ -0,0 +1,7 @@ + diff --git a/themes/slim/layouts/partials/head.html b/themes/slim/layouts/partials/head.html new file mode 100644 index 0000000..cb698f0 --- /dev/null +++ b/themes/slim/layouts/partials/head.html @@ -0,0 +1,14 @@ + + + {{ .Title }} · {{ .Site.Title }} + + + + + + + + + + + diff --git a/themes/slim/layouts/partials/header.html b/themes/slim/layouts/partials/header.html new file mode 100644 index 0000000..4cc3b20 --- /dev/null +++ b/themes/slim/layouts/partials/header.html @@ -0,0 +1,19 @@ +
+

{{ .Site.Title }}

+

{{ .Site.Params.Subtitle }}

+ +
\ No newline at end of file diff --git a/themes/slim/layouts/partials/pagination.html b/themes/slim/layouts/partials/pagination.html new file mode 100644 index 0000000..b5b408a --- /dev/null +++ b/themes/slim/layouts/partials/pagination.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/themes/slim/layouts/post/single.html b/themes/slim/layouts/post/single.html new file mode 100644 index 0000000..05b5311 --- /dev/null +++ b/themes/slim/layouts/post/single.html @@ -0,0 +1,52 @@ + + + + + {{ partial "head.html" . }} + + + +
+ {{ partial "header.html" . }} +
+
+
+

{{ .Title }}

+ +
+ {{ .Content }} +
+
+ +
+
+ {{ if .Params.comments }} +
+ + + {{ end }} + {{ partial "footer.html" . }} +
+ + + + {{ with .Site.Params.AnalyticsID }}{{ partial "analytics.html" . }}{{ end }} + + + diff --git a/themes/slim/package.json b/themes/slim/package.json new file mode 100644 index 0000000..e3a87fc --- /dev/null +++ b/themes/slim/package.json @@ -0,0 +1,26 @@ +{ + "name": "hugo-theme-slim", + "description": "Slim is a minimal, clean and beautiful theme for [Hugo](http://gohugo.io/).", + "version": "1.0.0", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://zhe@github.com/zhe/hugo-theme-slim.git" + }, + "author": "Zhe Zhang", + "license": "ISC", + "bugs": { + "url": "https://github.com/zhe/hugo-theme-slim/issues" + }, + "homepage": "https://github.com/zhe/hugo-theme-slim#readme", + "devDependencies": { + "babel": "^5.8.21", + "gulp": "^3.9.0", + "gulp-autoprefixer": "^2.3.1", + "gulp-load-plugins": "^1.0.0-rc.1", + "gulp-sass": "^2.0.4", + "gulp-sourcemaps": "^1.5.2" + } +} diff --git a/themes/slim/static/css/highlight.min.css b/themes/slim/static/css/highlight.min.css new file mode 100644 index 0000000..77ff6fa --- /dev/null +++ b/themes/slim/static/css/highlight.min.css @@ -0,0 +1 @@ +.hljs{display:block;overflow-x:auto;padding:0.5em;background:#f9f9f9;-webkit-text-size-adjust:none}.hljs,.hljs-subst,.hljs-tag .hljs-title,.nginx .hljs-title{color:black}.hljs-string,.hljs-title,.hljs-constant,.hljs-parent,.hljs-tag .hljs-value,.hljs-rule .hljs-value,.hljs-preprocessor,.hljs-pragma,.hljs-name,.haml .hljs-symbol,.ruby .hljs-symbol,.ruby .hljs-symbol .hljs-string,.hljs-template_tag,.django .hljs-variable,.smalltalk .hljs-class,.hljs-addition,.hljs-flow,.hljs-stream,.bash .hljs-variable,.pf .hljs-variable,.apache .hljs-tag,.apache .hljs-cbracket,.tex .hljs-command,.tex .hljs-special,.erlang_repl .hljs-function_or_atom,.asciidoc .hljs-header,.markdown .hljs-header,.coffeescript .hljs-attribute{color:#800}.smartquote,.hljs-comment,.hljs-annotation,.diff .hljs-header,.hljs-chunk,.asciidoc .hljs-blockquote,.markdown .hljs-blockquote{color:#888}.hljs-number,.hljs-date,.hljs-regexp,.hljs-literal,.hljs-hexcolor,.smalltalk .hljs-symbol,.smalltalk .hljs-char,.go .hljs-constant,.hljs-change,.lasso .hljs-variable,.makefile .hljs-variable,.asciidoc .hljs-bullet,.markdown .hljs-bullet,.asciidoc .hljs-link_url,.markdown .hljs-link_url{color:#080}.hljs-label,.hljs-javadoc,.ruby .hljs-string,.hljs-decorator,.hljs-filter .hljs-argument,.hljs-localvars,.hljs-array,.hljs-attr_selector,.hljs-important,.hljs-pseudo,.hljs-pi,.haml .hljs-bullet,.hljs-doctype,.hljs-deletion,.hljs-envvar,.hljs-shebang,.apache .hljs-sqbracket,.nginx .hljs-built_in,.tex .hljs-formula,.erlang_repl .hljs-reserved,.hljs-prompt,.asciidoc .hljs-link_label,.markdown .hljs-link_label,.vhdl .hljs-attribute,.clojure .hljs-attribute,.asciidoc .hljs-attribute,.lasso .hljs-attribute,.coffeescript .hljs-property,.hljs-phony{color:#88f}.hljs-keyword,.hljs-id,.hljs-title,.hljs-built_in,.css .hljs-tag,.hljs-javadoctag,.hljs-phpdoc,.hljs-dartdoc,.hljs-yardoctag,.smalltalk .hljs-class,.hljs-winutils,.bash .hljs-variable,.pf .hljs-variable,.apache .hljs-tag,.hljs-type,.hljs-typename,.tex .hljs-command,.asciidoc .hljs-strong,.markdown .hljs-strong,.hljs-request,.hljs-status{font-weight:bold}.asciidoc .hljs-emphasis,.markdown .hljs-emphasis{font-style:italic}.nginx .hljs-built_in{font-weight:normal}.coffeescript .javascript,.javascript .xml,.lasso .markup,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:0.5} diff --git a/themes/slim/static/css/slim.css b/themes/slim/static/css/slim.css new file mode 100644 index 0000000..ad052e1 --- /dev/null +++ b/themes/slim/static/css/slim.css @@ -0,0 +1,383 @@ +html { + box-sizing: border-box; } + +*, +*:before, +*:after { + box-sizing: inherit; } + +body { + margin: 0; } + +a { + background-color: transparent; } + +img { + max-width: 100%; + margin: 1rem 0 0 1rem; + border: 0; + border-radius: 5px; } + +button, +input, +select, +textarea { + font: inherit; + margin: 0; } + +table { + border-collapse: collapse; + border-spacing: 0; + width: 100%; + margin-bottom: 1.75rem; } + +td, +th { + padding: 0.25rem 0.5rem; } + +tbody tr:nth-child(odd) td, +tbody tr:nth-child(odd) th { + background-color: #f9f9f9; } + +body { + color: #555; + font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', Arial, Serif; + font-size: 100%; + font-weight: 400; + line-height: 1.85; + letter-spacing: 0.01rem; } + +h1, +h2, +h3, +h4, +h5, +h6 { + font-weight: 700; + line-height: 1.25; + margin-bottom: 0.75rem; + font-family: 'Source Sans Pro', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', 'Helvetica Neue', Helvetica, Arial, sans-serif; } + +h1 { + font-size: 1.8rem; } + +h2 { + font-size: 1.5rem; } + +h3 { + font-size: 1.25rem; } + +h4, +h5, +h6 { + font-size: 1rem; } + +p, +dl, +ol, +ul { + margin-top: 0; + margin-bottom: 1.75rem; } + +a { + color: #2980b9; + text-decoration: none; } + a:hover, a:focus { + text-decoration: underline; } + +em { + text-emphasis-style: circle; + text-emphasis-position: under; } + +code { + font-family: 'Source Code Pro', Monaco, Courier, monospace; + font-size: 0.85rem; + color: #555; + background-color: #f5f5f5; + border: 1px solid #eef; + border-radius: 3px; + padding: 0.2em 0.5em; } + +pre { + display: block; + margin-top: 0; + margin-bottom: 1rem; + padding: 1rem; + font-size: 0.8rem; + line-height: 1.4; + white-space: pre; + white-space: pre-wrap; + word-break: break-all; + word-wrap: break-word; + background-color: #f9f9f9; } + +pre code { + font-family: 'Source Code Pro', Menlo, Monaco, Courier, monospace; + font-size: 0.7rem; + padding: 0; + color: inherit; + background-color: transparent; + border: none; } + +blockquote { + padding: 0.5rem 1rem; + margin: 0.8rem 0 0.8rem -1.5rem; + color: #7a7a7a; + border-left: 0.3rem solid #e5e5e5; } + blockquote p:last-child { + margin-bottom: 0; } + +hr { + border: 0; + border-top: 1px solid rgba(0, 0, 0, 0.2); + display: block; + width: 150px; + margin: 1.5rem 0; } + +button, +.btn { + background-image: none; + border: 1px solid #ccc; + border-radius: 5px; + color: #ccc; + cursor: pointer; + display: inline-block; + font-family: inherit; + font-size: 85%; + line-height: normal; + padding: 0.5rem 0.75rem; + text-align: center; + text-transform: uppercase; + text-decoration: none; + vertical-align: middle; + white-space: nowrap; + -webkit-transition: all 0.3s; + transition: all 0.3s; } + button::-moz-focus-inner, + .btn::-moz-focus-inner { + padding: 0; + border: 0; } + button:hover, button:focus, + .btn:hover, + .btn:focus { + color: #7fdbff; + border: 1px solid #7fdbff; + -webkit-transition: all 0.3s; + transition: all 0.3s; + text-decoration: none; } + button:active, + .btn:active { + color: #0074d9; + border: 1px solid #0074d9; + -webkit-transition: all 0.3s; + transition: all 0.3s; } + +.header { + position: relative; + margin: 3rem auto; } + +.site-title { + font-size: 1.5rem; + font-weight: 700; } + .site-title a { + color: #333; } + + .ava { + /* display: block; */ + border-radius: 50%; + display: block; + width: 100px; + margin-top: 2rem; + margin-left: 40%; + text: center; + } + + .rss_icon { + position: absolute; + left: 5px; + top: 5px; + } + +.nav { + position: absolute; + top: 0; + left: -15px; + transform: translateX(-100%); + text-align: right; } + +.nav-btn { + display: inline-block; + line-height: 16px; } + .nav-btn.is-on .ci-burger { + background: transparent; } + .nav-btn.is-on .ci-burger::before { + -webkit-transform: rotate(45deg); + -ms-transform: rotate(45deg); + transform: rotate(45deg); + top: 0; } + .nav-btn.is-on .ci-burger::after { + -webkit-transform: rotate(-45deg); + -ms-transform: rotate(-45deg); + transform: rotate(-45deg); + bottom: 0; } + .nav-btn.is-on + .nav-list { + opacity: 1; } + +.nav-list { + list-style: none; + font-size: 0.8rem; + margin-top: 1rem; + padding: 0; + opacity: 0; + -webkit-transition: all 0.2s; + transition: all 0.2s; } + +.nav-list .spacer { + text-align: center; +} + +.ci { + display: inline-block; + font-size: inherit; + font-style: normal; + font-weight: normal; + line-height: 1; + position: relative; + vertical-align: top; } + .ci:before, .ci:after { + content: ""; + display: block; + position: absolute; } + +.ci-burger { + width: 16px; + height: 3px; + top: 7px; + left: 0; + background: #333; + -webkit-transition: all 0.3s; + transition: all 0.3s; } + .ci-burger:before, .ci-burger:after { + width: 100%; + height: 3px; + background: #333; + left: 0; + -webkit-transition: all 0.3s; + transition: all 0.3s; } + .ci-burger:before { + top: -6px; } + .ci-burger:after { + bottom: -6px; } + +.container { + *zoom: 1; + width: auto; + max-width: 52em; + float: none; + display: block; + margin-right: auto; + margin-left: auto; + padding-left: 0; + padding-right: 0; } + .container:before, .container:after { + content: ''; + display: table; } + .container:after { + clear: both; } + +.pagination { + position: relative; + margin-top: 5em; } + .pagination:before, .pagination:after { + content: ''; + display: table; } + .pagination:after { + clear: both; } + .pagination .previous { + float: left; } + .pagination .next { + float: right; } + +.footer { + color: #95a5a6; + font-size: 14px; + text-align: center; + margin: 2rem 0 1rem; } + .footer a { + color: #333; } + +.post { + position: relative; + margin-bottom: 2rem; } + +.post-title:after { + content: ''; + display: block; + border-top: 1px solid #ccc; + width: 100%; + position: absolute; + top: 30px; + left: -30px; + z-index: -1; } + +.post-title a { + color: #333; + background: #fff; + line-height: 60px; + position: relative; + padding: 0 14px; + margin-left: -14px; + -webkit-transition: all 0.3s; + transition: all 0.3s; } + .post-title a:after, .post-title a:before { + content: ''; + position: absolute; + border: 3px solid transparent; + top: 13px; + -webkit-transition: all 0.3s; + transition: all 0.3s; } + .post-title a:before { + left: -23px; + -webkit-transform: rotate(45deg); + -ms-transform: rotate(45deg); + transform: rotate(45deg); } + .post-title a:after { + -webkit-transform: rotate(225deg); + -ms-transform: rotate(225deg); + transform: rotate(225deg); + right: -23px; } + .post-title a:hover:before, .post-title a:hover:after { + border-top-color: #ccc; + border-right-color: #ccc; } + .post-title a:hover:before { + left: -3px; } + .post-title a:hover:after { + right: -3px; } + +.post-date { + color: #ccc; + font-size: 14px; + margin-top: -25px; + display:block; + position: relative; } + +.post-content { + margin: 2rem 0; } + +/* styling for tags on homepage */ + +.post-tags { + color: #ccc; + display: block; + font-size: 14px; + position: relative; + margin-top: -25px; + margin-left: 125px; + text-align: right; + max-width: 525px; +} + +.post-tags a { + color: #ccc; +} + diff --git a/themes/slim/static/js/highlight.min.js b/themes/slim/static/js/highlight.min.js new file mode 100644 index 0000000..d370ad1 --- /dev/null +++ b/themes/slim/static/js/highlight.min.js @@ -0,0 +1,2 @@ +!function(e){"undefined"!=typeof exports?e(exports):(window.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return window.hljs}))}(function(e){function t(e){return e.replace(/&/gm,"&").replace(//gm,">")}function r(e){return e.nodeName.toLowerCase()}function n(e,t){var r=e&&e.exec(t);return r&&0==r.index}function a(e){var t=(e.className+" "+(e.parentNode?e.parentNode.className:"")).split(/\s+/);return t=t.map(function(e){return e.replace(/^lang(uage)?-/,"")}),t.filter(function(e){return v(e)||/no(-?)highlight|plain|text/.test(e)})[0]}function i(e,t){var r,n={};for(r in e)n[r]=e[r];if(t)for(r in t)n[r]=t[r];return n}function s(e){var t=[];return function n(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3==i.nodeType?a+=i.nodeValue.length:1==i.nodeType&&(t.push({event:"start",offset:a,node:i}),a=n(i,a),r(i).match(/br|hr|img|input/)||t.push({event:"stop",offset:a,node:i}));return a}(e,0),t}function c(e,n,a){function i(){return e.length&&n.length?e[0].offset!=n[0].offset?e[0].offset"}function c(e){u+=""}function o(e){("start"==e.event?s:c)(e.node)}for(var l=0,u="",d=[];e.length||n.length;){var b=i();if(u+=t(a.substr(l,b[0].offset-l)),l=b[0].offset,b==e){d.reverse().forEach(c);do o(b.splice(0,1)[0]),b=i();while(b==e&&b.length&&b[0].offset==l);d.reverse().forEach(s)}else"start"==b[0].event?d.push(b[0].node):d.pop(),o(b.splice(0,1)[0])}return u+t(a.substr(l))}function o(e){function t(e){return e&&e.source||e}function r(r,n){return new RegExp(t(r),"m"+(e.cI?"i":"")+(n?"g":""))}function n(a,s){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var c={},o=function(t,r){e.cI&&(r=r.toLowerCase()),r.split(" ").forEach(function(e){var r=e.split("|");c[r[0]]=[t,r[1]?Number(r[1]):1]})};"string"==typeof a.k?o("keyword",a.k):Object.keys(a.k).forEach(function(e){o(e,a.k[e])}),a.k=c}a.lR=r(a.l||/\b\w+\b/,!0),s&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=r(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=r(a.e)),a.tE=t(a.e)||"",a.eW&&s.tE&&(a.tE+=(a.e?"|":"")+s.tE)),a.i&&(a.iR=r(a.i)),void 0===a.r&&(a.r=1),a.c||(a.c=[]);var l=[];a.c.forEach(function(e){e.v?e.v.forEach(function(t){l.push(i(e,t))}):l.push("self"==e?a:e)}),a.c=l,a.c.forEach(function(e){n(e,a)}),a.starts&&n(a.starts,s);var u=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(t).filter(Boolean);a.t=u.length?r(u.join("|"),!0):{exec:function(){return null}}}}n(e)}function l(e,r,a,i){function s(e,t){for(var r=0;r";return i+=e+'">',i+t+s}function f(){if(!x.k)return t(E);var e="",r=0;x.lR.lastIndex=0;for(var n=x.lR.exec(E);n;){e+=t(E.substr(r,n.index-r));var a=b(x,n);a?(B+=a[1],e+=p(a[0],t(n[0]))):e+=t(n[0]),r=x.lR.lastIndex,n=x.lR.exec(E)}return e+t(E.substr(r))}function m(){if(x.sL&&!w[x.sL])return t(E);var e=x.sL?l(x.sL,E,!0,C[x.sL]):u(E);return x.r>0&&(B+=e.r),"continuous"==x.subLanguageMode&&(C[x.sL]=e.top),p(e.language,e.value,!1,!0)}function g(){return void 0!==x.sL?m():f()}function _(e,r){var n=e.cN?p(e.cN,"",!0):"";e.rB?(M+=n,E=""):e.eB?(M+=t(r)+n,E=""):(M+=n,E=r),x=Object.create(e,{parent:{value:x}})}function h(e,r){if(E+=e,void 0===r)return M+=g(),0;var n=s(r,x);if(n)return M+=g(),_(n,r),n.rB?0:r.length;var a=c(x,r);if(a){var i=x;i.rE||i.eE||(E+=r),M+=g();do x.cN&&(M+=""),B+=x.r,x=x.parent;while(x!=a.parent);return i.eE&&(M+=t(r)),E="",a.starts&&_(a.starts,""),i.rE?0:r.length}if(d(r,x))throw new Error('Illegal lexeme "'+r+'" for mode "'+(x.cN||"")+'"');return E+=r,r.length||1}var y=v(e);if(!y)throw new Error('Unknown language: "'+e+'"');o(y);var k,x=i||y,C={},M="";for(k=x;k!=y;k=k.parent)k.cN&&(M=p(k.cN,"",!0)+M);var E="",B=0;try{for(var L,$,z=0;;){if(x.t.lastIndex=z,L=x.t.exec(r),!L)break;$=h(r.substr(z,L.index-z),L[0]),z=L.index+$}for(h(r.substr(z)),k=x;k.parent;k=k.parent)k.cN&&(M+="");return{r:B,value:M,language:e,top:x}}catch(R){if(-1!=R.message.indexOf("Illegal"))return{r:0,value:t(r)};throw R}}function u(e,r){r=r||N.languages||Object.keys(w);var n={r:0,value:t(e)},a=n;return r.forEach(function(t){if(v(t)){var r=l(t,e,!1);r.language=t,r.r>a.r&&(a=r),r.r>n.r&&(a=n,n=r)}}),a.language&&(n.second_best=a),n}function d(e){return N.tabReplace&&(e=e.replace(/^((<[^>]+>|\t)+)/gm,function(e,t){return t.replace(/\t/g,N.tabReplace)})),N.useBR&&(e=e.replace(/\n/g,"
")),e}function b(e,t,r){var n=t?y[t]:r,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(n)&&a.push(n),a.join(" ").trim()}function p(e){var t=a(e);if(!/no(-?)highlight|plain|text/.test(t)){var r;N.useBR?(r=document.createElementNS("http://www.w3.org/1999/xhtml","div"),r.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):r=e;var n=r.textContent,i=t?l(t,n,!0):u(n),o=s(r);if(o.length){var p=document.createElementNS("http://www.w3.org/1999/xhtml","div");p.innerHTML=i.value,i.value=c(o,s(p),n)}i.value=d(i.value),e.innerHTML=i.value,e.className=b(e.className,t,i.language),e.result={language:i.language,re:i.r},i.second_best&&(e.second_best={language:i.second_best.language,re:i.second_best.r})}}function f(e){N=i(N,e)}function m(){if(!m.called){m.called=!0;var e=document.querySelectorAll("pre code");Array.prototype.forEach.call(e,p)}}function g(){addEventListener("DOMContentLoaded",m,!1),addEventListener("load",m,!1)}function _(t,r){var n=w[t]=r(e);n.aliases&&n.aliases.forEach(function(e){y[e]=t})}function h(){return Object.keys(w)}function v(e){return w[e]||w[y[e]]}var N={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},w={},y={};return e.highlight=l,e.highlightAuto=u,e.fixMarkup=d,e.highlightBlock=p,e.configure=f,e.initHighlighting=m,e.initHighlightingOnLoad=g,e.registerLanguage=_,e.listLanguages=h,e.getLanguage=v,e.inherit=i,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="\\b(0[xX][a-fA-F0-9]+|(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such)\b/},e.C=function(t,r,n){var a=e.inherit({cN:"comment",b:t,e:r,c:[]},n||{});return a.c.push(e.PWM),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e}),hljs.registerLanguage("apache",function(e){var t={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"tag",b:""},{cN:"keyword",b:/\w+/,r:0,k:{common:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"sqbracket",b:"\\s\\[",e:"\\]$"},{cN:"cbracket",b:"[\\$%]\\{",e:"\\}",c:["self",t]},t,e.QSM]}}],i:/\S/}}),hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},r={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},n={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,e.NM,r,n,t]}}),hljs.registerLanguage("coffeescript",function(e){var t={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",reserved:"case default function var void with const let enum export import native __hasProp __extends __slice __bind __indexOf",built_in:"npm require console print module global window document"},r="[A-Za-z$_][0-9A-Za-z$_]*",n={cN:"subst",b:/#\{/,e:/}/,k:t},a=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,n]},{b:/"/,e:/"/,c:[e.BE,n]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[n,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{cN:"property",b:"@"+r},{b:"`",e:"`",eB:!0,eE:!0,sL:"javascript"}];n.c=a;var i=e.inherit(e.TM,{b:r}),s="(\\(.*\\))?\\s*\\B[-=]>",c={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(a)}]};return{aliases:["coffee","cson","iced"],k:t,i:/\/\*/,c:a.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+r+"\\s*=\\s*"+s,e:"[-=]>",rB:!0,c:[i,c]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:s,e:"[-=]>",rB:!0,c:[c]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[i]},i]},{cN:"attribute",b:r+":",e:":",rB:!0,rE:!0,r:0}])}}),hljs.registerLanguage("cpp",function(e){var t={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex _Complex _Imaginary intmax_t uintmax_t int8_t uint8_t int16_t uint16_t int32_t uint32_t int64_t uint64_t int_least8_t uint_least8_t int_least16_t uint_least16_t int_least32_t uint_least32_t int_least64_t uint_least64_t int_fast8_t uint_fast8_t int_fast16_t uint_fast16_t int_fast32_t uint_fast32_t int_fast64_t uint_fast64_t intptr_t uintptr_t atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong atomic_wchar_t atomic_char16_t atomic_char32_t atomic_intmax_t atomic_uintmax_t atomic_intptr_t atomic_uintptr_t atomic_size_t atomic_ptrdiff_t atomic_int_least8_t atomic_int_least16_t atomic_int_least32_t atomic_int_least64_t atomic_uint_least8_t atomic_uint_least16_t atomic_uint_least32_t atomic_uint_least64_t atomic_int_fast8_t atomic_int_fast16_t atomic_int_fast32_t atomic_int_fast64_t atomic_uint_fast8_t atomic_uint_fast16_t atomic_uint_fast32_t atomic_uint_fast64_t",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf"};return{aliases:["c","cc","h","c++","h++","hpp"],k:t,i:""]',k:"include",i:"\\n"},e.CLCM]},{b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:t,c:["self"]},{b:e.IR+"::",k:t},{bK:"new throw return else",r:0},{cN:"function",b:"("+e.IR+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:t,r:0,c:[e.CBCM]},e.CLCM,e.CBCM]}]}}),hljs.registerLanguage("cs",function(e){var t="abstract as base bool break byte case catch char checked const continue decimal dynamic default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long null when object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async protected public private internal ascending descending from get group into join let orderby partial select set value var where yield",r=e.IR+"(<"+e.IR+">)?";return{aliases:["csharp"],k:t,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"xmlDocTag",v:[{b:"///",r:0},{b:""},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line region endregion pragma checksum"},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},e.ASM,e.QSM,e.CNM,{bK:"class namespace interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+r+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:t,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}}),hljs.registerLanguage("css",function(e){var t="[a-zA-Z-][a-zA-Z0-9_-]*",r={cN:"function",b:t+"\\(",rB:!0,eE:!0,e:"\\("},n={cN:"rule",b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{cN:"value",eW:!0,eE:!0,c:[r,e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"hexcolor",b:"#[0-9A-Fa-f]+"},{cN:"important",b:"!important"}]}}]};return{cI:!0,i:/[=\/|']/,c:[e.CBCM,n,{cN:"id",b:/\#[A-Za-z0-9_-]+/},{cN:"class",b:/\.[A-Za-z0-9_-]+/,r:0},{cN:"attr_selector",b:/\[/,e:/\]/,i:"$"},{cN:"pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"']+/},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[r,e.ASM,e.QSM,e.CSSNM]}]},{cN:"tag",b:t,r:0},{cN:"rules",b:"{",e:"}",i:/\S/,r:0,c:[e.CBCM,n]}]}}),hljs.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"chunk",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"header",v:[{b:/Index: /,e:/$/},{b:/=====/,e:/=====$/},{b:/^\-\-\-/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+\+\+/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}}),hljs.registerLanguage("http",function(e){return{aliases:["https"],i:"\\S",c:[{cN:"status",b:"^HTTP/[0-9\\.]+",e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{cN:"request",b:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{cN:"string",e:"$"}},{b:"\\n\\n",starts:{sL:"",eW:!0}}]}}),hljs.registerLanguage("ini",function(e){return{cI:!0,i:/\S/,c:[e.C(";","$"),{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:!0,k:"on off true false yes no",c:[e.QSM,e.NM],r:0}]}]}}),hljs.registerLanguage("java",function(e){var t=e.UIR+"(<"+e.UIR+">)?",r="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private",n="(\\b(0b[01_]+)|\\b0[xX][a-fA-F0-9_]+|(\\b[\\d_]+(\\.[\\d_]*)?|\\.[\\d_]+)([eE][-+]?\\d+)?)[lLfF]?",a={cN:"number",b:n,r:0};return{aliases:["jsp"],k:r,i:/<\//,c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",r:0,c:[{cN:"javadoctag",b:"(^|\\s)@[A-Za-z]+"}]},e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return",r:0},{cN:"function",b:"("+t+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:r,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:r,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},a,{cN:"annotation",b:"@[A-Za-z]+"}]}}),hljs.registerLanguage("javascript",function(e){return{aliases:["js"],k:{keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as await",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},c:[{cN:"pi",r:10,v:[{b:/^\s*('|")use strict('|")/},{b:/^\s*('|")use asm('|")/}]},e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},e.CLCM,e.CBCM,{cN:"number",b:"\\b(0[xXbBoO][a-fA-F0-9]+|(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",r:0},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{b:/\s*[);\]]/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[e.CLCM,e.CBCM],i:/["'\(]/}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+e.IR,r:0},{bK:"import",e:"[;$]",k:"import from as",c:[e.ASM,e.QSM]},{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]}]}}),hljs.registerLanguage("json",function(e){var t={literal:"true false null"},r=[e.QSM,e.CNM],n={cN:"value",e:",",eW:!0,eE:!0,c:r,k:t},a={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:!0,eE:!0,c:[e.BE],i:"\\n",starts:n}],i:"\\S"},i={b:"\\[",e:"\\]",c:[e.inherit(n,{cN:null})],i:"\\S"};return r.splice(r.length,0,a,i),{c:r,k:t,i:"\\S"}}),hljs.registerLanguage("makefile",function(e){var t={cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]};return{aliases:["mk","mak"],c:[e.HCM,{b:/^\w+\s*\W*=/,rB:!0,r:0,starts:{cN:"constant",e:/\s*\W*=/,eE:!0,starts:{e:/$/,r:0,c:[t]}}},{cN:"title",b:/^[\w]+:\s*$/},{cN:"phony",b:/^\.PHONY:/,e:/$/,k:".PHONY",l:/[\.\w]+/},{b:/^\t+/,e:/$/,r:0,c:[e.QSM,t]}]}}),hljs.registerLanguage("xml",function(e){var t="[A-Za-z0-9\\._:-]+",r={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"},n={eW:!0,i:/]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xsl","plist"],cI:!0,c:[{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},e.C("",{r:10}),{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{title:"style"},c:[n],starts:{e:"",rE:!0,sL:"css"}},{cN:"tag",b:"|$)",e:">",k:{title:"script"},c:[n],starts:{e:"",rE:!0,sL:""}},r,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"",c:[{cN:"title",b:/[^ \/><\n\t]+/,r:0},n]}]}}),hljs.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"header",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"blockquote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"`.+?`"},{b:"^( {4}| )",e:"$",r:0}]},{cN:"horizontal_rule",b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"link_label",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link_url",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"link_reference",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:"^\\[.+\\]:",rB:!0,c:[{cN:"link_reference",b:"\\[",e:"\\]:",eB:!0,eE:!0,starts:{cN:"link_url",e:"$"}}]}]}}),hljs.registerLanguage("nginx",function(e){var t={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},r={eW:!0,l:"[a-z/_]+",k:{built_in:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,t],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{cN:"url",b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[t]},{cN:"regexp",c:[e.BE,t],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},t]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"title",b:e.UIR,starts:r}],r:0}],i:"[^\\s\\}]"}}),hljs.registerLanguage("objectivec",function(e){var t={cN:"built_in",b:"(AV|CA|CF|CG|CI|MK|MP|NS|UI)\\w+"},r={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,a="@interface @class @protocol @implementation";return{aliases:["m","mm","objc","obj-c"],k:r,l:n,i:""}]}]},{cN:"class",b:"("+a.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:a,l:n,c:[e.UTM]},{cN:"variable",b:"\\."+e.UIR,r:0}]}}),hljs.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},n={b:"->{",e:"}"},a={cN:"variable",v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},i=e.C("^(__END__|__DATA__)","\\n$",{r:5}),s=[e.BE,r,a],c=[a,e.HCM,i,e.C("^\\=\\w","\\=cut",{eW:!0}),n,{cN:"string",c:s,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,i,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"sub",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",r:5},{cN:"operator",b:"-\\w\\b",r:0}];return r.c=c,n.c=c,{aliases:["pl"],k:t,c:c}}),hljs.registerLanguage("php",function(e){var t={cN:"variable",b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},r={cN:"preprocessor",b:/<\?(php)?|\?>/},n={cN:"string",c:[e.BE,r],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},a={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.CLCM,e.HCM,e.C("/\\*","\\*/",{c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"},r]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[e.BE]},r,t,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",t,e.CBCM,n,a]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},n,a]}}),hljs.registerLanguage("python",function(e){var t={cN:"prompt",b:/^(>>>|\.\.\.) /},r={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[t],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[t],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},n={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},a={cN:"params",b:/\(/,e:/\)/,c:["self",t,n,r]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)/,c:[t,n,r,e.HCM,{v:[{cN:"function",bK:"def",r:10},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,a]},{cN:"decorator",b:/@/,e:/$/},{b:/\b(print|exec)\(/}]}}),hljs.registerLanguage("ruby",function(e){var t="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r="and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",n={cN:"yardoctag",b:"@[A-Za-z]+"},a={cN:"value",b:"#<",e:">"},i=[e.C("#","$",{c:[n]}),e.C("^\\=begin","^\\=end",{c:[n],r:10}),e.C("^__END__","\\n$")],s={cN:"subst",b:"#\\{",e:"}",k:r},c={cN:"string",c:[e.BE,s],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/}]},o={cN:"params",b:"\\(",e:"\\)",k:r},l=[c,a,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]}].concat(i)},{cN:"function",bK:"def",e:" |$|;",r:0,c:[e.inherit(e.TM,{b:t}),o].concat(i)},{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":",c:[c,{b:t}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:[a,{cN:"regexp",c:[e.BE,s],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(i),r:0}].concat(i);s.c=l,o.c=l;var u="[>?]>",d="[\\w#]+\\(\\w+\\):\\d+:\\d+>",b="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",p=[{b:/^\s*=>/,cN:"status",starts:{e:"$",c:l}},{cN:"prompt",b:"^("+u+"|"+d+"|"+b+")",starts:{e:"$",c:l}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,c:i.concat(p).concat(l)}}),hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>]/,c:[{cN:"operator",bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate savepoint release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke",e:/;/,eW:!0,k:{keyword:"abs absolute acos action add adddate addtime aes_decrypt aes_encrypt after aggregate all allocate alter analyze and any are as asc ascii asin assertion at atan atan2 atn2 authorization authors avg backup before begin benchmark between bin binlog bit_and bit_count bit_length bit_or bit_xor both by cache call cascade cascaded case cast catalog ceil ceiling chain change changed char_length character_length charindex charset check checksum checksum_agg choose close coalesce coercibility collate collation collationproperty column columns columns_updated commit compress concat concat_ws concurrent connect connection connection_id consistent constraint constraints continue contributors conv convert convert_tz corresponding cos cot count count_big crc32 create cross cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime data database databases datalength date_add date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts datetimeoffsetfromparts day dayname dayofmonth dayofweek dayofyear deallocate declare decode default deferrable deferred degrees delayed delete des_decrypt des_encrypt des_key_file desc describe descriptor diagnostics difference disconnect distinct distinctrow div do domain double drop dumpfile each else elt enclosed encode encrypt end end-exec engine engines eomonth errors escape escaped event eventdata events except exception exec execute exists exp explain export_set extended external extract fast fetch field fields find_in_set first first_value floor flush for force foreign format found found_rows from from_base64 from_days from_unixtime full function get get_format get_lock getdate getutcdate global go goto grant grants greatest group group_concat grouping grouping_id gtid_subset gtid_subtract handler having help hex high_priority hosts hour ident_current ident_incr ident_seed identified identity if ifnull ignore iif ilike immediate in index indicator inet6_aton inet6_ntoa inet_aton inet_ntoa infile initially inner innodb input insert install instr intersect into is is_free_lock is_ipv4 is_ipv4_compat is_ipv4_mapped is_not is_not_null is_used_lock isdate isnull isolation join key kill language last last_day last_insert_id last_value lcase lead leading least leaves left len lenght level like limit lines ln load load_file local localtime localtimestamp locate lock log log10 log2 logfile logs low_priority lower lpad ltrim make_set makedate maketime master master_pos_wait match matched max md5 medium merge microsecond mid min minute mod mode module month monthname mutex name_const names national natural nchar next no no_write_to_binlog not now nullif nvarchar oct octet_length of old_password on only open optimize option optionally or ord order outer outfile output pad parse partial partition password patindex percent_rank percentile_cont percentile_disc period_add period_diff pi plugin position pow power pragma precision prepare preserve primary prior privileges procedure procedure_analyze processlist profile profiles public publishingservername purge quarter query quick quote quotename radians rand read references regexp relative relaylog release release_lock rename repair repeat replace replicate reset restore restrict return returns reverse revoke right rlike rollback rollup round row row_count rows rpad rtrim savepoint schema scroll sec_to_time second section select serializable server session session_user set sha sha1 sha2 share show sign sin size slave sleep smalldatetimefromparts snapshot some soname soundex sounds_like space sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sql_variant_property sqlstate sqrt square start starting status std stddev stddev_pop stddev_samp stdev stdevp stop str str_to_date straight_join strcmp string stuff subdate substr substring subtime subtring_index sum switchoffset sysdate sysdatetime sysdatetimeoffset system_user sysutcdatetime table tables tablespace tan temporary terminated tertiary_weights then time time_format time_to_sec timediff timefromparts timestamp timestampadd timestampdiff timezone_hour timezone_minute to to_base64 to_days to_seconds todatetimeoffset trailing transaction translation trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse ucase uncompress uncompressed_length unhex unicode uninstall union unique unix_timestamp unknown unlock update upgrade upped upper usage use user user_resources using utc_date utc_time utc_timestamp uuid uuid_short validate_password_strength value values var var_pop var_samp variables variance varp version view warnings week weekday weekofyear weight_string when whenever where with work write xml xor year yearweek zon", +literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int integer interval number numeric real serial smallint varchar varying int8 serial8 text"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}}); \ No newline at end of file diff --git a/themes/slim/static/js/slim.js b/themes/slim/static/js/slim.js new file mode 100644 index 0000000..8514e38 --- /dev/null +++ b/themes/slim/static/js/slim.js @@ -0,0 +1,4 @@ +document.querySelector('.nav-btn').onclick = function(e) { + e.preventDefault(); + this.classList.toggle('is-on'); +}; diff --git a/themes/slim/theme.toml b/themes/slim/theme.toml new file mode 100644 index 0000000..450d8f0 --- /dev/null +++ b/themes/slim/theme.toml @@ -0,0 +1,12 @@ +name = "Slim" +license = "MIT" +licenselink = "https://github.com/zhe/hugo-theme-slim/blob/master/LICENSE.md" +description = "A slim minimal theme for Hugo." +homepage = "https://github.com/zhe/hugo-theme-slim" +tags = ["minimal", "clean", "neat", "black white", "blog"] +features = ["blog"] +min_version = 0.13 + +[author] + name = "Zhe Zhang" + homepage = "http://zhezhang.co"