Initial commit
|
@ -0,0 +1,14 @@
|
|||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, build with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
|
||||
.glide/
|
|
@ -0,0 +1,63 @@
|
|||
base_url = "https://ratanshreshtha.github.io"
|
||||
title = "RatanShreshtha"
|
||||
default_language = "en"
|
||||
highlight_code = true
|
||||
highlight_theme = "one-dark"
|
||||
generate_feed = true
|
||||
feed_filename = "rss.xml"
|
||||
taxonomies = [
|
||||
{ name = "categories", feed = true, paginate_by = 10 },
|
||||
{ name = "tags", fees = true, paginate_by = 10 },
|
||||
]
|
||||
languages = []
|
||||
compile_sass = false
|
||||
build_search_index = true
|
||||
ignored_content = []
|
||||
extra_syntaxes = []
|
||||
|
||||
[link_checker]
|
||||
skip_prefixes = ["http://[2001:db8::]/"]
|
||||
skip_anchor_prefixes = ["https://caniuse.com/"]
|
||||
|
||||
[slugify]
|
||||
paths = "on"
|
||||
taxonomies = "on"
|
||||
anchors = "on"
|
||||
|
||||
[translations]
|
||||
|
||||
[extra]
|
||||
navbar_items = [
|
||||
{ url = "$BASE_URL/", name = "Home" },
|
||||
{ url = "$BASE_URL/posts", name = "Posts" },
|
||||
{ url = "$BASE_URL/tags", name = "Tags" },
|
||||
{ url = "$BASE_URL/categories", name = "Categories" },
|
||||
]
|
||||
|
||||
[extra.favicon]
|
||||
favicon_16x16 = "/icons/favicon-16x16.png"
|
||||
favicon_32x32 = "/icons/favicon-32x32.png"
|
||||
apple_touch_icon = "/icons/apple-touch-icon.png"
|
||||
safari_pinned_tab = "/icons/safari-pinned-tab.svg"
|
||||
webmanifest = "/icons/site.webmanifest"
|
||||
|
||||
[extra.author]
|
||||
name = "Ratan Kulshreshtha"
|
||||
avatar = "/images/avatar.png"
|
||||
|
||||
[extra.social]
|
||||
facebook = "RatanShreshtha"
|
||||
github = "RatanShreshtha"
|
||||
keybase = "RatanShreshtha"
|
||||
linkedin = "RatanShreshtha"
|
||||
stackoverflow = "3728911"
|
||||
twitter = "RatanShreshtha"
|
||||
|
||||
[extra.analytics]
|
||||
google = "UA-99004679-1"
|
||||
|
||||
[extra.commenting]
|
||||
hyvor = "1791"
|
||||
|
||||
[extra.mapbox]
|
||||
access_token = "pk.eyJ1IjoicmF0YW5zaHJlc2h0aGEiLCJhIjoiY2tlY3pqcWE5MDcxdTJ2bWw4YmY5cXVudyJ9.vFrVFcOZwvi8-dd8088Tqg"
|
|
@ -0,0 +1,12 @@
|
|||
+++
|
||||
title = "नमस्कार(Hello) 🙏"
|
||||
description = "Welcome to my website."
|
||||
+++
|
||||
|
||||
Hi, my name is Ratan Kulshreshtha, and I live in Pune, Maharastra, India. I was born in Agra, India. I'm a software engineer, and this is my blog, the topics that I will be blogging about are going to be mostly related to programming, technology, gadgets, photography etc. Or maybe not, at this point I don't really know.
|
||||
|
||||
You can find me on IRC: **RatanShreshtha**
|
||||
|
||||
Thanks for stopping by, I hope you find something useful or interesting. If you do, be sure to leave a comment.
|
||||
|
||||
Ratan Kulshreshtha
|
|
@ -0,0 +1,40 @@
|
|||
+++
|
||||
title = "8 Common Regex"
|
||||
description = "Few most common regex one should know."
|
||||
date = 2019-11-28T23:19:47+05:30
|
||||
|
||||
[taxonomies]
|
||||
categories = ["Cheatsheet"]
|
||||
tags = ["regex"]
|
||||
|
||||
[extra]
|
||||
toc = true
|
||||
+++
|
||||
|
||||
Regular expressions are a language of their own. When you learn a new programming language, they're this little sub-language that makes no sense at first glance. Below are eight regular expressions that you should know for your next coding project.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
# Username
|
||||
**Pattern**:`/^[a-z0-9_-]{3,16}$/`
|
||||
|
||||
# Password
|
||||
**Pattern**:`/^[a-z0-9_-]{6,18}$/`
|
||||
|
||||
# Hex Value
|
||||
**Pattern**:`/^#?([a-f0-9]{6}|[a-f0-9]{3})$/`
|
||||
|
||||
# Slug
|
||||
**Pattern**:`/^[a-z0-9-]+$/`
|
||||
|
||||
# Email
|
||||
**Pattern**:`/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/`
|
||||
|
||||
# URL
|
||||
**Pattern**:`/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/`
|
||||
|
||||
# IP Address
|
||||
**Pattern**:`/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/`
|
||||
|
||||
# HTML Tag
|
||||
**Pattern**:`/^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/`
|
|
@ -0,0 +1,18 @@
|
|||
+++
|
||||
title = "Posts"
|
||||
description = "Blog posts accumulated over the time."
|
||||
sort_by = "date"
|
||||
paginate_by = 7
|
||||
+++
|
||||
|
||||
|
||||
Hello posts
|
||||
|
||||
<!-- more -->
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
||||
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
|
||||
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
|
||||
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
|
||||
in culpa qui officia deserunt mollit anim id est laborum.
|
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 185 KiB |
|
@ -0,0 +1,97 @@
|
|||
+++
|
||||
title = "Bootstrap Your .gitignore"
|
||||
description = "Create .gitignore files for your project using gitignore.io"
|
||||
date = 2018-08-12T12:20:16+05:30
|
||||
[taxonomies]
|
||||
categories = ["Blog"]
|
||||
tags = ["git", "bootstrapping"]
|
||||
[extra]
|
||||
toc = true
|
||||
+++
|
||||
|
||||
Many of us use git to version control our projects and we all can agree on one thing although that despite the benefits git provides, Git is hard = screwing up is easy, and figuring out how to fix your mistakes is really hard.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
And while working with git it is also important to tell git what files git should not remember thus not version control that, so `.gitignore` comes into the picture.
|
||||
|
||||
And there is a really simple way to bootstrap your `.gitignore` using [gitignore.io](https://www.gitignore.io/) just go to the website and fill the technologies you are working on.
|
||||
|
||||
![gitignore.io](gitignoreio.png)
|
||||
|
||||
Now just click on create and viola your `.gitignore` is ready.
|
||||
|
||||
![gitignore](gitignore.png)
|
||||
|
||||
If you are someone who prefers CLI instead of browser and have a working internet connection then you can also make an environment function to generate your `.gitignore` using your terminal.
|
||||
|
||||
## Installation
|
||||
### Linux
|
||||
- bash
|
||||
```sh
|
||||
$ echo "function gi() { curl -L -s https://www.gitignore.io/api/\$@ ;}" >> ~/.bashrc && source ~/.bashrc
|
||||
```
|
||||
- zsh
|
||||
```sh
|
||||
$ echo "function gi() { curl -L -s https://www.gitignore.io/api/\$@ ;}" >> ~/.zshrc && source ~/.zshrc
|
||||
```
|
||||
- fish
|
||||
```sh
|
||||
$ printf "function gi\n\tcurl -L -s https://www.gitignore.io/api/\$argv\nend\n" > ~/.config/fish/functions/gi.fish
|
||||
```
|
||||
|
||||
### macOS
|
||||
- bash
|
||||
```sh
|
||||
$ echo "function gi() { curl -L -s https://www.gitignore.io/api/\$@ ;}" >> ~/.bash_profile && source ~/.bash_profile
|
||||
```
|
||||
- zsh
|
||||
```sh
|
||||
$ echo "function gi() { curl -L -s https://www.gitignore.io/api/\$@ ;}" >> ~/.zshrc && source ~/.zshrc
|
||||
```
|
||||
- fish
|
||||
```sh
|
||||
$ printf "function gi\n\tcurl -L -s https://www.gitignore.io/api/\$argv\nend\n" > ~/.config/fish/functions/gi.fish
|
||||
```
|
||||
|
||||
### Windows
|
||||
- Create a PowerShell v3 Script
|
||||
```posh
|
||||
#For PowerShell v3
|
||||
Function gig {
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string[]]$list
|
||||
)
|
||||
$params = ($list | ForEach-Object { [uri]::EscapeDataString($_) }) -join ","
|
||||
Invoke-WebRequest -Uri "https://www.gitignore.io/api/$params" | select -ExpandProperty content | Out-File -FilePath $(Join-Path -path $pwd -ChildPath ".gitignore") -Encoding ascii
|
||||
}
|
||||
```
|
||||
## Usage
|
||||
|
||||
Show output on the command line. **Note:** Use `gig` if you are on Windows
|
||||
|
||||
- List all available gitignore.io templates
|
||||
```sh
|
||||
$ gi list
|
||||
.......
|
||||
kobalt,kohana,komodoedit,kotlin,labview
|
||||
lamp,laravel,latex,lazarus,leiningen
|
||||
lemonstand,less,liberosoc,librarian-chef,libreoffice
|
||||
lilypond,linux,lithium,lua,lyx
|
||||
m2e,macos,magento,magento2,magic-xpa
|
||||
matlab,maven,mavensmate,mean,mercurial
|
||||
mercury,metaprogrammingsystem,meteorjs,microsoftoffice,mikroc
|
||||
moban,modelsim,modx,momentics,monodevelop
|
||||
mplabx,mule,nanoc,nativescript,ncrunch
|
||||
nesc,netbeans,nette,nikola,nim
|
||||
ninja,node,notepadpp,nwjs,objective-c
|
||||
ocaml,octobercms,opa,opencart,opencv
|
||||
openfoam,openframeworks,oracleforms,osx,otto
|
||||
packer,particle,pawn,perl,perl6
|
||||
.......
|
||||
```
|
||||
- Make your `.gitignore` for the project
|
||||
```sh
|
||||
$ gi linux,python >> .gitignore
|
||||
```
|
After Width: | Height: | Size: 756 KiB |
|
@ -0,0 +1,63 @@
|
|||
+++
|
||||
title = "Colorize Script Output"
|
||||
description = "A bash snippet to make output of your bash scripts colourful."
|
||||
date = 2020-07-05T23:19:47+05:30
|
||||
|
||||
[taxonomies]
|
||||
categories = ["Snippets"]
|
||||
tags = ["bash", "scripts", "colorize"]
|
||||
|
||||
[extra]
|
||||
toc = false
|
||||
+++
|
||||
|
||||
|
||||
You can use the script below to make output of your scripts colourful.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
set -eufo pipefail
|
||||
|
||||
RED="\033[0;31m"
|
||||
RED_LIGHT="\033[1;31m"
|
||||
GREEN="\033[0;32m"
|
||||
GREEN_LIGHT="\033[1;32m"
|
||||
BLUE="\033[0;34m"
|
||||
BLUE_LIGHT="\033[1;34m"
|
||||
PURPLE="\033[0;35m"
|
||||
PURPLE_LIGHT="\033[1;35m"
|
||||
CYAN="\033[0;36m"
|
||||
CYAN_LIGHT="\033[1;36m"
|
||||
GRAY="\033[1;30m"
|
||||
GRAY_LIGHT="\033[0;37m"
|
||||
ORANGE="\033[0;33m"
|
||||
YELLOW="\033[1;33m"
|
||||
BLACK="\033[0;30m"
|
||||
WHITE="\033[1;37m"
|
||||
END="\033[0m"
|
||||
|
||||
echo -e "Hey, see ${YELLOW}this text will be yellow${END}."
|
||||
|
||||
printf "${BLUE}"
|
||||
cat <<"EOF"
|
||||
____ _
|
||||
| __ )| |_ _ ___
|
||||
| _ \| | | | |/ _ \
|
||||
| |_) | | |_| | __/
|
||||
|____/|_|\__,_|\___|
|
||||
|
||||
EOF
|
||||
printf "${END}"
|
||||
```
|
||||
|
||||
And to see the output just run it like any bash script.
|
||||
|
||||
```
|
||||
$ bash colorize.sh
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
![colorize-output](./colorize-output.png)
|
|
@ -0,0 +1,23 @@
|
|||
+++
|
||||
title = "DevConf.In 2018"
|
||||
description = "My first conference as a speaker"
|
||||
author = "Ratan Kulshreshtha"
|
||||
date = 2018-08-05T22:43:30+05:30
|
||||
[taxonomies]
|
||||
categories = ["Blog"]
|
||||
tags = ["conf", "meetup"]
|
||||
+++
|
||||
|
||||
I attended Devconf.IN which is the first annual Developers' Conference to be organised by Red Hat at Christ University in Bengaluru, India held on 4-5 August 2018.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
Around ~1323 attendees attended Devconf.IN 2018 along with 110 speakers. There were around 14 parallel tracks (Agile, Blockchain, Cloud and Container, Community, Design, Developer Tools, DevOps, IOT, Machine Learning, Middleware, Platform, QE, Security, Storage) and BOFs, workshops so pretty much completely packed schedule.
|
||||
|
||||
The first day of the conference was kicked off with a dance performance by university students and after that the keynote by Ric Wheeler about "Open source is better for companies/businesses, communities and developers" and he talked about back in the day how things used to happen and how far we have come now in terms of software businesses.
|
||||
|
||||
After that, I attended **JS Authentication with Auth0** then I went on sticker hunting in the boot area and had chat with many community members of Fedora, Foreman, OpenShift,Women who code, RDO, Mozilla, Ansible etc.
|
||||
|
||||
I was allocated the last slot for my talk which went quite well as opposed to my fears, I talked about testing and why we should do it how to do it and why you should be using nightwatch.js foe e2e testing, and I ended my talk with a demo and a quick Q&A session. It was a really nice experience for me to be on this side of the podium as opposed to I have been in the conferences.
|
||||
|
||||
First day ended with the keynote by Karanbir Singh (kbsingh) about “Open Source won”, and it was a really fun and motivating talk I enjoyed it a lot.
|
|
@ -0,0 +1,94 @@
|
|||
+++
|
||||
title = "Git Cheatsheet"
|
||||
description = "A cheatsheet for our favourite scm git."
|
||||
date = 2018-04-06T23:19:47+05:30
|
||||
|
||||
[taxonomies]
|
||||
categories = ["Cheatsheet"]
|
||||
tags = ["git"]
|
||||
|
||||
[extra]
|
||||
toc = true
|
||||
+++
|
||||
|
||||
Let's go through this `tldr` format git cheatsheet.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
## The Three States
|
||||
- `Git Directory` - The .git directory is where Git stores the metadata and object database for the repository
|
||||
- `Working Directory` - A copy of one version of the git project, taken from compressed database in the .git directory
|
||||
- `Staging Area/Index` - File that stores information about what will next be committed into the git repository
|
||||
|
||||
## Configure Tooling
|
||||
- `git config --global user.name "[name]"` - Sets the name you want attached to your commit transactions
|
||||
- `git config --global user.email "[email address]"` - Sets the email you want attached to your commit transactions
|
||||
- `git config --global color.ui auto` - Enables helpful colorizations of command line input
|
||||
|
||||
## Create Repositories
|
||||
- `git init [project-name]` Creates a new local repository with the specified name
|
||||
- `git clone [url]` - Downloads a project and its entire version history
|
||||
|
||||
## Make Changes
|
||||
- `git status` - Lists all new or modified files to be committed
|
||||
- `git diff` - Shows file differences not yet staged
|
||||
- `git add [file]` - Snapshots the file in preparation for versioning
|
||||
- `git diff --staged` - Shows file differences between staging and the last file version
|
||||
- `git reset [file]` - Unstages the file, but preserves its contents
|
||||
- `git commit -m "[descriptive message]"` - Records the file snapshots permanently in version history
|
||||
|
||||
## Group Changes
|
||||
- `git branch` - Lists all local branches in the current repository
|
||||
- `git branch [branch-name]` - Creates a new branch
|
||||
- `git checkout [branch-name]` - Switches to the specified branch and updates the working directory
|
||||
- `git merge [branch]` - Combines the specified branch's history into the current branch
|
||||
- `git branch -d [branch-name]` - Deletes the specified branch
|
||||
- `git remote add [remote-name] [url]` - Add a new remote git repository as a short name
|
||||
- `git remote -v` - Lists all remote git repositories
|
||||
|
||||
## Refactor Filenames
|
||||
- `git rm [file]` - Deletes the file from the working directory and stages the deletion
|
||||
- `git rm --cached [file]` - Removes the file from version control but preserves the file locally
|
||||
- `git mv [file-original] [file-renamed]` - Changes the file name and prepares it for commit
|
||||
|
||||
## Suppress Tracking
|
||||
- A text file named .gitignore suppresses accidental versioning of files and paths matching the specified patterns
|
||||
```
|
||||
*.log
|
||||
build/
|
||||
temp-*
|
||||
```
|
||||
- `git ls-files --other --ignored --exclude-standard` - Lists all ignored files in this project
|
||||
|
||||
## Save Fragments
|
||||
- `git stash` - Temporarily stores all modified tracking files
|
||||
- `git stash save [message]` - Save local modifications to a new stash
|
||||
- `git stash pop` - Restores the most recently stashed files
|
||||
- `git stash list` - Lists all stashed changesets
|
||||
- `git stash show` - Show the changes recorded in the stash
|
||||
- `git stash drop` - Discards the most recently stashed changeset
|
||||
|
||||
## Review History
|
||||
- `git log` - Lists version history for the current branch
|
||||
- `git log --follow [file]` - Lists version history for a file, including renames
|
||||
- `git diff [first-branch]...[second-branch]` - Shows content differences between two branches
|
||||
- `git show [commit]` - Outputs metadata and content changes of the specified commit
|
||||
|
||||
## Redo Commits
|
||||
- `git reset [commit]` - Undoes all commits after [commit], preserving changes locally
|
||||
- `git reset --hard [commit]` - Discards all history and changes back to the specified commit
|
||||
|
||||
## Synchronize Changes
|
||||
- `git fetch [bookmark] [branch]` - Downloads all history from the repository bookmark, optionally specifying branch
|
||||
- `git merge [bookmark]/[branch]` - Combines bookmark's branch into current local branches
|
||||
- `git push [alias] [branch]` - Uploads all local branch commits to GitHub
|
||||
- `git push [alias] :[branch]` - Deletes remote branch
|
||||
- `git pull` - Downloads bookmark history and incorporates changes
|
||||
- `git pull --rebase` - Downloads bookmark history and incorporates your changes on top of remote changes
|
||||
- `git rebase --interactive --autosquash HEAD~N` - Squash N last commits
|
||||
- `git cherry-pick -n <sha>` - Cherry-pick a commit
|
||||
- `git revert -n <sha>` - Revert a commit
|
||||
|
||||
## Debugging
|
||||
- `git blame [file]` - Show what revision and author last modified each line of a file
|
||||
- `git bisect` - Use binary search to find the commit that introduced a bug
|
|
@ -0,0 +1,28 @@
|
|||
+++
|
||||
title = "Hello World"
|
||||
description = "My first post on this site."
|
||||
date = 2017-11-27T01:24:33+05:30
|
||||
|
||||
[taxonomies]
|
||||
categories = ["Blog"]
|
||||
tags = ["hugo", "hello-world"]
|
||||
+++
|
||||
|
||||
A "Hello, World!" program is a computer program that outputs or displays "Hello, World!" to a user. Being a very simple program in most programming languages, it is often used to illustrate the basic syntax of a programming language for a working program.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
- It is often the very first program people write when they are new to a language.
|
||||
- "Hello, world!" is also traditionally used in a sanity test to make sure that a computer language is correctly installed, and that the operator understands how to use it.
|
||||
- "Hello, world!" is also used by computer hackers as a proof of concept that arbitrary code can be executed through an exploit where the system designers did not intend code to be executed.
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
|
||||
main( )
|
||||
{
|
||||
printf("Hello, World!");
|
||||
}
|
||||
```
|
||||
|
||||
So here is my first blog post, the topics that I will be blogging about are going to be mostly related to programming, technology, gadgets, photography etc. Or maybe not, at this point I don't really know.
|
|
@ -0,0 +1,366 @@
|
|||
+++
|
||||
title = "Markdown Cheatsheet"
|
||||
description = "A cheatsheet one and only most beloved text editor Vim."
|
||||
date = 2020-03-28T23:19:47+05:30
|
||||
|
||||
[taxonomies]
|
||||
categories = ["Cheatsheet"]
|
||||
tags = ["markdown"]
|
||||
|
||||
[extra]
|
||||
toc = true
|
||||
+++
|
||||
|
||||
Markdown is a way to style text on the web. You control the display of the document; formatting words as bold or italic, adding images, and creating lists are just a few of the things we can do with Markdown. Mostly, Markdown is just regular text with a few non-alphabetic characters thrown in, like # or *.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
## Headers
|
||||
|
||||
```no-highlight
|
||||
# H1
|
||||
## H2
|
||||
### H3
|
||||
#### H4
|
||||
##### H5
|
||||
###### H6
|
||||
|
||||
Alternatively, for H1 and H2, an underline-ish style:
|
||||
|
||||
Alt-H1
|
||||
======
|
||||
|
||||
Alt-H2
|
||||
------
|
||||
```
|
||||
|
||||
```no-highlight
|
||||
Emphasis, aka italics, with *asterisks* or _underscores_.
|
||||
|
||||
Strong emphasis, aka bold, with **asterisks** or __underscores__.
|
||||
|
||||
Combined emphasis with **asterisks and _underscores_**.
|
||||
|
||||
Strikethrough uses two tildes. ~~Scratch this.~~
|
||||
```
|
||||
|
||||
Emphasis, aka italics, with _asterisks_ or _underscores_.
|
||||
|
||||
Strong emphasis, aka bold, with **asterisks** or **underscores**.
|
||||
|
||||
Combined emphasis with **asterisks and _underscores_**.
|
||||
|
||||
Strikethrough uses two tildes. ~~Scratch this.~~
|
||||
|
||||
## Lists
|
||||
|
||||
(In this example, leading and trailing spaces are shown with with dots: ⋅)
|
||||
|
||||
```no-highlight
|
||||
1. First ordered list item
|
||||
2. Another item
|
||||
⋅⋅* Unordered sub-list.
|
||||
1. Actual numbers don't matter, just that it's a number
|
||||
⋅⋅1. Ordered sub-list
|
||||
4. And another item.
|
||||
|
||||
⋅⋅⋅You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
|
||||
|
||||
⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅
|
||||
⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅
|
||||
⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
|
||||
|
||||
* Unordered list can use asterisks
|
||||
- Or minuses
|
||||
+ Or pluses
|
||||
```
|
||||
|
||||
1. First ordered list item
|
||||
2. Another item
|
||||
|
||||
- Unordered sub-list.
|
||||
|
||||
1. Actual numbers don't matter, just that it's a number
|
||||
1. Ordered sub-list
|
||||
1. And another item.
|
||||
|
||||
You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
|
||||
|
||||
To have a line break without a paragraph, you will need to use two trailing spaces.
|
||||
Note that this line is separate, but within the same paragraph.
|
||||
(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
|
||||
|
||||
- Unordered list can use asterisks
|
||||
|
||||
* Or minuses
|
||||
|
||||
- Or pluses
|
||||
|
||||
## Links
|
||||
|
||||
There are two ways to create links.
|
||||
|
||||
```no-highlight
|
||||
[I'm an inline-style link](https://www.google.com)
|
||||
|
||||
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
|
||||
|
||||
[I'm a reference-style link][Arbitrary case-insensitive reference text]
|
||||
|
||||
[I'm a relative reference to a repository file](../blob/master/LICENSE)
|
||||
|
||||
[You can use numbers for reference-style link definitions][1]
|
||||
|
||||
Or leave it empty and use the [link text itself].
|
||||
|
||||
URLs and URLs in angle brackets will automatically get turned into links.
|
||||
http://www.example.com or <http://www.example.com> and sometimes
|
||||
example.com (but not on Github, for example).
|
||||
|
||||
Some text to show that the reference links can follow later.
|
||||
|
||||
[arbitrary case-insensitive reference text]: https://www.mozilla.org
|
||||
[1]: http://slashdot.org
|
||||
[link text itself]: http://www.reddit.com
|
||||
```
|
||||
|
||||
[I'm an inline-style link](https://www.google.com)
|
||||
|
||||
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
|
||||
|
||||
[I'm a reference-style link][arbitrary case-insensitive reference text]
|
||||
|
||||
[I'm a relative reference to a repository file](../blob/master/LICENSE)
|
||||
|
||||
[You can use numbers for reference-style link definitions][1]
|
||||
|
||||
Or leave it empty and use the [link text itself].
|
||||
|
||||
URLs and URLs in angle brackets will automatically get turned into links.
|
||||
http://www.example.com or <http://www.example.com> and sometimes
|
||||
example.com (but not on Github, for example).
|
||||
|
||||
Some text to show that the reference links can follow later.
|
||||
|
||||
[arbitrary case-insensitive reference text]: https://www.mozilla.org
|
||||
[1]: http://slashdot.org
|
||||
[link text itself]: http://www.reddit.com
|
||||
|
||||
## Images
|
||||
|
||||
```no-highlight
|
||||
Here's our logo (hover to see the title text):
|
||||
|
||||
Inline-style:
|
||||
![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
|
||||
|
||||
Reference-style:
|
||||
![alt text][logo]
|
||||
|
||||
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
|
||||
```
|
||||
|
||||
Here's our logo (hover to see the title text):
|
||||
|
||||
Inline-style:
|
||||
![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
|
||||
|
||||
Reference-style:
|
||||
![alt text][logo]
|
||||
|
||||
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
|
||||
|
||||
## Code and Syntax Highlighting
|
||||
|
||||
Code blocks are part of the Markdown spec, but syntax highlighting isn't. However, many renderers -- like Github's and _Markdown Here_ -- support syntax highlighting. Which languages are supported and how those language names should be written will vary from renderer to renderer. _Markdown Here_ supports highlighting for dozens of languages (and not-really-languages, like diffs and HTTP headers); to see the complete list, and how to write the language names, see the [highlight.js demo page](http://softwaremaniacs.org/media/soft/highlight/test.html).
|
||||
|
||||
```no-highlight
|
||||
Inline `code` has `back-ticks around` it.
|
||||
```
|
||||
|
||||
Inline `code` has `back-ticks around` it.
|
||||
|
||||
Blocks of code are either fenced by lines with three back-ticks <code>```</code>, or are indented with four spaces. I recommend only using the fenced code blocks -- they're easier and only they support syntax highlighting.
|
||||
|
||||
<pre lang="no-highlight"><code>```javascript
|
||||
var s = "JavaScript syntax highlighting";
|
||||
alert(s);
|
||||
```
|
||||
|
||||
```python
|
||||
s = "Python syntax highlighting"
|
||||
print s
|
||||
```
|
||||
|
||||
```
|
||||
No language indicated, so no syntax highlighting.
|
||||
But let's throw in a <b>tag</b>.
|
||||
```
|
||||
</code></pre>
|
||||
|
||||
```javascript
|
||||
var s = "JavaScript syntax highlighting";
|
||||
alert(s);
|
||||
```
|
||||
|
||||
```python
|
||||
s = "Python syntax highlighting"
|
||||
print s
|
||||
```
|
||||
|
||||
```
|
||||
No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
|
||||
But let's throw in a <b>tag</b>.
|
||||
```
|
||||
|
||||
## Tables
|
||||
|
||||
Tables aren't part of the core Markdown spec, but they are part of GFM and _Markdown Here_ supports them. They are an easy way of adding tables to your email -- a task that would otherwise require copy-pasting from another application.
|
||||
|
||||
```no-highlight
|
||||
Colons can be used to align columns.
|
||||
|
||||
| Tables | Are | Cool |
|
||||
| ------------- |:-------------:| -----:|
|
||||
| col 3 is | right-aligned | $1600 |
|
||||
| col 2 is | centered | $12 |
|
||||
| zebra stripes | are neat | $1 |
|
||||
|
||||
There must be at least 3 dashes separating each header cell.
|
||||
The outer pipes (|) are optional, and you don't need to make the
|
||||
raw Markdown line up prettily. You can also use inline Markdown.
|
||||
|
||||
Markdown | Less | Pretty
|
||||
--- | --- | ---
|
||||
*Still* | `renders` | **nicely**
|
||||
1 | 2 | 3
|
||||
```
|
||||
|
||||
Colons can be used to align columns.
|
||||
|
||||
| Tables | Are | Cool |
|
||||
| ------------- | :-----------: | -----: |
|
||||
| col 3 is | right-aligned | \$1600 |
|
||||
| col 2 is | centered | \$12 |
|
||||
| zebra stripes | are neat | \$1 |
|
||||
|
||||
There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
|
||||
|
||||
| Markdown | Less | Pretty |
|
||||
| -------- | --------- | ---------- |
|
||||
| _Still_ | `renders` | **nicely** |
|
||||
| 1 | 2 | 3 |
|
||||
|
||||
## Blockquotes
|
||||
|
||||
```no-highlight
|
||||
> Blockquotes are very handy in email to emulate reply text.
|
||||
> This line is part of the same quote.
|
||||
|
||||
Quote break.
|
||||
|
||||
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
|
||||
```
|
||||
|
||||
> Blockquotes are very handy in email to emulate reply text.
|
||||
> This line is part of the same quote.
|
||||
|
||||
Quote break.
|
||||
|
||||
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can _put_ **Markdown** into a blockquote.
|
||||
|
||||
## Inline HTML
|
||||
|
||||
You can also use raw HTML in your Markdown, and it'll mostly work pretty well.
|
||||
|
||||
```no-highlight
|
||||
<dl>
|
||||
<dt>Definition list</dt>
|
||||
<dd>Is something people use sometimes.</dd>
|
||||
|
||||
<dt>Markdown in HTML</dt>
|
||||
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
|
||||
</dl>
|
||||
```
|
||||
|
||||
<dl>
|
||||
<dt>Definition list</dt>
|
||||
<dd>Is something people use sometimes.</dd>
|
||||
|
||||
<dt>Markdown in HTML</dt>
|
||||
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
|
||||
</dl>
|
||||
|
||||
## Horizontal Rule
|
||||
|
||||
```
|
||||
Three or more...
|
||||
|
||||
---
|
||||
|
||||
Hyphens
|
||||
|
||||
***
|
||||
|
||||
Asterisks
|
||||
|
||||
___
|
||||
|
||||
Underscores
|
||||
```
|
||||
|
||||
Three or more...
|
||||
|
||||
---
|
||||
|
||||
Hyphens
|
||||
|
||||
---
|
||||
|
||||
Asterisks
|
||||
|
||||
---
|
||||
|
||||
Underscores
|
||||
|
||||
## Line Breaks
|
||||
|
||||
My basic recommendation for learning how line breaks work is to experiment and discover -- hit <Enter> once (i.e., insert one newline), then hit it twice (i.e., insert two newlines), see what happens. You'll soon learn to get what you want. "Markdown Toggle" is your friend.
|
||||
|
||||
Here are some things to try out:
|
||||
|
||||
```
|
||||
Here's a line for us to start with.
|
||||
|
||||
This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
|
||||
|
||||
This line is also a separate paragraph, but...
|
||||
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
|
||||
```
|
||||
|
||||
Here's a line for us to start with.
|
||||
|
||||
This line is separated from the one above by two newlines, so it will be a _separate paragraph_.
|
||||
|
||||
This line is also begins a separate paragraph, but...
|
||||
This line is only separated by a single newline, so it's a separate line in the _same paragraph_.
|
||||
|
||||
(Technical note: _Markdown Here_ uses GFM line breaks, so there's no need to use MD's two-space line breaks.)
|
||||
|
||||
## YouTube Videos
|
||||
|
||||
They can't be added directly but you can add an image with a link to the video like this:
|
||||
|
||||
```no-highlight
|
||||
<a href="http://www.youtube.com/watch?feature=player_embedded&v=YOUTUBE_VIDEO_ID_HERE
|
||||
" target="_blank"><img src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"
|
||||
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>
|
||||
```
|
||||
|
||||
Or, in pure Markdown, but losing the image sizing and border:
|
||||
|
||||
```no-highlight
|
||||
[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)
|
||||
```
|
||||
|
||||
Referencing a bug by #bugID in your git commit links it to the slip. For example #1.
|
|
@ -0,0 +1,504 @@
|
|||
+++
|
||||
title = "SQL Cheatsheet"
|
||||
description = "A cheatsheet for Structured Query Language(SQL)."
|
||||
date = 2020-08-28T23:19:47+05:30
|
||||
|
||||
[taxonomies]
|
||||
categories = ["Cheatsheet"]
|
||||
tags = ["sql"]
|
||||
|
||||
[extra]
|
||||
toc = true
|
||||
+++
|
||||
|
||||
SQL(Structured Query Language) is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS). This is a concise `tldr` format cheatsheet for SQL.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
- **DDL** is short name of Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database.
|
||||
|
||||
- **DML** is short name of Data Manipulation Language which deals with data manipulation, and includes most common SQL statements such SELECT, INSERT, UPDATE, DELETE etc, and it is used to store, modify, retrieve, delete and update data in database.
|
||||
|
||||
- **DCL** is short name of Data Control Language which includes commands such as GRANT, and mostly concerned with rights, permissions and other controls of the database system.
|
||||
|
||||
|
||||
# Datatypes
|
||||
## Text types
|
||||
|
||||
| Data type | Description |
|
||||
|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| CHAR(size) | Holds a fixed length string (can contain letters, numbers, and special characters). The fixed size is specified in parenthesis. Can store up to 255 characters |
|
||||
| VARCHAR(size) | Holds a variable length string (can contain letters, numbers, and special characters). The maximum size is specified in parenthesis. Can store up to 255 characters. Note: If you put a greater value than 255 it will be converted to a TEXT type |
|
||||
| TINYTEXT | Holds a string with a maximum length of 255 characters |
|
||||
| TEXT | Holds a string with a maximum length of 65,535 characters |
|
||||
| BLOB | For BLOBs (Binary Large OBjects). Holds up to 65,535 bytes of data |
|
||||
| MEDIUMTEXT | Holds a string with a maximum length of 16,777,215 characters |
|
||||
| MEDIUMBLOB | For BLOBs (Binary Large OBjects). Holds up to 16,777,215 bytes of data |
|
||||
| LONGTEXT | Holds a string with a maximum length of 4,294,967,295 characters |
|
||||
| LONGBLOB | For BLOBs (Binary Large OBjects). Holds up to 4,294,967,295 bytes of data |
|
||||
| ENUM(x,y,z,etc.) | Let you enter a list of possible values. You can list up to 65535 values in an ENUM list. If a value is inserted that is not in the list, a blank value will be inserted.Note: The values are sorted in the order you enter them.You enter the possible values in this format: ENUM('X','Y','Z') |
|
||||
| SET | Similar to ENUM except that SET may contain up to 64 list items and can store more than one choice |
|
||||
|
||||
## Number types
|
||||
|
||||
| Data type | Description |
|
||||
|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| TINYINT(size) | -128 to 127 normal. 0 to 255 UNSIGNED*. The maximum number of digits may be specified in parenthesis |
|
||||
| SMALLINT(size) | -32768 to 32767 normal. 0 to 65535 UNSIGNED*. The maximum number of digits may be specified in parenthesis |
|
||||
| MEDIUMINT(size) | -8388608 to 8388607 normal. 0 to 16777215 UNSIGNED*. The maximum number of digits may be specified in parenthesis |
|
||||
| INT(size) | -2147483648 to 2147483647 normal. 0 to 4294967295 UNSIGNED*. The maximum number of digits may be specified in parenthesis |
|
||||
| BIGINT(size) | -9223372036854775808 to 9223372036854775807 normal. 0 to 18446744073709551615 UNSIGNED*. The maximum number of digits may be specified in parenthesis |
|
||||
| FLOAT(size,d) | A small number with a floating decimal point. The maximum number of digits may be specified in the size parameter. The maximum number of digits to the right of the decimal point is specified in the d parameter |
|
||||
| DOUBLE(size,d) | A large number with a floating decimal point. The maximum number of digits may be specified in the size parameter. The maximum number of digits to the right of the decimal point is specified in the d parameter |
|
||||
| DECIMAL(size,d) | A DOUBLE stored as a string , allowing for a fixed decimal point. The maximum number of digits may be specified in the size parameter. The maximum number of digits to the right of the decimal point is specified in the d parameter |
|
||||
|
||||
## Date types
|
||||
|
||||
| Data type | Description |
|
||||
|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| DATE() | A date. Format: YYYY-MM-DDNote: The supported range is from '1000-01-01' to '9999-12-31' |
|
||||
| DATETIME() | *A date and time combination. Format: YYYY-MM-DD HH:MI:SSNote: The supported range is from '1000-01-01 00:00:00' to '9999-12-31 23:59:59' |
|
||||
| TIMESTAMP() | *A timestamp. TIMESTAMP values are stored as the number of seconds since the Unix epoch ('1970-01-01 00:00:00' UTC). Format: YYYY-MM-DD HH:MI:SSNote: The supported range is from '1970-01-01 00:00:01' UTC to '2038-01-09 03:14:07' UTC |
|
||||
| TIME() | A time. Format: HH:MI:SSNote: The supported range is from '-838:59:59' to '838:59:59' |
|
||||
| YEAR() | A year in two-digit or four-digit format.Note: Values allowed in four-digit format: 1901 to 2155. Values allowed in two-digit format: 70 to 69, representing years from 1970 to 2069 |
|
||||
|
||||
# Database
|
||||
- Create
|
||||
```sql
|
||||
create database dbname;
|
||||
```
|
||||
- Drop
|
||||
```sql
|
||||
drop database dbname;
|
||||
```
|
||||
|
||||
# Table
|
||||
- Check if not exit and create
|
||||
```sql
|
||||
IF OBJECT_ID('tbl_kunde', N'U') is not null
|
||||
drop table tbl_kunde;
|
||||
GO
|
||||
create table tbl_kunde (
|
||||
id_kunde int not null primary key,
|
||||
fi_moral_nr int,
|
||||
name varchar(25) not null,
|
||||
vorname varchar not null,
|
||||
wohnort varchar
|
||||
);
|
||||
GO
|
||||
```
|
||||
|
||||
# Alter Table
|
||||
- Primary Key
|
||||
```sql
|
||||
ALTER TABLE tbl_kunde ADD PRIMARY KEY (id_kunde);
|
||||
```
|
||||
- Foreign Key
|
||||
```sql
|
||||
ALTER TABLE tbl_kunde ADD CONSTRAINT FK_fi_moral_nr FOREIGN KEY (fi_moral_nr)
|
||||
REFERENCES tkey_moral
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE SET NULL;
|
||||
```
|
||||
- Constraint
|
||||
```sql
|
||||
ALTER TABLE tkey_moral ADD CONSTRAINT PK_id_moral_nr PRIMARY KEY (id_moral_nr);
|
||||
ALTER TABLE tbl_kunde ADD CONSTRAINT FK_fi_moral_nr FOREIGN KEY (fi_moral_nr)
|
||||
REFERENCES tkey_moral
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE SET NULL;
|
||||
```
|
||||
|
||||
# Insert
|
||||
- Selected fields
|
||||
```sql
|
||||
insert into tkey_moral (id_moral_nr, moral_bez) values (1, 'gut'), (2, 'schlecht'), (3, 'schlecht');
|
||||
```
|
||||
- All fields
|
||||
```sql
|
||||
INSERT INTO tbl_kunde VALUES (3838,1,'Meier','Laura','Waldibrücke')
|
||||
```
|
||||
|
||||
# Update
|
||||
- Update by condition
|
||||
```sql
|
||||
update tbl_kunde set name = 'Menzer' where name = 'Waltenspühl-Menzer'
|
||||
update tass_police set praem_stufe = 101 where praem_stufe = 108
|
||||
```
|
||||
|
||||
# Delete
|
||||
- All
|
||||
```sql
|
||||
delete from tbl_kunde
|
||||
```
|
||||
- Condition
|
||||
```sql
|
||||
delete from tkey_moral where id_moral_nr = 4
|
||||
delete from tbl_kunde where vorname = 'Peter' and name = 'Fischer' or vorname = 'Martin' and name = 'Müller'
|
||||
```
|
||||
|
||||
# Index
|
||||
- Create
|
||||
```sql
|
||||
create unique index ix_kund_name on tbl_kunde (name)
|
||||
```
|
||||
- Disable
|
||||
```sql
|
||||
alter index ix_kund_name on tbl_kunde disable
|
||||
```
|
||||
- Rebuild
|
||||
```sql
|
||||
alter index ix_kund_name on tbl_kunde rebuild
|
||||
```
|
||||
- Reorganize
|
||||
```sql
|
||||
alter index ix_kund_name on tbl_kunde reorganize
|
||||
```
|
||||
- Drop
|
||||
```sql
|
||||
drop index ix_kund_name on tbl_kunde
|
||||
```
|
||||
- Alter
|
||||
```sql
|
||||
drop index ix_kund_name on tbl_kunde
|
||||
```
|
||||
|
||||
# Type
|
||||
- create
|
||||
```sql
|
||||
create type tp_moralisches from numeric(9,0)
|
||||
```
|
||||
|
||||
# Login
|
||||
- change password
|
||||
```sql
|
||||
alter login stud23 with password = 'hello' old_password = 'pass_wd23'
|
||||
```
|
||||
|
||||
# User
|
||||
- create
|
||||
```sql
|
||||
create user romulus from login romulus
|
||||
```
|
||||
- drop
|
||||
```sql
|
||||
drop user romulus
|
||||
```
|
||||
|
||||
# Grant/ Revoke
|
||||
- Grant rights
|
||||
```sql
|
||||
grant select, insert, delete, references, update to romulus
|
||||
```
|
||||
- Grant refrences
|
||||
```sql
|
||||
grant references (id_moral_nr) on tkey_moral to romulus
|
||||
```
|
||||
- Revoke
|
||||
```sql
|
||||
revoke insert, delete, references, update to romulus
|
||||
```
|
||||
|
||||
# Role
|
||||
- Create
|
||||
```sql
|
||||
create role verkauf
|
||||
```
|
||||
- Add member
|
||||
```sql
|
||||
exec sp_addrolemember 'verkauf', 'anna'
|
||||
```
|
||||
|
||||
# Grant Role
|
||||
- Grant rights
|
||||
```sql
|
||||
grant select, update, insert, delete on tbl_kunde to verkauf
|
||||
```
|
||||
|
||||
# View
|
||||
- Create detailed
|
||||
```sql
|
||||
CREATE VIEW v_kunden (id, name, vorname, ort, police, gebiet) AS
|
||||
SELECT k.id_kunde, k.name, k.vorname, k.wohnort, v.vers_bez,
|
||||
v.vers_gebiet
|
||||
FROM tbl_kunde AS k, tkey_versicherung AS v, tass_police AS p
|
||||
WHERE k.id_kunde = p.id_fi_kunde
|
||||
AND p.id_fi_vers_art = v.id_vers_art;
|
||||
```
|
||||
- Create simple
|
||||
```sql
|
||||
create view plain as select id_kunde, name, vorname from tbl_kunde
|
||||
```
|
||||
- Create advanced
|
||||
```sql
|
||||
create view v_umsatz as select sum(cast(bezahlt as float)) as 'Umsatz aus Policen' from tass_police
|
||||
```
|
||||
|
||||
# Select
|
||||
- Basic
|
||||
```sql
|
||||
select dt_jahr from dbo.tbl_stueck
|
||||
```
|
||||
- Condition
|
||||
```sql
|
||||
select dt_jahr from dbo.tbl_stueck where dt_jahr is not null
|
||||
```
|
||||
- Order
|
||||
```sql
|
||||
select dt_jahr from dbo.tbl_stueck
|
||||
where dt_jahr is not null
|
||||
order by dt_jahr desc
|
||||
```
|
||||
- Distinct
|
||||
```sql
|
||||
select distinct dt_jahr from dbo.tbl_stueck
|
||||
where dt_jahr is not null
|
||||
order by dt_jahr asc
|
||||
```
|
||||
- And Condition
|
||||
```sql
|
||||
select * from tbl_stueck where dt_jahr = 1970 and dt_zeit > 3
|
||||
```
|
||||
- Between
|
||||
```sql
|
||||
select * from tbl_stueck where dt_jahr = 1970 and dt_zeit between 3 and 10
|
||||
```
|
||||
- Like
|
||||
```sql
|
||||
select * from tbl_stueck where dt_stueck_titel like 'Let%'
|
||||
```
|
||||
- Count
|
||||
```sql
|
||||
select count(dt_stueck_titel) from tbl_stueck where dt_stueck_titel like 'Let%'
|
||||
```
|
||||
- Having and without join
|
||||
```sql
|
||||
select i.dt_name, count(s.dt_stueck_titel) from tbl_stueck as s, tkey_interpret as i
|
||||
where s.fi_interpret = i.id_interpret
|
||||
group by i.dt_name
|
||||
having count(s.dt_stueck_titel) >10
|
||||
order by count(s.dt_stueck_titel) de
|
||||
```
|
||||
|
||||
# Join the hard way
|
||||
- Inner Join
|
||||
```sql
|
||||
select s.dt_stueck_titel, i.dt_name
|
||||
from tbl_stueck as s, tkey_interpret as i
|
||||
where s.fi_interpret = i.id_interpret
|
||||
order by s.dt_stueck_titel
|
||||
```
|
||||
- Multi Join
|
||||
```sql
|
||||
select sa.id_jahr, st.dt_stueck_titel, ip.dt_name
|
||||
from tbl_stueck as st, tass_stueck_sampler as ss, tkey_sampler as sa, tkey_interpret as ip
|
||||
where ss.id_fi_stueck_nr = st.id_stueck_nr
|
||||
and ss.id_fi_jahr = sa.id_jahr
|
||||
and st.fi_interpret = ip.id_interpret
|
||||
order by st.dt_stueck_titel
|
||||
```
|
||||
|
||||
# Join the right way
|
||||
- Inner Equi Key Joining
|
||||
```sql
|
||||
select dt_stueck_titel, dt_name
|
||||
from tbl_stueck join tkey_interpret
|
||||
on fi_interpret = id_interpret
|
||||
order by dt_stueck_titel
|
||||
```
|
||||
- Multi Inner Equi Key Joining
|
||||
```sql
|
||||
select id_fi_jahr, dt_stueck_titel, dt_name
|
||||
from tbl_stueck
|
||||
join tass_stueck_sampler on id_fi_stueck_nr = id_stueck_nr
|
||||
join tkey_interpret on fi_interpret = id_interpret
|
||||
order by dt_stueck_titel
|
||||
```
|
||||
|
||||
# About Joins
|
||||
![sql join summary](http://i.stack.imgur.com/hzl8e.png)
|
||||
```sql
|
||||
SELECT customers.id, customers.name, items.name, customers.state
|
||||
FROM customers, items
|
||||
WHERE customers.id=seller_id
|
||||
ORDER BY customers.id
|
||||
```
|
||||
**Join tables** -> Joining two tables together in a query output. The third line is important because it shows how the two tables are related (in this case it is their key values).
|
||||
|
||||
```sql
|
||||
SELECT customers.name, items.name FROM customers
|
||||
LEFT OUTER JOIN items ON customers.id=seller_id
|
||||
```
|
||||
**LEFT/RIGHT OUTER JOIN** -> Takes the table left of the word 'LEFT' or 'RIGHT' (in this case customers) and joins it regardless of whether it has any values or not. So the above statement shows all users/customers, even if they aren't selling anything.
|
||||
|
||||
# Select with Subqueries
|
||||
- Select max and min values
|
||||
```sql
|
||||
select dt_stueck_titel as Titel, dt_zeit as Zeit
|
||||
from tbl_stueck
|
||||
where dt_zeit = (select max(dt_zeit) from tbl_stueck)
|
||||
or dt_zeit = (select min(dt_zeit) from tbl_stueck)
|
||||
order by dt_zeit;
|
||||
```
|
||||
- Select with query in condition
|
||||
```sql
|
||||
select dt_stueck_titel as Titel, dt_zeit as Zeit
|
||||
from tbl_stueck
|
||||
where dt_zeit between (select avg(dt_zeit) from tbl_stueck)*0.9
|
||||
and (select avg(dt_zeit) from tbl_stueck)*1.1
|
||||
order by dt_zeit;
|
||||
```
|
||||
- Select query as value
|
||||
```sql
|
||||
select dt_stueck_titel as Titel,
|
||||
dt_zeit/(select avg(dt_zeit) from tbl_stueck)*100 as Zeit
|
||||
from tbl_stueck
|
||||
where dt_stueck_titel = 'You Shook Me'
|
||||
```
|
||||
|
||||
# Union
|
||||
- Unify two result sets with a condition
|
||||
```sql
|
||||
select * from
|
||||
(select dt_stueck_titel as titel, 'stück' as 'type' from tbl_stueck
|
||||
union
|
||||
select dt_name as titel, 'inter' as 'type' from tkey_interpret
|
||||
union
|
||||
select dt_stao as titel, 'stao' as 'type' from tkey_standort) as t
|
||||
where t.titel like '%boy%'
|
||||
```
|
||||
|
||||
# Transactions
|
||||
- Run a transaction
|
||||
```sql
|
||||
begin transaction
|
||||
update tass_police set bezahlt = 0 where id_fi_kunde = 3533 and id_fi_vers_art = 1700
|
||||
commit
|
||||
-- or rollback
|
||||
```
|
||||
|
||||
# Function
|
||||
A function can be called from inside a statement just like any other function and can return a scalar value.
|
||||
|
||||
- Create - Get value from table
|
||||
```sql
|
||||
create function f_plic_bez()
|
||||
returns decimal(10,2)
|
||||
as begin
|
||||
return (select sum(bezahlt) from tass_police)
|
||||
end;
|
||||
go
|
||||
select dbo.f_plic_bez() AS 'Summe aller bezahlten Leistungen'
|
||||
go
|
||||
```
|
||||
- Drop
|
||||
```sql
|
||||
drop function f_bezahlt_versich
|
||||
```
|
||||
- Create - With parameters
|
||||
```sql
|
||||
create function f_rabatt(@name varchar(40), @vers varchar(30))
|
||||
returns int
|
||||
as begin
|
||||
return (select (praem_stufe-100)*10 from tass_police
|
||||
join tbl_kunde on id_fi_kunde = id_kunde
|
||||
join tkey_versicherung on id_fi_vers_art = id_vers_art
|
||||
where name = @name and vers_bez = @vers)
|
||||
end
|
||||
```
|
||||
|
||||
# Procedure
|
||||
Stored procedures are stored as precompilated code (stored routine) and called by the programmer wherever it wants to fire. Stored procedure can return value(s).
|
||||
|
||||
- Create and execute
|
||||
```sql
|
||||
CREATE PROCEDURE p_polic_del @fname VARCHAR(30), @versich VARCHAR(30)
|
||||
AS
|
||||
BEGIN
|
||||
DELETE FROM tass_police
|
||||
FROM tbl_kunde, tkey_versicherung
|
||||
WHERE name = @fname
|
||||
AND id_kunde = id_fi_kunde
|
||||
AND id_fi_vers_art = id_vers_art
|
||||
AND vers_bez = @versich
|
||||
IF @@ROWCOUNT = 0
|
||||
PRINT 'Police existiert nicht.'
|
||||
ELSE PRINT 'Löschung vollzogen.'
|
||||
END
|
||||
GO
|
||||
|
||||
EXECUTE p_polic_del 'Meier', 'Taggeld';
|
||||
```
|
||||
|
||||
# Variables
|
||||
- Declare
|
||||
```sql
|
||||
DECLARE @veraenderung SMALLINT = 180;
|
||||
DECLARE @neue_summe INT;
|
||||
```
|
||||
|
||||
# Trigger
|
||||
Triggers are named database objects fired automatically when insert, delete, update (or other event) occurred, there can be no explicit invocation. Trigger can not return any data.
|
||||
|
||||
- Create simple
|
||||
```sql
|
||||
create trigger t_ort on tbl_kunde
|
||||
after insert, update
|
||||
as beginn
|
||||
set @ort = select wohnort from inserted)
|
||||
if((@ort like '/^[A-Z]') && len(@ort) < 2)
|
||||
rollback transaction
|
||||
end
|
||||
end
|
||||
```
|
||||
- Drop
|
||||
```sql
|
||||
drop trigger t_ort
|
||||
```
|
||||
- Checks the referential integrity
|
||||
```sql
|
||||
create trigger t_bst_mut on bst
|
||||
for insert, update
|
||||
as
|
||||
begin
|
||||
set nocount on;
|
||||
if(select id_fi_k from inserted) NOT IN (select id_kund from knd)
|
||||
begin
|
||||
raiserror('Es besteht kein entsprechender Kunde.', 15, 1);
|
||||
rollback transaction;
|
||||
end
|
||||
end;
|
||||
```
|
||||
- Replaces on delete no action
|
||||
```sql
|
||||
create trigger t_ku_del on knd
|
||||
for delete
|
||||
as
|
||||
begin
|
||||
set nocount on;
|
||||
if((select id_kunde from deleted) IN (select id_fi_k from bst))
|
||||
begin
|
||||
raiserror('Löschung verwert; es bestehen noch Bestelungen für diesen Kunden.', 15, 1)
|
||||
rollback transaction
|
||||
end
|
||||
end;
|
||||
```
|
||||
- Replaces on update cascade
|
||||
```sql
|
||||
create trigger t_update_knd on knd
|
||||
after update
|
||||
as
|
||||
begin
|
||||
set nocount on;
|
||||
update bst set id_fi_k = (select id_kund from inserted)
|
||||
end;
|
||||
```
|
||||
- Replaces on delete cascade
|
||||
```sql
|
||||
create trigger t_delete_knd on knd
|
||||
after delete
|
||||
as
|
||||
begin
|
||||
delete from bst where id_fi_k = (select id_kund from deleted)
|
||||
end;
|
||||
```
|
|
@ -0,0 +1,72 @@
|
|||
+++
|
||||
title = "Teminal Cheatsheet"
|
||||
description = "Make your workflow faster on terminal."
|
||||
date = 2018-04-06T23:19:47+05:30
|
||||
|
||||
[taxonomies]
|
||||
categories = ["Cheatsheet"]
|
||||
tags = ["terminal", "short-cuts"]
|
||||
|
||||
[extra]
|
||||
toc = true
|
||||
+++
|
||||
|
||||
Sweet and simple `tldr;` terminal cheatsheet.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
## Working With Processes
|
||||
|
||||
- `Ctrl+C` - Interrupt (kill) the current foreground process running in in the terminal. This sends the SIGINT signal to the process, which is technically just a request—most processes will honor it, but some may ignore it.
|
||||
- `Ctrl+Z` - Suspend the current foreground process running in bash. This sends the SIGTSTP signal to the process. To return the process to the foreground later, use the fg process_name command.
|
||||
- `Ctrl+D` - Close the bash shell. This sends an EOF (End-of-file) marker to bash, and bash exits when it receives this marker. This is similar to running the exit command.
|
||||
|
||||
## Controlling the Screen
|
||||
|
||||
- `Ctrl+L` - Clear the screen. This is similar to running the “clear” command.
|
||||
- `Ctrl+S` - Stop all output to the screen. This is particularly useful when running commands with a lot of long, verbose output, but you don’t want to stop the command itself with Ctrl+C.
|
||||
- `Ctrl+Q` - Resume output to the screen after stopping it with Ctrl+S.
|
||||
|
||||
## Moving the Cursor
|
||||
|
||||
- `Ctrl+A or Home` - Go to the beginning of the line.
|
||||
- `Ctrl+E or End` - Go to the end of the line.
|
||||
- `Alt+B` - Go left (back) one word.
|
||||
- `Ctrl+B` - Go left (back) one character.
|
||||
- `Alt+F` - Go right (forward) one word.
|
||||
- `Ctrl+F` - Go right (forward) one character.
|
||||
- `Ctrl+XX` - Move between the beginning of the line and the current position of the cursor. This allows you to press Ctrl+XX to return to the start of the line, change something, and then press Ctrl+XX to go back to your original cursor position. To use this shortcut, hold the Ctrl key and tap the X key twice.
|
||||
|
||||
## Deleting Text
|
||||
|
||||
- `Ctrl+D or Delete` - Delete the character under the cursor.
|
||||
- `Alt+D` - Delete all characters after the cursor on the current line.
|
||||
- `Ctrl+H or Backspace` - Delete the character before the cursor.
|
||||
|
||||
## Fixing Typos
|
||||
|
||||
- `Alt+T`- Swap the current word with the previous word.
|
||||
- `Ctrl+T` - Swap the last two characters before the cursor with each other. You can use this to quickly fix typos when you type two characters in the wrong order.
|
||||
- `Ctrl+_` - Undo your last key press. You can repeat this to undo multiple times.
|
||||
|
||||
## Cutting and Pasting
|
||||
|
||||
- `Ctrl+W` - Cut the word before the cursor, adding it to the clipboard.
|
||||
- `Ctrl+K` - Cut the part of the line after the cursor, adding it to the clipboard.
|
||||
- `Ctrl+U` - Cut the part of the line before the cursor, adding it to the clipboard.
|
||||
- `Ctrl+Y` - Paste the last thing you cut from the clipboard. The y here stands for “yank”.
|
||||
|
||||
## Capitalizing Characters
|
||||
|
||||
- `Alt+U` - Capitalize every character from the cursor to the end of the current word, converting the characters to upper case.
|
||||
- `Alt+L` - Uncapitalize every character from the cursor to the end of the current word, converting the characters to lower case.
|
||||
- `Alt+C` - Capitalize the character under the cursor. Your cursor will move to the end of the current word.
|
||||
|
||||
## Working With Your Command History
|
||||
|
||||
- `Ctrl+P or Up Arrow` - Go to the previous command in the command history. Press the shortcut multiple times to walk back through the history.
|
||||
- `Ctrl+N or Down Arrow` - Go to the next command in the command history. Press the shortcut multiple times to walk forward through the history.
|
||||
- `Alt+R`- Revert any changes to a command you’ve pulled from your history if you’ve edited it.
|
||||
- `Ctrl+R` - Recall the last command matching the characters you provide. Press this shortcut and start typing to search your bash history for a command.
|
||||
- `Ctrl+O` - Run a command you found with Ctrl+R.
|
||||
- `Ctrl+G` - Leave history searching mode without running a command.
|
|
@ -0,0 +1,45 @@
|
|||
+++
|
||||
title = "Terminal Customization"
|
||||
description = "Make your terminal prompt look awesome and helpful."
|
||||
author = "Ratan Kulshreshtha"
|
||||
date = 2018-03-17T15:30:43+05:30
|
||||
|
||||
[taxonomies]
|
||||
categories = ["Blog"]
|
||||
tags = ["terminal", "fish", "git", "prompts"]
|
||||
+++
|
||||
|
||||
I run a Fedora 27 box as of now and I use **Tilix** as my emulator and **fish** as my shell with **Oh My Fish**. **fish** is a smart and user-friendly command line shell and I really love this and you should try it out.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
To get **fish** on your machine you can go to this [page](https://fishshell.com/) and install fish for your machine, once you have installed fish on your machine you should also install **Oh My Fish** from [here](https://github.com/oh-my-fish/oh-my-fish). And once you have done that you are ready to customize your prompt mine looks like this
|
||||
|
||||
![Clean git](prompt.png)
|
||||
|
||||
I am using bobthefish as my current theme for fish shell with `SauceCodePro Nerd Font Regular` as font, bobthefish is a Powerline-style, Git-aware fish theme optimized for awesome.
|
||||
|
||||
To use the theme completely you need to install [nerd-fonts](https://github.com/ryanoasis/nerd-fonts) in your system.
|
||||
|
||||
Here is my config.fish.
|
||||
|
||||
```fish
|
||||
# Config options for bobthefish
|
||||
set -g theme_display_vagrant yes
|
||||
set -g theme_display_docker_machine no
|
||||
set -g theme_display_k8s_context yes
|
||||
set -g theme_display_hg yes
|
||||
set -g theme_display_user yes
|
||||
set -g theme_display_hostname yes
|
||||
set -g theme_display_vi no
|
||||
set -g theme_title_display_user yes
|
||||
set -g theme_title_use_abbreviated_path no
|
||||
set -g theme_avoid_ambiguous_glyphs yes
|
||||
set -g theme_nerd_fonts yes
|
||||
set -g theme_show_exit_status yes
|
||||
set -g default_user your_normal_user
|
||||
set -g theme_color_scheme solarized-dark
|
||||
set -x VIRTUAL_ENV_DISABLE_PROMPT 1
|
||||
```
|
||||
|
||||
I hope you find this post usefull and give fish shell a try.
|
After Width: | Height: | Size: 31 KiB |
|
@ -0,0 +1,213 @@
|
|||
+++
|
||||
title = "Vim Cheatsheet"
|
||||
description = "A cheatsheet for our most beloved text editor Vim."
|
||||
date = 2020-05-28T23:19:47+05:30
|
||||
|
||||
[taxonomies]
|
||||
categories = ["Cheatsheet"]
|
||||
tags = ["vim"]
|
||||
|
||||
[extra]
|
||||
toc = true
|
||||
+++
|
||||
|
||||
This cheatsheet is summarized from personal experience and other online tutorials. It should not be considered as an official advice.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
## Global
|
||||
|
||||
- `:help keyword` - open help for keyword
|
||||
- `:saveas file` - save file as
|
||||
- `:close` - close current pane
|
||||
- `K` - open man page for word under the cursor
|
||||
|
||||
## Cursor movement
|
||||
|
||||
- `h` - move cursor left
|
||||
- `j` - move cursor down
|
||||
- `k` - move cursor up
|
||||
- `l` - move cursor right
|
||||
- `H` - move to top of screen
|
||||
- `M` - move to middle of screen
|
||||
- `L` - move to bottom of screen
|
||||
- `w` - jump forwards to the start of a word
|
||||
- `W` - jump forwards to the start of a word (words can contain punctuation)
|
||||
- `e` - jump forwards to the end of a word
|
||||
- `E` - jump forwards to the end of a word (words can contain punctuation)
|
||||
- `b` - jump backwards to the start of a word
|
||||
- `B` - jump backwards to the start of a word (words can contain punctuation)
|
||||
- `%` - move to matching character (default supported pairs: '()', '{}', '[]' - use :h matchpairs in vim for more info)
|
||||
- `0` - jump to the start of the line
|
||||
- `^` - jump to the first non-blank character of the line
|
||||
- `$` - jump to the end of the line
|
||||
- `g_` - jump to the last non-blank character of the line
|
||||
- `gg` - go to the first line of the document
|
||||
- `G` - go to the last line of the document
|
||||
- `5G` - go to line 5
|
||||
- `fx` - jump to next occurrence of character x
|
||||
- `tx` - jump to before next occurrence of character x
|
||||
- `Fx` - jump to previous occurence of character x
|
||||
- `Tx`- jump to after previous occurence of character x
|
||||
- `;` - repeat previous f, t, F or T movement
|
||||
- `,` - repeat previous f, t, F or T movement, backwards
|
||||
- `}` - jump to next paragraph (or function/block, when editing code)
|
||||
- `{` - jump to previous paragraph (or function/block, when editing code)
|
||||
- `zz` - center cursor on screen
|
||||
- `Ctrl + e` - move screen down one line (without moving cursor)
|
||||
- `Ctrl + y` - move screen up one line (without moving cursor)
|
||||
- `Ctrl + b` - move back one full screen
|
||||
- `Ctrl + f` - move forward one full screen
|
||||
- `Ctrl + d` - move forward 1/2 a screen
|
||||
- `Ctrl + u` - move back 1/2 a screen
|
||||
|
||||
Tip Prefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines.
|
||||
|
||||
## Insert mode - inserting/appending text
|
||||
|
||||
- `i` - insert before the cursor
|
||||
- `I` - insert at the beginning of the line
|
||||
- `a` - insert (append) after the cursor
|
||||
- `A` - insert (append) at the end of the line
|
||||
- `o` - append (open) a new line below the current line
|
||||
- `O` - append (open) a new line above the current line
|
||||
- `ea` - insert (append) at the end of the word
|
||||
- `Esc` - exit insert mode
|
||||
|
||||
## Editing
|
||||
|
||||
- `r` - replace a single character
|
||||
- `J` - join line below to the current one with one space in between
|
||||
- `gJ` - join line below to the current one without space in between
|
||||
- `gwip` - reflow paragraph
|
||||
- `cc` - change (replace) entire line
|
||||
- `C` - change (replace) to the end of the line
|
||||
- `c$` - change (replace) to the end of the line
|
||||
- `ciw` - change (replace) entire word
|
||||
- `cw` - change (replace) to the end of the word
|
||||
- `s` - delete character and substitute text
|
||||
- `S` - delete line and substitute text (same as cc)
|
||||
- `xp` - transpose two letters (delete and paste)
|
||||
- `u` - undo
|
||||
- `Ctrl + r` - redo
|
||||
- `.` - repeat last command
|
||||
|
||||
## Cut and paste
|
||||
|
||||
- `yy` - yank (copy) a line
|
||||
- `2yy` - yank (copy) 2 lines
|
||||
- `yw` - yank (copy) the characters of the word from the cursor position to the start of the next word
|
||||
- `y$` - yank (copy) to end of line
|
||||
- `p` - put (paste) the clipboard after cursor
|
||||
- `P` - put (paste) before cursor
|
||||
- `dd` - delete (cut) a line
|
||||
- `2dd` - delete (cut) 2 lines
|
||||
- `dw` - delete (cut) the characters of the word from the cursor position to the start of the next word
|
||||
- `D` - delete (cut) to the end of the line
|
||||
- `d$` - delete (cut) to the end of the line
|
||||
- `x` - delete (cut) character
|
||||
|
||||
## Search and replace
|
||||
|
||||
- `/pattern` - search for pattern
|
||||
- `?pattern` - search backward for pattern
|
||||
- `\vpattern` - 'very magic' pattern: non-alphanumeric characters are interpreted as special regex symbols (no escaping needed)
|
||||
- `n - repeat` search in same direction
|
||||
- `N - repeat` search in opposite direction
|
||||
- `:%s/old/new/g`- replace all old with new throughout file
|
||||
- `:%s/old/new/gc` - replace all old with new throughout file with confirmations
|
||||
- `:noh` - remove highlighting of search matches
|
||||
|
||||
## Search in multiple files
|
||||
|
||||
- `:vimgrep /pattern/ {`{file}`}` - search for pattern in multiple files
|
||||
```
|
||||
e.g. :vimgrep /foo/ **/*
|
||||
```
|
||||
- `:cn` - jump to the next match
|
||||
- `:cp` - jump to the previous match
|
||||
- `:copen` - open a window containing the list of matches
|
||||
|
||||
## Marking text (visual mode)
|
||||
|
||||
- `v`- start visual mode, mark lines, then do a command (like y-yank)
|
||||
- `V` - start linewise visual mode
|
||||
- `o` - move to other end of marked area
|
||||
- `Ctrl + v` - start visual block mode
|
||||
- `O` - move to other corner of block
|
||||
- `aw` - mark a word
|
||||
- `ab` - a block with ()
|
||||
- `aB` - a block with {}
|
||||
- `ib` - inner block with ()
|
||||
- `iB` - inner block with {}
|
||||
- `Esc` - exit visual mode
|
||||
|
||||
## Visual commands
|
||||
|
||||
- `>` - shift text right
|
||||
- `<` - shift text left
|
||||
- `y` - yank (copy) marked text
|
||||
- `d` - delete marked text
|
||||
- `~` - switch case
|
||||
|
||||
## Registers
|
||||
|
||||
- `:reg` - show registers content
|
||||
- `"xy` - yank into register x
|
||||
- `"xp` - paste contents of register x
|
||||
|
||||
Tip Registers are being stored in ~/.viminfo, and will be loaded again on next restart of vim.
|
||||
Tip Register 0 contains always the value of the last yank command.
|
||||
|
||||
## Marks
|
||||
|
||||
- `:marks` - list of marks
|
||||
- `ma` - set current position for mark A
|
||||
- `a` - jump to position of mark A
|
||||
- `` y`a `` - yank text to position of mark A
|
||||
|
||||
## Macros
|
||||
|
||||
- `qa` - record macro a
|
||||
- `q` - stop recording macro
|
||||
- `@a` - run macro a
|
||||
- `@@` - rerun last run macro
|
||||
|
||||
## Working with multiple files
|
||||
|
||||
- `:e` file - edit a file in a new buffer
|
||||
- `:bnext or :bn` - go to the next buffer
|
||||
- `:bprev or :bp` - go to the previous buffer
|
||||
- `:bd` - delete a buffer (close a file)
|
||||
- `:ls` - list all open buffers
|
||||
- `:sp file` - open a file in a new buffer and split window
|
||||
- `:vsp file` - open a file in a new buffer and vertically split window
|
||||
- `Ctrl + ws` - split window
|
||||
- `Ctrl + ww` - switch windows
|
||||
- `Ctrl + wq` - quit a window
|
||||
- `Ctrl + wv` - split window vertically
|
||||
- `Ctrl + wh` - move cursor to the left window (vertical split)
|
||||
- `Ctrl + wl` - move cursor to the right window (vertical split)
|
||||
- `Ctrl + wj` - move cursor to the window below (horizontal split)
|
||||
- `Ctrl + wk` - move cursor to the window above (horizontal split)
|
||||
|
||||
## Tabs
|
||||
|
||||
- `:tabnew or :tabnew {page.words.file}` - open a file in a new tab
|
||||
- `Ctrl + wT` - move the current split window into its own tab
|
||||
- `gt or :tabnext or :tabn` - move to the next tab
|
||||
- `gT or :tabprev or :tabp` - move to the previous tab
|
||||
- `#gt` - move to tab number #
|
||||
- `:tabmove #` - move current tab to the #th position (indexed from 0)
|
||||
- `:tabclose or :tabc` - close the current tab and all its windows
|
||||
- `:tabonly or :tabo` - close all tabs except for the current one
|
||||
- `:tabdo command` - run the command on all tabs (e.g. :tabdo q - closes all opened tabs)
|
||||
|
||||
## Exiting
|
||||
|
||||
- `:w` - write (save) the file, but don't exit
|
||||
- `:w !sudo tee %` - write out the current file using sudo
|
||||
- `:wq` or :x or ZZ - write (save) and quit
|
||||
- `:q` - quit (fails if there are unsaved changes)
|
||||
- `:q!` or ZQ - quit and throw away unsaved changes
|
||||
- `:wqa` - write (save) and quit on all tabs
|
|
@ -0,0 +1,27 @@
|
|||
+++
|
||||
title = "Workstation Setup Using Ansible"
|
||||
description = "Configure your fedora machine in just one go."
|
||||
author = "Ratan Kulshreshtha"
|
||||
date = 2018-09-12T11:24:57+05:30
|
||||
[taxonomies]
|
||||
categories = ["Blog"]
|
||||
tags = ["ansible", "workstation", "fedora"]
|
||||
+++
|
||||
|
||||
|
||||
I use Fedora on my Dell Vostro 3560, and I have a habit of reinstalling fedora whenever new version of Fedora is released thus I have to install many things in my machine and configure many things again and again and sometimes I forgot something to install or sometimes I forgot to configure something so I asked myself is there a way to do this in a way which is immune to human errors or how can I automate all this ?
|
||||
|
||||
<figure class="image center">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/24/Ansible_logo.svg/100px-Ansible_logo.svg.png" style="max-width: 128px">
|
||||
</figure>
|
||||
|
||||
|
||||
<!-- more -->
|
||||
|
||||
Suddenly I thought why not use *Ansible* to do my workstation setup which is an extremely popular open-source configuration management and software automation project. And Ansible’s idempotent, declarative syntax lends itself perfectly to describing how a system should be configured.
|
||||
|
||||
So I have written a playbook to configure your fedora workstation and this resides at [RatanShreshtha/Workstation-Setup](https://github.com/RatanShreshtha/Workstation-Setup) this playbook will install basic media software to necessary development dependencies to cool wallpapers.
|
||||
|
||||
I hope you will find this playbook useful and feel free to make some changes like also making it compatible with debian/ubuntu.
|
||||
|
||||
I appreciate any feedback.
|
|
@ -0,0 +1,63 @@
|
|||
+++
|
||||
title = "YouTube Educational Channels"
|
||||
subtitle = "YouTube has many great channels that can teach anyone practically anything."
|
||||
author = "Ratan Kulshreshtha"
|
||||
date = 2017-12-07T01:20:42+05:30
|
||||
[taxonomies]
|
||||
categories = ["Blog"]
|
||||
tags = ["youtube", "infotainment"]
|
||||
+++
|
||||
|
||||
I think everyone is aware of what YouTube but you can also learn a lot on YouTube while having fun, thanks to really awesome infotainment YouTubers like Michael Stevens (Vsause), Destin Sandlin (Smarter Every Day), Henry Reich (MinutePhysics) and many more.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
So why not put them to better use on YouTube? therefore here is my list of top educational YouTube channels that you must subscribe because they are awesome and you will learn a lot.
|
||||
|
||||
- [**3Blue1Brown**](https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw/featured), by Grant Sanderson, is some combination of math and entertainment, depending on your disposition. The goal is for explanations to be driven by animations and for difficult problems to be made simple with changes in perspective.
|
||||
|
||||
- [**AsapSCIENCE**](https://www.youtube.com/user/AsapSCIENCE/featured), by Canadian YouTubers Mitchell Moffit and Gregory Brown. The channel produces weekly videos that touch on many different topics of science.
|
||||
|
||||
- [**BrainCraft**](https://www.youtube.com/channel/UCt_t6FwNsqr3WWoL6dFqG9w), by Vanessa Hill. Talking psychology, neuroscience and why we act the way we do.
|
||||
|
||||
- [**CGP Grey**](https://www.youtube.com/channel/UC2C_jShtL725hvbm1arSV9w), is an educational YouTuber and podcaster who posts on YouTube under the channel CGP Grey.
|
||||
|
||||
- [**Computerphile**](https://www.youtube.com/channel/UC9-y-6csu5WGm29I7JiwpnA), by Brady John Haran, this channel has videos all about computers and computer stuff.
|
||||
|
||||
- [**CrashCourse**](https://www.youtube.com/channel/UCX6b17PVsYBQ0ip5gyeme-Q), is an educational YouTube channel started by the Green brothers, Hank Green and John Green, who are notable for their **VlogBrothers** channel. Originally, John and Hank presented humanities and science courses to viewers, respectively, although the series has since expanded to incorporate courses by additional hosts.
|
||||
|
||||
- [**engineerguy**](https://www.youtube.com/user/engineerguyvideo/featured), by Bill Hammack where he explores the world of engineering.
|
||||
|
||||
- [**Gross Science**](https://www.youtube.com/user/grossscienceshow/featured), by Anna Rothschild where she explores bizarre stories from the slimy, smelly, creepy world of science.
|
||||
|
||||
- [**It's Okay To Be Smart**](https://www.youtube.com/channel/UCH4BNI0-FOK2dMXoFtViWHw), by Joe Hanson, Ph.D. is a curious group of atoms in a curious universe, and he's here to tell you how it all works.
|
||||
|
||||
- [**Kurzgesagt – In a Nutshell**](https://www.youtube.com/user/Kurzgesagt/featured), is a Munich-based YouTube channel and design studio. The YouTube channel focuses on producing animated educational content. Founded by Philipp Dettmer.
|
||||
|
||||
- [**minutephysics**](https://www.youtube.com/channel/UCUHW94eEFW7hkUMVaZz4eDg), is an educational YouTube channel created by Henry Reich. The channel's videos include time-lapsed drawing to explain physics-related topics in approximately one minute.
|
||||
|
||||
- [**Numberphile**](https://www.youtube.com/channel/UCoxcjq-8xIDTYp3uz647V5A), by Brady John Haran, this channel has videos all about numbers, puzzles, riddles and mathematics.
|
||||
|
||||
- [**Periodic Videos**](https://www.youtube.com/channel/UCtESv1e7ntJaLJYKIO1FoYw), another YouTube channel by Brady John Haran, this is ultimate channel for all things chemistry. A video about each element on the periodic table. And we upload new videos every week about science news, interesting molecules and other stuff from the world of chemistry.
|
||||
|
||||
- [**Physics Girl**](https://www.youtube.com/channel/UC7DdEm33SyaTDtWYGO2CwdA), by Dianna Cowern. This channel has physics videos for every atom and eve.
|
||||
|
||||
- [**Practical Engineering**](https://www.youtube.com/channel/UCMOqf8ab-42UUQIdVoKwjlQ), by Grady Hillhouse. This channel looks at practically any part of anything man made around you and think, Some engineer was frustrated while designing this. It's a little human connection.
|
||||
|
||||
- [**SciShow**](https://www.youtube.com/channel/UCZYTClx2T1of7BRZ86-8fow) explores the unexpected. Seven days a week, Hank Green, Michael Aranda, and Olivia Gordon delve into the scientific subjects that defy our expectations and make us even more curious!
|
||||
|
||||
- [**Sixty Symbols**](https://www.youtube.com/user/sixtysymbols/) - Cool videos about physics and astronomy.
|
||||
|
||||
- [**SmarterEveryDay**](https://www.youtube.com/channel/UC6107grRI4m0o2-emgoDnAA), by Destin Sandlin. This channel explore the world using science. That's pretty much all there is to it.
|
||||
|
||||
- [**standupmaths**](https://www.youtube.com/channel/UCSju5G2aFaWMqn-_0YBtq5A), by Matt Parker. If you love maths and stand-up or any one of them then you must subscribe to standupmaths.
|
||||
|
||||
- [**Tom Scott**](https://www.youtube.com/user/enyay/about) is a British entertainer, educator, YouTuber, web developer and former presenter of Gadget Geeks on Sky One.
|
||||
|
||||
- [**Veritasium**](https://www.youtube.com/channel/UCHnyfMqiRRG1u-2MsSQLbXA) is an English-language educational science channel on YouTube created by Derek Muller.
|
||||
|
||||
- [**Vintage Space**](https://www.youtube.com/channel/UCw95T_TgbGHhTml4xZ9yIqg/featured), by Amy Shira Teitel! With Vintage Space you'll get weekly videos about space-flight history, things that I'm curious about, things you guys are curious about, and things no one knew they wanted to know about!
|
||||
|
||||
- [**Vsauce**](https://www.youtube.com/channel/UC6nSFpj9HTCZ5t-N3Rm3-HA) is a YouTube channel brand created by internet personality Michael Stevens. The channels feature videos relating to various scientific, psychological, mathematical, and philosophical topics, as well as gaming, technology, culture, and other topics of general interest.
|
||||
|
||||
And if you think there are more YouTube channels that everyone should follow then please tell them about in comment section below.
|
|
@ -0,0 +1,9 @@
|
|||
[build]
|
||||
publish = "public"
|
||||
command = "zola build"
|
||||
|
||||
[build.environment]
|
||||
ZOLA_VERSION = "0.11.0"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "zola build --base-url $DEPLOY_PRIME_URL"
|
|
@ -0,0 +1 @@
|
|||
@import "https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;515;600;700&display=swap";body{font:100% "Fira Code",monospace;display:flex;flex-direction:column;min-height:100vh}main{flex:1}.center{display:flex;justify-content:center;align-items:center}.link{color:#363636}.link:hover{color:#2d96bd}.read-more{color:#2d96bd}.read-more:hover{color:#ef3982}
|
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 154 KiB |
After Width: | Height: | Size: 36 KiB |
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#da532c</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 20 KiB |
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="450.000000pt" height="450.000000pt" viewBox="0 0 450.000000 450.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.11, written by Peter Selinger 2001-2013
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,450.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M750 2250 l0 -2250 1500 0 1500 0 0 2250 0 2250 -1500 0 -1500 0 0
|
||||
-2250z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 605 B |
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "",
|
||||
"short_name": "",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-384x384.png",
|
||||
"sizes": "384x384",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
After Width: | Height: | Size: 90 KiB |
|
@ -0,0 +1,212 @@
|
|||
function debounce(func, wait) {
|
||||
var timeout;
|
||||
|
||||
return function () {
|
||||
var context = this;
|
||||
var args = arguments;
|
||||
clearTimeout(timeout);
|
||||
|
||||
timeout = setTimeout(function () {
|
||||
timeout = null;
|
||||
func.apply(context, args);
|
||||
}, wait);
|
||||
};
|
||||
}
|
||||
|
||||
function makeTeaser(body, terms) {
|
||||
var TERM_WEIGHT = 40;
|
||||
var NORMAL_WORD_WEIGHT = 2;
|
||||
var FIRST_WORD_WEIGHT = 8;
|
||||
var TEASER_MAX_WORDS = 10;
|
||||
|
||||
var stemmedTerms = terms.map(function (w) {
|
||||
return elasticlunr.stemmer(w.toLowerCase());
|
||||
});
|
||||
var termFound = false;
|
||||
var index = 0;
|
||||
var weighted = []; // contains elements of ["word", weight, index_in_document]
|
||||
|
||||
// split in sentences, then words
|
||||
var sentences = body.toLowerCase().split(". ");
|
||||
|
||||
for (var i in sentences) {
|
||||
var words = sentences[i].split(" ");
|
||||
var value = FIRST_WORD_WEIGHT;
|
||||
|
||||
for (var j in words) {
|
||||
var word = words[j];
|
||||
|
||||
if (word.length > 0) {
|
||||
for (var k in stemmedTerms) {
|
||||
if (elasticlunr.stemmer(word).startsWith(stemmedTerms[k])) {
|
||||
value = TERM_WEIGHT;
|
||||
termFound = true;
|
||||
}
|
||||
}
|
||||
weighted.push([word, value, index]);
|
||||
value = NORMAL_WORD_WEIGHT;
|
||||
}
|
||||
|
||||
index += word.length;
|
||||
index += 1; // ' ' or '.' if last word in sentence
|
||||
}
|
||||
|
||||
index += 1; // because we split at a two-char boundary '. '
|
||||
}
|
||||
|
||||
if (weighted.length === 0) {
|
||||
return body;
|
||||
}
|
||||
|
||||
var windowWeights = [];
|
||||
var windowSize = Math.min(weighted.length, TEASER_MAX_WORDS);
|
||||
// We add a window with all the weights first
|
||||
var curSum = 0;
|
||||
for (var i = 0; i < windowSize; i++) {
|
||||
curSum += weighted[i][1];
|
||||
}
|
||||
windowWeights.push(curSum);
|
||||
|
||||
for (var i = 0; i < weighted.length - windowSize; i++) {
|
||||
curSum -= weighted[i][1];
|
||||
curSum += weighted[i + windowSize][1];
|
||||
windowWeights.push(curSum);
|
||||
}
|
||||
|
||||
// If we didn't find the term, just pick the first window
|
||||
var maxSumIndex = 0;
|
||||
if (termFound) {
|
||||
var maxFound = 0;
|
||||
// backwards
|
||||
for (var i = windowWeights.length - 1; i >= 0; i--) {
|
||||
if (windowWeights[i] > maxFound) {
|
||||
maxFound = windowWeights[i];
|
||||
maxSumIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var teaser = [];
|
||||
var startIndex = weighted[maxSumIndex][2];
|
||||
for (var i = maxSumIndex; i < maxSumIndex + windowSize; i++) {
|
||||
var word = weighted[i];
|
||||
if (startIndex < word[2]) {
|
||||
// missing text from index to start of `word`
|
||||
teaser.push(body.substring(startIndex, word[2]));
|
||||
startIndex = word[2];
|
||||
}
|
||||
|
||||
// add <em/> around search terms
|
||||
if (word[1] === TERM_WEIGHT) {
|
||||
teaser.push("<b>");
|
||||
}
|
||||
startIndex = word[2] + word[0].length;
|
||||
teaser.push(body.substring(word[2], startIndex));
|
||||
|
||||
if (word[1] === TERM_WEIGHT) {
|
||||
teaser.push("</b>");
|
||||
}
|
||||
}
|
||||
teaser.push("…");
|
||||
return teaser.join("");
|
||||
}
|
||||
|
||||
function formatSearchResultItem(item, terms) {
|
||||
return (
|
||||
`<article class="box">` +
|
||||
`<h1 class="title is-4">` +
|
||||
`<a class="link" class="link" href="${item.ref}">${item.doc.title}</a>` +
|
||||
`</h1>` +
|
||||
`<div class="content mt-2">` +
|
||||
`${makeTeaser(item.doc.body, terms)}` +
|
||||
`<a class="read-more" href="${item.ref}">` +
|
||||
`Read More` +
|
||||
`</a>` +
|
||||
`</div>` +
|
||||
`</article>`
|
||||
);
|
||||
}
|
||||
|
||||
function initSearch() {
|
||||
var $searchInput = document.getElementById("search");
|
||||
var $searchResults = document.querySelector(".search-results");
|
||||
var $searchResultsItems = document.querySelector(".search-results__items");
|
||||
var MAX_ITEMS = 10;
|
||||
|
||||
var options = {
|
||||
bool: "AND",
|
||||
fields: {
|
||||
title: { boost: 2 },
|
||||
body: { boost: 1 },
|
||||
},
|
||||
};
|
||||
var currentTerm = "";
|
||||
var index = elasticlunr.Index.load(window.searchIndex);
|
||||
|
||||
$searchInput.addEventListener(
|
||||
"keyup",
|
||||
debounce(function () {
|
||||
var term = $searchInput.value.trim();
|
||||
if (term === currentTerm || !index) {
|
||||
return;
|
||||
}
|
||||
$searchResults.style.display = term === "" ? "none" : "block";
|
||||
$searchResultsItems.innerHTML = "";
|
||||
if (term === "") {
|
||||
return;
|
||||
}
|
||||
|
||||
var results = index.search(term, options);
|
||||
if (results.length === 0) {
|
||||
$searchResults.style.display = "none";
|
||||
return;
|
||||
}
|
||||
|
||||
currentTerm = term;
|
||||
for (var i = 0; i < Math.min(results.length, MAX_ITEMS); i++) {
|
||||
var item = document.createElement("div");
|
||||
item.classList.add("navbar-item");
|
||||
item.innerHTML = formatSearchResultItem(results[i], term.split(" "));
|
||||
$searchResultsItems.appendChild(item);
|
||||
var item = document.createElement("hr");
|
||||
item.classList.add("navbar-divider");
|
||||
$searchResultsItems.appendChild(item);
|
||||
}
|
||||
}, 150)
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
document.readyState === "complete" ||
|
||||
(document.readyState !== "loading" && !document.documentElement.doScroll)
|
||||
) {
|
||||
initSearch();
|
||||
} else {
|
||||
document.addEventListener("DOMContentLoaded", initSearch);
|
||||
}
|
||||
|
||||
document
|
||||
.querySelector("#search-dialog")
|
||||
.addEventListener("click", function (event) {
|
||||
event.preventDefault();
|
||||
var modal = document.querySelector(".modal"); // assuming you have only 1
|
||||
var html = document.querySelector("html");
|
||||
modal.classList.add("is-active");
|
||||
html.classList.add("is-clipped");
|
||||
document.getElementById("search").focus();
|
||||
document.getElementById("search").select();
|
||||
|
||||
modal
|
||||
.querySelector(".modal-background")
|
||||
.addEventListener("click", function (e) {
|
||||
e.preventDefault();
|
||||
modal.classList.remove("is-active");
|
||||
html.classList.remove("is-clipped");
|
||||
});
|
||||
|
||||
document.querySelector(".delete").addEventListener("click", function (e) {
|
||||
e.preventDefault();
|
||||
modal.classList.remove("is-active");
|
||||
html.classList.remove("is-clipped");
|
||||
});
|
||||
});
|
|
@ -0,0 +1,35 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block main %}
|
||||
<main class="hero">
|
||||
<div class="hero-body">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column is-three-fifths is-offset-one-fifth">
|
||||
<figure class="image center mb-2">
|
||||
<img class="is-rounded card" src="{{config.extra.author.avatar}}" style="max-width: 150px">
|
||||
</figure>
|
||||
<div class="has-text-centered">
|
||||
<h1 class="title">
|
||||
HTTP 404
|
||||
</h1>
|
||||
<h2 class="subtitle">
|
||||
It seems you are looking for something that I don't have.
|
||||
</h2>
|
||||
<p class="is-size-4">
|
||||
{{ macros:: social_links( social_config=config.extra.social) }}
|
||||
</p>
|
||||
</div>
|
||||
<hr />
|
||||
<p class="has-text-centered">
|
||||
<a class="link" href="{{ config.base_url }}">
|
||||
Home
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
|
@ -0,0 +1,143 @@
|
|||
{% import "macros.html" as macros %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<link rel="manifest" href="{{config.extra.favicon.webmanifest}}">
|
||||
<link rel="mask-icon" href="{{config.extra.favicon.safari_pinned_tab}}" color="#5bbad5" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{config.extra.favicon.favicon_16x16}}" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{config.extra.favicon.favicon_32x32}}" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{config.extra.favicon.apple_touch_icon}}" />
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.0/css/bulma.min.css" />
|
||||
<link rel="stylesheet" href="{{ get_url(path="css/style.min.css") }}" />
|
||||
|
||||
<title>{% block title %}{{ config.title }}{% endblock title %}</title>
|
||||
|
||||
{{ macros::google_analytics(gtag=config.extra.analytics.google) }}
|
||||
</head>
|
||||
|
||||
<body class="site">
|
||||
{% block nav %}
|
||||
<nav class="navbar is-light" role="navigation" aria-label="main navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item has-text-weight-bold" href="/">{{ config.title }}</a>
|
||||
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
|
||||
data-target="navMenu">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="navMenu" class="navbar-menu">
|
||||
<div class="navbar-end">
|
||||
{% for item in config.extra.navbar_items %}
|
||||
<a href="{{ item.url | replace(from="$BASE_URL", to=config.base_url) }}" class="navbar-item">
|
||||
{{ item.name }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
<div class="navbar-item">
|
||||
<div class="field has-addons">
|
||||
<div class="control">
|
||||
<input id="search-dialog" class="input is-small" type="search" placeholder="Search">
|
||||
</div>
|
||||
<div class="control">
|
||||
<a class="button is-small">
|
||||
<span class="icon"><i class="fas fa-search"></i></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
{% endblock %}
|
||||
|
||||
<div class="modal">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Search</p>
|
||||
<button class="delete" aria-label="close"></button>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
|
||||
<div class="field">
|
||||
<p class="control has-icons-right">
|
||||
<input id="search" class="input" type="search" placeholder="🔎 Search the website">
|
||||
<span class="icon is-small is-right">
|
||||
<i class="fas fa-search"></i>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="search-results__items">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block header %}
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
<footer class="footer py-4">
|
||||
<div class="has-text-centered">
|
||||
<p>
|
||||
Built with <span class="icon"><i class="fas fa-code"></i></span> code and <span class="icon">
|
||||
<i class="fas fa-heart"></i></span> love
|
||||
<br />
|
||||
<span class="has-text-weight-bold">
|
||||
Powered By <span class="icon"><i class="fas fa-power-off"></i></span> Zola
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
{% endblock %}
|
||||
|
||||
<script src="https://kit.fontawesome.com/201b8d5e05.js" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" src="{{ get_url(path="elasticlunr.min.js") }}"></script>
|
||||
<script type="text/javascript" src="{{ get_url(path="search_index.en.js") }}"></script>
|
||||
<script type="text/javascript" src="{{ get_url(path="js/search.js") }}"></script>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
// Get all "navbar-burger" elements
|
||||
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
|
||||
|
||||
// Check if there are any navbar burgers
|
||||
if ($navbarBurgers.length > 0) {
|
||||
|
||||
// Add a click event on each of them
|
||||
$navbarBurgers.forEach(el => {
|
||||
el.addEventListener('click', () => {
|
||||
|
||||
// Get the target from the "data-target" attribute
|
||||
const target = el.dataset.target;
|
||||
const $target = document.getElementById(target);
|
||||
|
||||
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
|
||||
el.classList.toggle('is-active');
|
||||
$target.classList.toggle('is-active');
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block header %}
|
||||
<header class="hero">
|
||||
<div class="hero-body">
|
||||
<div class="container has-text-centered">
|
||||
<h1 class="title">
|
||||
<span class="icon"><i class="fas fa-folder"></i><i class="fas fa-folder" style="position: relative;left: -15px;top: 7px;"></i></span>
|
||||
Categories
|
||||
</h1>
|
||||
<h2 class="subtitle">
|
||||
{{ terms | length }} categories in total
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<main class="section pt-0">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column is-10 is-offset-1 has-text-justified">
|
||||
{% for category in terms %}
|
||||
<span class="my-3 mx-2" style="display: inline-block;">
|
||||
<a class="link" href="{{ get_taxonomy_url(kind="categories", name=category.name) }}">
|
||||
<span class="icon"><i class="fas fa-folder"></i></span>{{ category.name }}<sup>{{ category.pages | length }}</sup>
|
||||
</a>
|
||||
</span>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock main %}
|
|
@ -0,0 +1,64 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block header %}
|
||||
<header class="hero">
|
||||
<div class="hero-body">
|
||||
<div class="container">
|
||||
<h1 class="title has-text-centered">
|
||||
<span class="icon"><i class="fas fa-folder"></i></span> {{ term.name }}
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<main class="section pt-0">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column is-6 is-offset-3">
|
||||
{% if paginator %}
|
||||
{% set pages = paginator.pages %}
|
||||
{% else %}
|
||||
{% set pages = term.pages %}
|
||||
{% endif %}
|
||||
{% for page in pages %}
|
||||
<article>
|
||||
<h1 class="title is-4">
|
||||
<a class="link" href="{{ page.permalink }}">
|
||||
{{ page.title }}
|
||||
</a>
|
||||
</h1>
|
||||
|
||||
<p>{{ macros::page_publish_metadata(page=page) }}</p>
|
||||
|
||||
<a class="read-more" href="{{ page.permalink }}">
|
||||
Read More
|
||||
</a>
|
||||
</article>
|
||||
{% if not loop.last %}
|
||||
<hr />{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% if paginator.previous or paginator.next %}
|
||||
<nav class="level">
|
||||
{% if paginator.previous %}
|
||||
<div class="level-item has-text-centered">
|
||||
<a href="{{ paginator.previous }}" class="button is-black is-outlined">
|
||||
<span class="icon mr-2"><i class="fas fa-arrow-circle-left"></i></span> Previous Page
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if paginator.next %}
|
||||
<div class="level-item has-text-centered">
|
||||
<a href="{{ paginator.next }}" class="button is-black is-outlined">
|
||||
Next Page <span class="icon ml-2"><i class="fas fa-arrow-circle-right"></i></span>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
</div>
|
||||
</main>
|
||||
{% endblock main %}
|
|
@ -0,0 +1,29 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block main %}
|
||||
<main class="hero">
|
||||
<div class="hero-body">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column is-three-fifths is-offset-one-fifth">
|
||||
<figure class="image center mb-2">
|
||||
<img class="is-rounded card" src="{{config.extra.author.avatar}}" style="max-width: 150px">
|
||||
</figure>
|
||||
<div class="has-text-centered">
|
||||
<h1 class="title is-size-4">{{ section.title }}</h1>
|
||||
<h2 class="subtitle">{{ section.description }}</h2>
|
||||
<p class="is-size-4">
|
||||
{{ macros:: social_links( social_config=config.extra.social) }}
|
||||
</p>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="content has-text-justified">
|
||||
{{section.content | safe}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
|
@ -0,0 +1,89 @@
|
|||
{% macro social_links(social_config) %}
|
||||
{% if social_config.facebook %}
|
||||
<a class="link" href="https://facebook.com/{{social_config.facebook}}" target="_blank">
|
||||
<i class="fab fa-facebook"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if social_config.twitter %}
|
||||
<a class="link" href="https://twitter.com/{{social_config.twitter}}" target="_blank">
|
||||
<i class="fab fa-twitter"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if social_config.linkedin %}
|
||||
<a class="link" href="https://www.linkedin.com/in/{{social_config.linkedin}}" target="_blank"><i
|
||||
class="fab fa-linkedin"></i></i></a>
|
||||
{% endif %}
|
||||
{% if social_config.github %}
|
||||
<a class="link" href="https://github.com/{{social_config.github}}" target="_blank"><i class="fab fa-github"></i></a>
|
||||
{% endif %}
|
||||
{% if social_config.stackoverflow %}
|
||||
<a class="link" href="https://stackoverflow.com/users/{{social_config.stackoverflow}}" target="_blank"><i
|
||||
class="fab fa-stack-overflow"></i></i></a>
|
||||
{% endif %}
|
||||
{% if social_config.keybase %}
|
||||
<a class="link" href="https://keybase.io/{{social_config.keybase}}" target="_blank"><i class="fab fa-keybase"></i></a>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro page_publish_metadata(page) %}
|
||||
<p class="has-text-grey">
|
||||
<i class="fas fa-user"></i>
|
||||
{{ config.extra.author.name }}
|
||||
published on
|
||||
<i class="far fa-calendar-alt"></i>
|
||||
<time datetime="{{page.date}}">{{ page.date | date(format="%B %d, %Y") }}</time>
|
||||
</p>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro page_content_metadata(page) %}
|
||||
<p class="has-text-grey">
|
||||
<i class="far fa-clock"></i>
|
||||
{{page.reading_time}} min,
|
||||
<i class="fas fa-pencil-alt"></i>
|
||||
{{page.word_count}} words
|
||||
</p>
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro render_categories(categories) %}
|
||||
Categories:
|
||||
{% for category in categories %}
|
||||
<a class="link" href="{{ get_taxonomy_url(kind="categories", name=category) }}">
|
||||
<span class="icon"><i class="fas fa-folder"></i></span>{{ category }}{% if not loop.last %},{% endif %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro render_tags(tags) %}
|
||||
Tags:
|
||||
{% for tag in tags %}
|
||||
<a class="link" href="{{ get_taxonomy_url(kind="tags", name=tag) }}">
|
||||
<span class="icon"><i class="fas fa-tag"></i></span>{{ tag }}{% if not loop.last %},{% endif %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro google_analytics(gtag) %}
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ gtag }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() { dataLayer.push(arguments); }
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '{{ gtag }}');
|
||||
</script>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro hyvor_talk(id) %}
|
||||
<div id="hyvor-talk-view"></div>
|
||||
<script type="text/javascript">
|
||||
var HYVOR_TALK_WEBSITE = {{ id }}; // DO NOT CHANGE THIS
|
||||
var HYVOR_TALK_CONFIG = {
|
||||
url: window.location.href,
|
||||
id: window.btoa(encodeURIComponent(escape(window.location.href)))
|
||||
};
|
||||
</script>
|
||||
<script async type="text/javascript" src="//talk.hyvor.com/web-api/embed"></script>
|
||||
{% endmacro %}
|
|
@ -0,0 +1,102 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block header %}
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<main class="section">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column is-three-fifths is-offset-one-fifth">
|
||||
<article>
|
||||
<h1 class="title">{{ page.title }}</h1>
|
||||
<h2 class="subtitle">{{ page.description }}</h2>
|
||||
|
||||
<p>{{ macros::page_content_metadata(page=page) }}</p>
|
||||
<p>{{ macros::page_publish_metadata(page=page) }}</p>
|
||||
|
||||
{% if page.taxonomies.categories %}
|
||||
<p>{{ macros::render_categories(categories=page.taxonomies.categories) }}</p>
|
||||
{% endif %}
|
||||
{% if page.taxonomies.tags %}
|
||||
<p>{{ macros::render_tags(tags=page.taxonomies.tags) }}</p>
|
||||
{% endif %}
|
||||
|
||||
{% if page.extra.toc %}
|
||||
<hr />
|
||||
<div class="content">
|
||||
<p class="has-text-weight-bold">Table of Contents</p>
|
||||
<ul>
|
||||
{% for h1 in page.toc %}
|
||||
<li>
|
||||
<a href="{{h1.permalink | safe}}">{{ h1.title }}</a>
|
||||
{% if h1.children %}
|
||||
<ul>
|
||||
{% for h2 in h1.children %}
|
||||
<li>
|
||||
<a href="{{h2.permalink | safe}}">{{ h2.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
<hr />
|
||||
|
||||
<div class="content has-text-justified">
|
||||
{{ page.content | safe }}
|
||||
</div>
|
||||
</article>
|
||||
<hr />
|
||||
{% if page.earlier or page.later or page.lighter or page.heavier %}
|
||||
<nav class="level mt-2">
|
||||
{% if page.later %}
|
||||
<div class="level-item has-text-centered">
|
||||
<a href="{{ page.later.permalink }}" class="button is-black is-outlined">
|
||||
<span class="icon mr-2"><i
|
||||
class="fas fa-arrow-circle-left"></i></span>{{ page.later.title }}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if page.earlier %}
|
||||
<div class="level-item has-text-centered">
|
||||
<a href="{{ page.earlier.permalink }}" class="button is-black is-outlined">
|
||||
{{ page.earlier.title }}<span class="icon ml-2"><i
|
||||
class="fas fa-arrow-circle-right"></i></span>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if page.heavier %}
|
||||
<div class="level-item has-text-centered">
|
||||
<a href="{{ page.heavier.permalink }}" class="button is-black is-outlined">
|
||||
<span class="icon mr-2"><i
|
||||
class="fas fa-arrow-circle-left"></i></span>{{ page.heavier.title }}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if page.lighter %}
|
||||
<div class="level-item has-text-centered">
|
||||
<a href="{{ page.lighter.permalink }}" class="button is-black is-outlined">
|
||||
{{ page.lighter.title }}<span class="icon ml-2"><i
|
||||
class="fas fa-arrow-circle-right"></i></span>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
</nav>
|
||||
{% endif %}
|
||||
{% if page.extra.comments and config.extra.commenting.hyvor %}
|
||||
<hr />
|
||||
{{ macros::hyvor_talk(id=config.extra.commenting.hyvor) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock main %}
|
|
@ -0,0 +1,2 @@
|
|||
User-agent: *
|
||||
Sitemap: {{config.base_url}}/sitemap.xml
|
|
@ -0,0 +1,72 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block header %}
|
||||
<header class="hero">
|
||||
<div class="hero-body">
|
||||
<div class="container">
|
||||
<div class="has-text-centered">
|
||||
<h1 class="title">{{ section.title }}</h1>
|
||||
<h2 class="subtitle">{{ section.description }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<main class="section pt-0">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column is-8 is-offset-2">
|
||||
{% if paginator %}
|
||||
{% set pages = paginator.pages %}
|
||||
{% else %}
|
||||
{% set pages = section.pages %}
|
||||
{% endif %}
|
||||
{% for page in pages %}
|
||||
<article class="box">
|
||||
<h1 class="title is-4">
|
||||
<a class="link" class="link" href="{{ page.permalink }}">
|
||||
{{ page.title }}
|
||||
</a>
|
||||
</h1>
|
||||
<h2 class="subtitle is-6">{{ page.description }}</h2>
|
||||
<p>{{ macros::page_publish_metadata(page=page) }}</p>
|
||||
<div class="content mt-2">
|
||||
{{ page.summary | safe }}
|
||||
<a class="read-more" href="{{ page.permalink }}">
|
||||
Read More
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% if page.taxonomies.categories %}
|
||||
<p>{{ macros::render_categories(categories=page.taxonomies.categories) }}</p>
|
||||
{% endif %}
|
||||
{% if page.taxonomies.tags %}
|
||||
<p>{{ macros::render_tags(tags=page.taxonomies.tags) }}</p>
|
||||
{% endif %}
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% if paginator.previous or paginator.next %}
|
||||
<nav class="level">
|
||||
{% if paginator.previous %}
|
||||
<div class="level-item has-text-centered">
|
||||
<a href="{{ paginator.previous }}" class="button is-black is-outlined">
|
||||
<span class="icon mr-2"><i class="fas fa-arrow-circle-left"></i></span> Previous Page
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if paginator.next %}
|
||||
<div class="level-item has-text-centered">
|
||||
<a href="{{ paginator.next }}" class="button is-black is-outlined">
|
||||
Next Page <span class="icon ml-2"><i class="fas fa-arrow-circle-right"></i></span>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
|
@ -0,0 +1,8 @@
|
|||
<canvas id="myChart" max-height="400px"></canvas>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3/dist/Chart.min.js"></script>
|
||||
<script>
|
||||
|
||||
var chartData = {{body | safe }};
|
||||
var ctx = document.getElementById('myChart').getContext('2d');
|
||||
var myChart = new Chart(ctx, chartData);
|
||||
</script>
|
|
@ -0,0 +1,22 @@
|
|||
<link href='https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css' rel='stylesheet' />
|
||||
<div id='map' class="center" style='height: 400px;'></div>
|
||||
<script src='https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js'></script>
|
||||
<script>
|
||||
mapboxgl.accessToken = '{{config.extra.mapbox.access_token}}';
|
||||
var map = new mapboxgl.Map({
|
||||
container: 'map',
|
||||
style: 'mapbox://styles/mapbox/streets-v11',
|
||||
center: [{{lng}}, {{lat}}],
|
||||
zoom: {{ zoom }}
|
||||
});
|
||||
|
||||
map.addControl(new mapboxgl.NavigationControl());
|
||||
|
||||
var marker = new mapboxgl.Marker()
|
||||
.setLngLat([{{lng}}, {{lat}}])
|
||||
.addTo(map);
|
||||
|
||||
// var marker = new mapboxgl.Marker()
|
||||
// .setLngLat([{{ lng }}, { { lat } }])
|
||||
// .addTo(map);
|
||||
</script>
|
|
@ -0,0 +1,5 @@
|
|||
<div class="mermaid center">
|
||||
{{body}}
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
||||
<script>mermaid.initialize({ startOnLoad: true });</script>
|
|
@ -0,0 +1,6 @@
|
|||
<blockquote>
|
||||
{{body}}<br />
|
||||
{% if author %}
|
||||
-- {{ author }}
|
||||
{% endif %}
|
||||
</blockquote>
|
|
@ -0,0 +1,34 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block header %}
|
||||
<header class="hero">
|
||||
<div class="hero-body">
|
||||
<div class="container has-text-centered">
|
||||
<h1 class="title">
|
||||
<span class="icon"><i class="fas fa-tags"></i></span> Tags
|
||||
</h1>
|
||||
<h2 class="subtitle">
|
||||
{{ terms | length }} tags in total
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<main class="section pt-0">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column is-10 is-offset-1 has-text-justified">
|
||||
{% for tag in terms %}
|
||||
<span class="my-3 mx-2" style="display: inline-block;">
|
||||
<a class="link" href="{{ get_taxonomy_url(kind="tags", name=tag.name) }}">
|
||||
<span class="icon"><i class="fas fa-tag"></i></span>{{ tag.name }}<sup>{{ tag.pages | length }}</sup>
|
||||
</a>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock main %}
|
|
@ -0,0 +1,64 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block header %}
|
||||
<header class="hero">
|
||||
<div class="hero-body">
|
||||
<div class="container">
|
||||
<h1 class="title has-text-centered">
|
||||
<span class="icon"><i class="fas fa-tag"></i></span> {{ term.name }}
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<main class="section pt-0">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column is-6 is-offset-3">
|
||||
{% if paginator %}
|
||||
{% set pages = paginator.pages %}
|
||||
{% else %}
|
||||
{% set pages = term.pages %}
|
||||
{% endif %}
|
||||
{% for page in pages %}
|
||||
<article>
|
||||
<h1 class="title is-4">
|
||||
<a class="link" href="{{ page.permalink }}">
|
||||
{{ page.title }}
|
||||
</a>
|
||||
</h1>
|
||||
|
||||
<p>{{ macros::page_publish_metadata(page=page) }}</p>
|
||||
|
||||
<a class="read-more" href="{{ page.permalink }}">
|
||||
Read More
|
||||
</a>
|
||||
</article>
|
||||
{% if not loop.last %}
|
||||
<hr />{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% if paginator.previous or paginator.next %}
|
||||
<nav class="level">
|
||||
{% if paginator.previous %}
|
||||
<div class="level-item has-text-centered">
|
||||
<a href="{{ paginator.previous }}" class="button is-black is-outlined">
|
||||
<span class="icon mr-2"><i class="fas fa-arrow-circle-left"></i></span> Previous Page
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if paginator.next %}
|
||||
<div class="level-item has-text-centered">
|
||||
<a href="{{ paginator.next }}" class="button is-black is-outlined">
|
||||
Next Page <span class="icon ml-2"><i class="fas fa-arrow-circle-right"></i></span>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
</div>
|
||||
</main>
|
||||
{% endblock main %}
|
|
@ -0,0 +1,19 @@
|
|||
name = "deep-thought"
|
||||
description = "A simple blog theme focused on writing powered by Bulma and Zola."
|
||||
license = "MIT"
|
||||
homepage = "https://github.com/RatanShreshtha/deep-thought"
|
||||
# The minimum version of Zola required
|
||||
min_version = "0.9.0"
|
||||
# An optional live demo URL
|
||||
demo = ""
|
||||
|
||||
# Any variable there can be overriden in the end user `config.toml`
|
||||
# You don't need to prefix variables by the theme name but as this will
|
||||
# be merged with user data, some kind of prefix or nesting is preferable
|
||||
# Use snake_casing to be consistent with the rest of Zola
|
||||
[extra]
|
||||
|
||||
# The theme author info: you!
|
||||
[author]
|
||||
name = "Ratan Kulshreshtha"
|
||||
homepage = "https://ratanshreshtha.github.io/"
|