text:
RustChip8 is a Rust interpreter and assembler for the Chip-8 virtual machine.
Essentially a rewrite of my previous project [PyChip8](https://github.com/DavidSpickett/PyChip8).

[![Build Status](https://github.com/davidspickett/rustchip8/workflows/build_and_test/badge.svg)](https://github.com/DavidSpickett/RustChip8/actions)

![INVADERS](/screenshots/invaders.png) <img height="10" hspace="10"/> ![BLINKY](/screenshots/blinky.png)

Examples
--------
```
  rchip8 -i roms/INVADERS 10 (interpret)

  rchip8 -a example.s example.0 (assemble)
```

Input
-----

|Chip8 keys  |RustChip8 keys|
|------------|------------|
|1	2	3	C|1 2 3 4     |
|4	5	6	D|q w e r     |
|7	8	9	E|a s d f     |
|A	0	B	F|z x c v     |

To exit press 'esc'.

Command Line Options
--------------------

```
rchip8 <mode> <file> <scaling factor (-i) / output file name (-a)>
```

* 'mode' is one of '-i' or 'a' for interpret or assemble.

* 'file' is a rom for interpret and an assembly file for assemble.

* 'scaling factor' increases the size of each Chip8 pixel.
e.g. 5 means that each of the Chip8's 64x32 pixels is drawn as
a 5x5 square.

* 'output file name' is the binary file that assembly results
are written to.

Assembler
---------

The assembler follows the ISA laid out in the Cowgod docs [1].
It does not do any relocations so the first instruction in the file
is assumed to be at 0x200, which is where the system is out of reset.

Syntax is fairly forgiving, mixed case is accepted for mnemonics and
register names. V registers can be specified with hex or decimal, although
the disassembler always uses decimal.

### Examples

* [Simple game](https://github.com/DavidSpickett/RustChip8/tree/master/asm_example)
* system/test.rs
* asm/test.rs

### Comments

Single line C style comments can be used like so.

```
//Comment on a new line
CLS // Comment on the end of a line
// Commenting something out
// ADD V0, V1
```

### Labels
These can be declared at any position. Meaning that you
can jump backward to a previous label, or forward to a label
declared later.

```
init:
  CLS
  JP game
<...data...>
game:
  <...logic...>
  SNE V0, 0x00
  JP init
<...data...>
end:
  JP END
```

Labels can be used with CALL, JP, and LD when setting the I register.

### 16 Bit Address Values

Mostly for fun and as an artifact of this implementation, the assembler
can emit a sequence to allow you to load a >12 bit address into the I register.

```
LD I, 0x1234
```

Assuming the address is > 0xFFF this will be transformed into...

```
LD I, 0xFFF
LD V14, 0xFF
ADD I, V14
<repeated>
LD V14, <remainder>
```

There's no real use for this and you have to trash V14 to get it,
but it was fun to think about.

### .word Directive

The .word directive allows you to insert arbitrary 16 bit values
into the assembly like so.

```
  JP game
sprite_data:
.word 0x1234
.word 0x5678
<...etc etc...>
```

With this you can embed data for sprites without needing to know
what address it will end up at.

### Breakpoints

Since SYS instructions are nops for this interpreter, the instruction
'SYS 0xFFF' is re-used as a breakpoint aka 'BRK'. When the interpreter
hits one of these it will print the CPU state and then exit.

```
fn:
  CLS
  ADD V0, V1
  RET
  //Shouldn't get here
  BRK
```

The state is also printed when an unknown instruction is found. So at
this point 'BRK' is just a nicer way of doing .word with an invalid
instr encoding.

References
----------

[1] http://devernay.free.fr/hacks/chip8/C8TECH10.HTM (Technical docs)

http://www.pong-story.com/chip8/ (Homebrew Roms)


text:
---
layout: guide
title: Loot Tables, Recipes, Spawn Rules
parent: Beginners Guide
nav_order: 5
badge: 5
badge_color: guide
badge_justification: left
---

<details id="toc" open markdown="block">
  <summary>
    Table of contents
  </summary>
  {: .text-delta }
1. TOC
{:toc}
</details>

___

# Custom Loot Tables
Loot tables are powerful tools that define what blocks drop upon destruction, what entities upon death, what equipment can entities use, what can a player fish out of a river and what loot ends up in the game's loot chests. In order to understand loot tables better, I recommend looking into the `loot_tables` folder of the Example Vanilla Behavior pack, but I'll trow in some examples from there into here nevertheless.  \
One can even make a loot that drops half-removed blocks like glowingobsidian and netherreactors!

<details>

  <summary>
    Example Loot Tables
  </summary>

  ```jsonc
  //BP/loot_tables/entities/ghast/json

  {
      "pools": [
          {
              "rolls": 1,
              "entries": [
                  {
                      "type": "item",
                      "name": "minecraft:ghast_tear",
                      "weight": 1,
                      "functions": [
                          {
                              "function": "set_count",
                              "count": {
                                  "min": 0,
                                  "max": 1
                              }
                          },
                          {
                              "function": "looting_enchant",
                              "count": {
                                  "min": 0,
                                  "max": 1
                              }
                          }
                      ]
                  }
              ]
          },
          {
              "rolls": 1,
              "entries": [
                  {
                      "type": "item",
                      "name": "minecraft:gunpowder",
                      "weight": 1,
                      "functions": [
                          {
                              "function": "set_count",
                              "count": {
                                  "min": 0,
                                  "max": 2
                              }
                          },
                          {
                              "function": "looting_enchant",
                              "count": {
                                  "min": 0,
                                  "max": 1
                              }
                          }
                      ]
                  }
              ]
          }
      ]
  }
  ```
  ```jsonc
  //BP/loot_tables/chests/equipment.low_tier_items.json

  {
    "pools": [
      {
        "rolls": 1,
        "entries": [
          {
            "type": "item",
            "name": "minecraft:leather_chestplate",
            "weight": 1
          },
          {
            "type": "item",
            "name": "minecraft:iron_chestplate",
            "weight": 1
          },
          {
            "type": "empty",
            "weight": 5
          }
        ]
      },
      {
        "rolls": 1,
        "entries": [
          {
            "type": "item",
            "name": "minecraft:leather_helmet",
            "weight": 1
          },
          {
            "type": "item",
            "name": "minecraft:iron_helmet",
            "weight": 1
          },
          {
            "type": "empty",
            "weight": 5
          }
        ]
      }
    ]
  }
  ```

  ```jsonc
  //BP/loot_tables/chests/village/village_cartographer.json

  {
    "pools": [
      {
        "rolls": {
          "min": 1,
          "max": 5
        },
        "entries": [
          {
            "type": "item",
            "weight": 10,
            "functions": [
              {
                "function": "set_count",
                "count": {
                  "min": 1,
                  "max": 3
                }
              }
            ],
            "name": "minecraft:map"
          },
          {
            "type": "item",
            "weight": 15,
            "functions": [
              {
                "function": "set_count",
                "count": {
                  "min": 1,
                  "max": 5
                }
              }
            ],
            "name": "minecraft:paper"
          },
          {
            "type": "item",
            "weight": 5,
            "name": "minecraft:compass"
          },
          {
            "type": "item",
            "weight": 15,
            "functions": [
              {
                "function": "set_count",
                "count": {
                  "min": 1,
                  "max": 4
                }
              }
            ],
            "name": "minecraft:bread"
          },
          {
            "type": "item",
            "weight": 5,
            "functions": [
              {
                "function": "set_count",
                "count": {
                  "min": 1,
                  "max": 2
                }
              },
              {
                "function": "set_data",
                "data": 0
              }
            ],
            "name": "minecraft:sapling"
          }
        ]
      }
    ]
  }
  ```
  ```jsonc
  //BP/loot_tables/gameplay/fishing/treasure.json

  {
      "pools": [
          {
              "rolls": 1,
              "entries": [
                  {
                      "type": "item",
                      "name": "minecraft:nautilus_shell",
                      "weight": 5
                  },
                  {
                      "type": "item",
                      "name": "minecraft:waterlily",
                      "weight": 5
                  },
                  {
                      "type": "item",
                      "name": "minecraft:name_tag",
                      "weight": 5
                  },
                  {
                      "type": "item",
                      "name": "minecraft:saddle",
                      "weight": 5
                  },
                  {
                      "type": "item",
                      "name": "minecraft:bow",
                      "weight": 5,
                      "functions": [
                          {
                              "function": "set_damage",
                              "damage": {
                                  "min": 0,
                                  "max": 0.25
                              }
                          },
                          {
                              "function": "enchant_with_levels",
                              "levels": 30,
                              "treasure": true
                          }
                      ]
                  },
                  {
                      "type": "item",
                      "name": "minecraft:fishing_rod",
                      "weight": 5,
                      "functions": [
                          {
                              "function": "set_damage",
                              "damage": {
                                  "min": 0,
                                  "max": 0.25
                              }
                          },
                          {
                              "function": "enchant_with_levels",
                              "levels": 30,
                              "treasure": true
                          }
                      ]
                  },
                  {
                      "type": "item",
                      "name": "minecraft:book",
                      "weight": 6,
                      "functions": [
                          {
                              "function": "enchant_with_levels",
                              "levels": 30,
                              "treasure": true
                          }
                      ]
                  }
              ]
          }
      ]
  }
  ```

</details>

<br>

___

The most important thing in a loot table is the *file name*, since loot tables have no other identifier. They can be called by the path of the file in `BP/blocks/blockname.json/"minecraft:loot: {}"` for block loot, `BP/entities/entityname.json/"minecraft:loot: {}"` for entities and `BP/entities/entityname.json/"minecraft:equipment: {}"` for entity equipment (most hostile mobs use `low_tier_items.json`).\

If you want to change what can a player fish out of a jungle river, simply create your own loot table under `BP/loot_tables/gameplay/fishing/jungle_fish.json and BP/loot_tables/gameplay/fishing/jungle_junk.json` to overwrite the Vanilla loot tables. This can be done with most other Vanilla files too (if the aspect is data-driven).

You can also use `loot_tables.empty.json` for no loot.

Let's break up the Loot table structure somewhat. I took a simple zombie loot table as an example.

```jsonc
{
    "pools": [
        {
            "rolls": 1,
            "entries": [
                {
                    "type": "item",
                    "name": "minecraft:rotten_flesh",
                    "weight": 1,
                    "functions": [
                        {
                            "function": "set_count",
                            "count": {
                                "min": 0,
                                "max": 2
                            }
                        },
                        {
                            "function": "looting_enchant",
                            "count": {
                                "min": 0,
                                "max": 1
                            }
                        }
                    ]
                }
            ]
        },
        {
            "conditions": [
                {
                    "condition": "killed_by_player"
                },
                {
                    "condition": "random_chance_with_looting",
                    "chance": 0.025,
                    "looting_multiplier": 0.01
                }
            ],
            "rolls": 1,
            "entries": [
                {
                    "type": "item",
                    "name": "minecraft:iron_ingot",
                    "weight": 1
                },
                {
                    "type": "item",
                    "name": "minecraft:carrot",
                    "weight": 1
                },
                {
                    "type": "item",
                    "name": "minecraft:potato",
                    "weight": 1
                }
            ]
        }
    ]
}
```

- "`rolls`" defines how many times a random entry will be chosen from the following "`entries`" object.
- "`type`" can be set to either "`item`" or "`loot_table`" (to refer to an external loot table. For more information on that, check the Vanilla `BP/loot_tables/gameplay/fishing.json`).
- "`name`" only goes after `"type": "item"` and can be set to an item's full identifier, including the namespace.
- "`weight`" is the chance of this entry being chosen. The higher the weight in comparison to other entries in this "`entries`" array, the higher the chance of the entry being chosen.
- "`functions`" are what makes loot tables so powerful. They can do a lot, including setting the number of items dropped, enchanting the items(enchantments can even go on normally non-enchantable items that way), setting the items' names, the items' lores, and even writing books. \
For more information on functions check the example vanilla files or the unofficial Loot Table documentation, available [here](https://minecraft.gamepedia.com/Bedrock_Edition_function/loot_tables/trade_tables_documentation).
- "`conditions`" can check for things like *"was the entity killed by a player?"* and *"was the sword enchanted with Looting III?"*. More info in them can be found in the resources listed above. \

*Blocks do not drop loot in creative mode*

**Note: it is possible to generate loot tables visually online. Check Links and Contact for the link to a reliable generator.**

***Challenge: Create custom loot tables for our custom blocks created in the previous chapter!***

___
___

# Custom crafting/smelting/etc Recipes

Recipes can have unique identifiers like `tut:compass_from_compass_block`. They're located in `BP/recipes`.

- The parameter below "`format_version`" defines the type of this recipe. It can be set to "`recipe_furnace`"(smelting), "`recipe_shaped`"(every ingredient has a set place in the crafting grid) and "`recipe_shapeless`"(ingredients can be placed in whatever order into the crafting grid).
- Every recipe takes "`tags`" which are a list of vanilla benches that can use this recipe. Can be "`crafting_table`", "`furnace`", "`smoker`", "`blast_furnace`", "`campfire`", "`stonecutter`" etc.
After b1.16.100 also accepts tags of custom benches.

Let's look through some recipe-specific syntax next.

### Smelting recipe example

```jsonc
{
  "format_version": "1.12",
  "minecraft:recipe_furnace": {
    "description": {
      "identifier": "minecraft:furnace_beef"
    },
    "tags": ["furnace", "smoker", "campfire"],
    "input": {
      "item": "minecraft:beef",
      "data": 0,
      "count": 4
    },
    "output": "minecraft:cooked_beef"
  }
}
```

- "`input`":
"`item`": the item's to be smelted full identifier;
"`data`": it's *aux value*. Default: `0`;
- *"`count`" is optional. It most likely has something to do with the number of items that can be smelted at the same time in a campfire, but it isn't documented anywhere.*
- "`output`": the item that the furnace outputs after smelting.

### Shaped recipe example
```jsonc
{
"format_version": "1.12",
"minecraft:recipe_shaped": {
"description": {
	"identifier": "minecraft:acacia_boat"
	},
"tags": [ "crafting_table" ],
"groups": [ "planks" ],
"pattern": [
				"#P#",
				"###"
				],
	"key": {
		"P": {
			"item": "minecraft:wooden_shovel"
		},
		"#": {
			"item": "minecraft:planks",
			"data": 4
			}
		},
"result": {
		"item": "minecraft:boat",
		"data": 4
		}
	}
}
```

- "`pattern`" consists of 3 rows each consisting of 3 character keys. Each character symbolizes an item in a slot of the crafting grid.
- "`key`" defines each character to mean an item. Here, 'P' means a Wooden Shovel and '`#`' means a '`planks`' block with aux value `4`, which is the Acacia Planks block.
- "`result`" means same as output. Here it's an Acacia Boat('`boat`' with aux id `4`).

Let's also look into a recipe that gives you more than one item as a result.

```jsonc
{
  "format_version": "1.12",
  "minecraft:recipe_shaped": {
    "description": {
    "identifier": "minecraft:coal"
    },

    "tags": [ "crafting_table" ],
    "pattern": [
      "#"
    ],
    "key": {
      "#": {
        "item": "minecraft:coal_block"
      }
    },
    "result": {
      "item": "minecraft:coal",
      "data": 0,
      "count": 9
    }
  }
}
```

- "`count`" defines how many items you get when you craft this. Here you get 9 coal from deconstructing a coal block.

### Shapeless recipe example

```jsonc
{
"format_version": "1.12",
"minecraft:recipe_shapeless": {
"description": {
	"identifier": "minecraft:firecharge_coal_sulphur"
	},
 "priority": 0,
 "ingredients": {
	    "item": "minecraft:fireball",
	    "data": 0,
	    "count": 4
 },
"result": {
	    "item": "minecraft:blaze_powder",
	    "data": 4
	    }
	}
}
```

```jsonc
{
    "format_version": "1.12",
    "minecraft:crafting_shapeless": {
        "ingredients": [
            {
                "item": "minecraft:apple"
            },
            {
                "item": "minecraft:chest_minecart"
            },
            {
                "item": "minecraft:apple"
            }
        ],
        "result": {},
        "description": {
            "identifier": "tut:randomity_recipe"
        }
    }
}
```

- "`priority`" is the priority with which the recipe will be chosen over others.
- "`ingredients`" is simply a list of all ingredients with their aux values. There are no keys, since the ingredients can be placed in any crafting grid slot.

**Note: Crafting recipes can be generated visually online, check Links and Contact for a stable generator.**

***Challenge: Create custom crafting/smelting recipes for our custom blocks and items created in previous chapters!***

___
# Spawn Rules
Spawn rules define how vanilla Entities and custom entities spawn. In the next chapter we'll be creating a custom entity, so make sure to prepare a custom spawn rule for it! Check out the vanilla example files for more information. ;)

```jsonc
//BP/spawn_rules/zombie.json

{
  "format_version": "1.8.0",
  "minecraft:spawn_rules": {
    "description": {
      "identifier": "minecraft:zombie",
      "population_control": "monster"
    },
    "conditions": [
      {
        "minecraft:spawns_on_surface": {},
        "minecraft:spawns_underground": {},
        "minecraft:brightness_filter": {
          "min": 0,
          "max": 7,
          "adjust_for_weather": true
        },
        "minecraft:difficulty_filter": {
          "min": "easy",
          "max": "hard"
        },
        "minecraft:weight": {
          "default": 100
        },
        "minecraft:herd": {
          "min_size": 2,
          "max_size": 4
        },
        "minecraft:permute_type": [
          {
            "weight": 95
          },
          {
            "weight": 5,
            "entity_type": "minecraft:zombie_villager"
          }
        ],
        "minecraft:biome_filter": {
          "test": "has_biome_tag", "operator": "==", "value": "monster"
        }
      }
    ]
  }
}
```

- "`description`">"`identifier`":  the entity to spawn
- "`population_control`": controls spawning and despawning quantities. Can be set to "`animal`", "`underwater_animal`", "`monster`" and "`ambient`".
- "`conditions`" are a list of conditions that have to be met in order for the spawn attempt to succeed.
- "`minecraft:spawns_on_surface`", "`minecraft:spawns_underground`" and "`minecraft:spawns_underwater`" control where the entity spawns cap-wise.
- "`minecraft_brightness_filter`" can be set from 0 to 15 and controls in which light levels can entities spawn. - "`adjust_for_weather`" defines whether it light levels are counted lower during rain or thunder weather.
- "`minecraft:difficulty_filter`" sets the range of level difficulty to enable this entity's spawns.
- "`minecraft:herd`" sets the number of entities spawning together, on the same spawn rule.
- "`minecraft:permute_type`" with "`weight`"s and "`entity_type`"s sets a chance for the spawned entity to mutate into a different one.
- And, lastly, "`minecraft:biome_filter`" tests for certain biome tags. Look up the filter syntax and list of biome tags in the documentation or search examples in the vanilla Example pack.

```jsonc
"minecraft:herd": {
          "min_size": 1,
          "max_size": 2,
          "event":"minecraft:entity_born",
          "event_skip_count": 1
        },
```

- "`minecraft:herd`" can also be used like this to make the second entity spawned [in this scenario] with the "`minecraft:entity:born`" (as baby). Can be used in any event.
`"event_skip_count": 2`, for example, means that the first two entities will not be spawned with this event, but all the next ones will.

*Why not create some more custom blocks, items, recipes and loot tables before moving onto the next big chapter?*

___
___
## Your progress so far
**What you've done:**
- [x] Learned to create Loot Tables;
- [x] Learned to create  custom Recipes of different types;
- [x] Learned to create spawn rules;
- [x] Created Recipes and Loot Tables for our custom blocks and items;
- [x] Learned about the usefulness referencing the Example files and the documentation even better;
- [x] Tried out some online file generators;

**What are you to do next:**
- [ ] **Create. Custom. Entities.**

license: MIT

repository: SmokeyStack/bedrock-wiki

branch_name: refs/heads/gh-pages

extension: md

gha_license_id: MIT

license_type: permissive

repo_name: SmokeyStack/bedrock-wiki


text:
---
title: 5 Trends Shaping the Chinese Consumer Demand
permalink: /success-and-blog/blog/5-trends-of-chinese-consumers/
breadcrumb: 5 Trends Shaping the Chinese Consumer Demand
third_nav_title: Articles
---

Date:   22-06-2019

Over the years, the growth of the Chinese economy has shown signs of cooling. Despite that, China is still adding an equivalent of "an Australia" to it's GDP each year.
  This not only indicates the growth of the middle-class population, but also the increasing affluence of this Chinese middle-class. Sales records are constantly being
  broken, with the recent 6/18 Mid-Year Shopping Festival even breaking the record set in last year's 11/11 Global Shopping Festival.

Here are five trends that are shaping the demand of Chinese consumers, and what it means for you as a foreign brand owner.

1. The Rapidly Growing Middle-Class

Source: McKinsey

The Chinese middle-class is defined as an urban household that earns between US$9,000 - US$34,000 a year. Based on a McKinsey research, the proportion of poor households
  is projected to be reduced from 29% of the population in 2012, to just 16% of the population. At the same time, the proportion of households defined as the upper middle-class
  to affluence will increase from 17% in 2012 to 63% by 2022.

What this also means is that the disposable income that the average household has outside of their necessities is expected to increase. Along with the increasingly
  discerning taste, consumers are increasingly eschewing cheaper and lower-end products, and looking for higher-quality, and often foreign brands and products.

2. Increased Spending in Tier 3 and 4 Cities

Source: Morgan Stanley

While Tier 1 and Tier 2 cities tend to be the common entry points into the Chinese market, a majority of the Chinese population still reside in Tier 3 cities and below.
  Corresponding to the growth of the Chinese economy, most of the growth is expected to be located in Tier 3 cities and below, with Morgan Stanley's estimating the household
  consumption of lower-tiered cities to triple between 2017 and 2030. In the recently concluded 6/18 shopping festival, social commerce platforms such as as Pinduoduo
  reported 70% of sales coming from Tier-3 cities and below, indicating the untapped potential for new, foreign brands entering the market.

3. The Power of Social Commerce

Source (left-to-right): 抖音Douyin, 小红书Xiaohongshu

By 2020, China's social commerce market is expected to hit US$150 billion with 24 million merchants onboard the various social commerce platforms. In a nutshell, social
  commerce is the usage of social media tools for the promotion, marketing, and sales of goods and services. 小红书, or RED, started off as a photo-sharing social platform
  with a focus on foreign beauty products, allowing its users to discover new brands and products through the lens of key opinion leaders (KOLs) or influencers. With more
  than 30 million monthly active users (MAUs), RED has now evolved into a platform that brings together the visual, social aspects of Pinterest and Instagram, with e-commerce
  functionalities to make for an entertaining, yet seamless consumer journey for its users.

4. Local Health and Safety Concerns

From cadium-tainted rice to melamine in milk powders, China is no stranger to health and safety scares. The issue of counterfeit cosmetics is also not uncommon, with
  harmful materials such as heavy metals and impurities often being present in counterfeit products. The fear of counterfeit goods, especially goods that are of consumable
  or topical nature that can cause real harm to one's health, has resulted in consumers turning to credible cross-border platforms such as T-Mall, JD.com, or Xiaohongshu to
  look to foreign goods, often deemed as being of higher safety and quality.

5. Cross-Border e-Commerce Policies

With the growth of the demand for foreign goods, and the strict requirements of the direct importation of foreign goods, the Chinese government has also loosened
  cross-border e-commerce policies to encourage foreign investment in the country, while meeting the demands of its increasing consumer population. Since January 2019,
  the Chinese Ministry of Finance has announced the following changes to its cross-border e-commerce regulations:

Single-transaction limit has been increased from RMB 2,000 to RMB 5,000

Annual transaction limit has increased from RMB 20,000 to RMB 26,000

The list of products permitted for cross-border importation has been increased, with 63 new categories introduced to the positive list for cross-border purchases.

What Does This Mean for Your Brand?

With the rapid growth of demand for international brands and products, coupled with the introduction of new cross-border e-commerce policies, there is no better time
for brands to enter the Chinese market.

Join us at the Alibaba Global Course Series (AGCs) to learn how you can expand your global footprint with cross-border e-commerce from top Alibaba
trainers and practitioners. Find out more about the AGCs right here.

repository: isomerpages/nyp-sirs

branch_name: refs/heads/staging

gha_language: SCSS

gha_license_id: NOASSERTION

repo_name: isomerpages/nyp-sirs


text:
#Countdown Bookmarklet

Built with http://mrcoles.com/bookmarklet

[Include jQuery and moment.js (https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.2/moment.min.js)]

Enter the link below and drag the link to your bookmarks toolbar:

[http://htmlpreview.github.io/?https://github.com/jorgesierra/countdown-bookmarklet/blob/master/link.html] (http://htmlpreview.github.io/?https://github.com/jorgesierra/countdown-bookmarklet/blob/master/link.html)

repository: jorgesierra/countdown-bookmarklet

branch_name: refs/heads/master

repo_name: jorgesierra/countdown-bookmarklet


text:
# Publishing process

## Terms of service

By submitting a model for publication, you agree to the TensorFlow Hub Terms of
Service at [https://tfhub.dev/terms](https://tfhub.dev/terms).

## Overview of the publishing process

The full process of publishing consists of:

1.  Exporting the model asset to publish (see how to
    [export a model](exporting_tf2_saved_model.md))
1.  Writing publisher page and model documentation (see how to
    [write documentation](writing_documentation.md))
1.

repository: tensorflow/docs

gha_language: Jupyter Notebook

repo_name: tensorflow/docs


text:
# Download

There are two ways to get *simple-auth*, either as a binary or docker image.  No one way is preferred over the other, and it simply depends what fits in your stack.

## Docker Image

```sh
docker pull zix99/simple-auth:latest
```

## Binary

Download the binary from the <a :href="`${$themeConfig.repoUrl}/releases`" target="_blank">releases page</a>

## Next steps

See [Quick Start](./quickstart.md) or head to [Config](./config.md)

repository: irtyamine/simple-auth

repo_name: irtyamine/simple-auth


text:
# zip-bucket

![Build Status](https://github.com/DrPaulBrewer/zip-bucket/actions/workflows/node.js.yml/badge.svg)
[![Known Vulnerabilities](https://snyk.io/test/github/DrPaulBrewer/zip-bucket/badge.svg)](https://snyk.io/test/github/DrPaulBrewer/zip-bucket)

Creates a .zip archive from a collection of files in a Google Cloud Storage[tm] bucket.  Include nodejs library and simple command-line program.

Keep the resulting .zip file locally, upload back to Google Cloud Storage, or both.

## Command Line Program

The `zip-bucket` command line program was split off
into its own module in v2.0.0.

install [zip-bucket-bin](https://npmjs.com/zip-bucket-bin) for the `zip-bucket` command line program

## Library

The v2.0.0 library is the same as v1.9.0.  The only breaking change
is the removal of the  `zip-bucket` command line program and associated dependencies.

### Installation

    npm i zip-bucket -S

### Importing and Setup

    const storage = require('@google-cloud/storage')(optional_api_key);

**Pass the storage object** when setting up zipBucket for usage.

    const zipBucket = require('zip-bucket')(storage);

### Usage

zipBucket takes an object with specific properties describing the zip operation, and returns a `Promise`

    zipBucket({ fromBucket, fromPath, toBucket, toPath, keep, mapper, metadata })
    .then(function yourNextTask({fromBucket, fromPath, toBucket, toPath, keep, metadata, manifest}))
    ...

### Object Parameters

`fromBucket` **required** string - The name of the bucket in Google Cloud Storage[tm] to search for files to zip.  Does *not* need to begin with 'gs://'.  Example:  `"my-favorite-bucket"`

`fromPath` **required** string - All files whose names begin with `fromPath` will be selected for adding to the zip file.
Example: `"blogposts/2017/Feb/"`

`toBucket` optional string - The name of the bucket where the zip file is to be stored.  This can be the same string used to set fromBucket.  If undefined, the zip file will not be uploaded to a bucket.  Example: `"my-backup-bucket"`

`toPath` optional string - The path in the bucket to store the zip file, including the file name. Example: `"2017/Feb/blogposts.zip"`

`keep` optional string - A path in the local filesystem to save the zip file.

`metadata` optional object - A key/value object to set custom metadata for your zipfile in Google Cloud Storage.

`mapper` optional function - A `function(GCS_File, fromPath):string` for renaming files inside the zip.  Could also be useful for generating side-effects, like populating metadata, or recording md5 values, etc. Has access to the full File object
in Google Cloud Storage, including metadata, but not file contents. This function can be safely left undefined.

### Promise resolution

The Promise will only resolve successfully if all steps pass, the zip file is created, and is [optionally] uploaded
to the bucket and [optionally] saved.

The Promise resolves to an object containing the properties shown in the call to `yourNextTask`, which is shown for illustrative purposes only.  Except for `manifest`, these are input properties passed as-is.

THe returned `manifest` consists of an array of pairs of the file name in the bucket and file name in the zip file, i.e. `[[fileNameInBucket, fileNameInZipfile],...]`

### No bucket files are moved or deleted by zipBucket

`zipBucket` does not delete the files from the bucket after copying them to the `.zip` archive. That's your job. The resolved `manifest` may be helpful.

## Limitations

The current tests include a 100MB file and several smaller files. Streaming is used, and the write stream to
Google Cloud Storage can sometimes timeout (~1%). This and other issues can be caught with the Promise's `.catch`.

## Google Cloud Charges

Keep in mind that running this software outside of Google Cloud will result in bandwidth fees. To save money,
you should probably find a way to run it from within Google Cloud.

Note:  All Google service fees are your responsibility, as the user of this software, and under the MIT License there is
a disclaimer of liability for any defects in this software.

## Local Testing

If you clone the repository and want to test it locally, you will need to change the storage initialization and
bucket names in ./test/index.js to something more appropriate for your local tests.

## Copyright

Copyright 2017 Paul Brewer, Economic and Financial Technology Consulting LLC<EMAIL_ADDRESS>and Contributors

## Contributions

@atlanteh Windows compatibility, downloadValidation flag, v1.0 based on streaming

@harscoet Patch for issue with bin.js, move bin.js dependencies to "dependencies"

## License

The MIT License

### Trademarks

Google Cloud Storage[tm] is a trademark of Google, Inc.

This software is not a product of Google, Inc.

repository: DrPaulBrewer/zip-bucket

gha_language: JavaScript

repo_name: DrPaulBrewer/zip-bucket


text:
---
title: Remote driver
keywords: build, buildx, driver, builder, remote
aliases:
- /build/buildx/drivers/remote/
- /build/building/drivers/remote/
---

The Buildx remote driver allows for more complex custom build workloads,
allowing you to connect to externally managed BuildKit instances. This is useful
for scenarios that require manual management of the BuildKit daemon, or where a
BuildKit daemon is exposed from another source.

## Synopsis

```console
$ docker buildx create \
  --name remote \
  --driver remote \
  tcp://localhost:1234
```

The following table describes the available driver-specific options that you can
pass to `--driver-opt`:

| Parameter    | Type   | Default            | Description                                                            |
| ------------ | ------ | ------------------ | ---------------------------------------------------------------------- |
| `key`        | String |                    | Sets the TLS client key.                                               |
| `cert`       | String |                    | Absolute path to the TLS client certificate to present to `buildkitd`. |
| `cacert`     | String |                    | Absolute path to the TLS certificate authority used for validation.    |
| `servername` | String | Endpoint hostname. | TLS server name used in requests.                                      |

## Example: Remote BuildKit over Unix sockets

This guide shows you how to create a setup with a BuildKit daemon listening on a
Unix socket, and have Buildx connect through it.

1. Ensure that [BuildKit](https://github.com/moby/buildkit)
   is installed.

   For example, you can launch an instance of buildkitd with:

   ```console
   $ sudo ./buildkitd --group $(id -gn) --addr unix://$HOME/buildkitd.sock
   ```

   Alternatively, [see here](https://github.com/moby/buildkit/blob/master/docs/rootless.md)
   for running buildkitd in rootless mode or [here](https://github.com/moby/buildkit/tree/master/examples/systemd)
   for examples of running it as a systemd service.

2. Check that you have a Unix socket that you can connect to.

   ```console
   $ ls -lh /home/user/buildkitd.sock
   srw-rw---- 1 root user 0 May  5 11:04 /home/user/buildkitd.sock
   ```

3. Connect Buildx to it using the remote driver:

   ```console
   $ docker buildx create \
     --name remote-unix \
     --driver remote \
     unix://$HOME/buildkitd.sock
   ```

4. List available builders with `docker buildx ls`. You should then see
   `remote-unix` among them:

   ```console
   $ docker buildx ls
   NAME/NODE           DRIVER/ENDPOINT                        STATUS  PLATFORMS
   remote-unix         remote
     remote-unix0      unix:///home/.../buildkitd.sock        running linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
   default *           docker
     default           default                                running linux/amd64, linux/386
   ```

You can switch to this new builder as the default using
`docker buildx use remote-unix`, or specify it per build using `--builder`:

```console
$ docker buildx build --builder=remote-unix -t test --load .
```

Remember that you need to use the `--load` flag if you want to load the build
result into the Docker daemon.

## Example: Remote BuildKit in Docker container

This guide will show you how to create setup similar to the `docker-container`
driver, by manually booting a BuildKit Docker container and connecting to it
using the Buildx remote driver. This procedure will manually create a container
and access it via it's exposed port. (You'd probably be better of just using the
`docker-container` driver that connects to BuildKit through the Docker daemon,
but this is for illustration purposes.)

1.  Generate certificates for BuildKit.

    You can use this [bake definition](https://github.com/moby/buildkit/blob/master/examples/create-certs)
    as a starting point:

    ```console
    SAN="localhost <IP_ADDRESS>" docker buildx bake "https://github.com/moby/buildkit.git#master:examples/create-certs"
    ```

    Note that while it's possible to expose BuildKit over TCP without using
    TLS, it's not recommended. Doing so allows arbitrary access to BuildKit
    without credentials.

2.

3.  Connect to this running container using Buildx:

    ```console
    $ docker buildx create \
      --name remote-container \
      --driver remote \
      --driver-opt cacert=${PWD}/.certs/client/ca.pem,cert=${PWD}/.certs/client/cert.pem,key=${PWD}/.certs/client/key.pem,servername=<TLS_SERVER_NAME> \
      tcp://localhost:1234
    ```

    Alternatively, use the `docker-container://` URL scheme to connect to the
    BuildKit container without specifying a port:

    ```console
    $ docker buildx create \
      --name remote-container \
      --driver remote \
      docker-container://remote-container
    ```

## Example: Remote BuildKit in Kubernetes

This guide will show you how to create a setup similar to the `kubernetes`
driver by manually creating a BuildKit `Deployment`. While the `kubernetes`
driver will do this under-the-hood, it might sometimes be desirable to scale
BuildKit manually. Additionally, when executing builds from inside Kubernetes
pods, the Buildx builder will need to be recreated from within each pod or
copied between them.

1. Create a Kubernetes deployment of `buildkitd`, as per the instructions
   [here](https://github.com/moby/buildkit/tree/master/examples/kubernetes).

   Following the guide, create certificates for the BuildKit daemon and client
   using [create-certs.sh](https://github.com/moby/buildkit/blob/master/examples/kubernetes/create-certs.sh),
   and create a deployment of BuildKit pods with a service that connects to
   them.

2. Assuming that the service is called `buildkitd`, create a remote builder in
   Buildx, ensuring that the listed certificate files are present:

   ```console
   $ docker buildx create \
     --name remote-kubernetes \
     --driver remote \
     --driver-opt cacert=${PWD}/.certs/client/ca.pem,cert=${PWD}/.certs/client/cert.pem,key=${PWD}/.certs/client/key.pem \
     tcp://buildkitd.default.svc:1234
   ```

Note that this will only work internally, within the cluster, since the BuildKit
setup guide only creates a ClusterIP service. To configure the builder to be
accessible remotely, you can use an appropriately configured ingress, which is
outside the scope of this guide.

To access the service remotely, use the port forwarding mechanism of `kubectl`:

```console
$ kubectl port-forward svc/buildkitd 1234:1234
```

Then you can point the remote driver at `tcp://localhost:1234`.

Alternatively, you can use the `kube-pod://` URL scheme to connect directly to a
BuildKit pod through the Kubernetes API. Note that this method only connects to
a single pod in the deployment:

```console
$ kubectl get pods --selector=app=buildkitd -o json | jq -r '.items[].metadata.name
buildkitd-XXXXXXXXXX-xxxxx
$ docker buildx create \
  --name remote-container \
  --driver remote \
  kube-pod://buildkitd-XXXXXXXXXX-xxxxx
```

repository: docker/docs

branch_name: refs/heads/main

gha_language: HTML

repo_name: docker/docs


text:
---
title: HeidiSQL
author: PipisCrew
date: 2013-11-04
categories: []
toc: true
---

Is a lightweight, Windows based application for managing MySQL and Microsoft SQL databases. It enables you to browse and edit data, create and edit tables, views, procedures, triggers and scheduled events.

homepage : [http://www.heidisql.com/](http://www.heidisql.com/)

origin - http://www.pipiscrew.com/?p=459 heidisql


text:
### [CVE-2021-42136](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-42136)
![](https://img.shields.io/static/v1?label=Product&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=brighgreen)

### Description

A stored Cross-Site Scripting (XSS) vulnerability in the Missing Data Codes functionality of REDCap before 11.4.0 allows remote attackers to execute JavaScript code in the client's browser by storing said code as a Missing Data Code value. This can then be leveraged to execute a Cross-Site Request Forgery attack to escalate privileges to administrator.

### POC

#### Reference
- http://packetstormsecurity.com/files/166723/REDCap-Cross-Site-Scripting.html

#### Github
- https://github.com/ARPSyndicate/cvemon

repository: trickest/cve

repo_name: trickest/cve


text:
---
layout: post
title:  "Hackernews post on good free content by category"
date:   2022-07-15
categories: economics money waste farming cooking
video: false
---

[Understanding modern Linux routing and wg quick](https://ro-che.info/articles/2021-02-27-linux-routing)

[Europe Hypnotized Into War Economy](https://www.zerohedge.com/geopolitical/vilches-europe-hypnotized-war-economy)

[Distributed Denial of Secrets is a journalist 501(c)(3) non-profit devoted to enabling the free transmission of data in the public interest](https://ddosecrets.com/wiki/Distributed_Denial_of_Secrets)

[Many flavours of hasing](https://notes.volution.ro/v1/2022/07/notes/1290a79c/)

[RTEMS Real Time Operating System](https://www.rtems.org/) - The Real-Time Executive for Multiprocessor Systems or RTEMS is an open source Real Time Operating System (RTOS) that supports open standard application programming interfaces (API) such as POSIX.

[HAProxy: How to temporary disable a backend server using the command line and the stats socket](//www.claudiokuenzler.com/blog/1240/haproxy-how-to-disable-enable-backend-server-command-line-cli-socket)

[8 bit workshop](https://8bitworkshop.com/)

[World of Egyption Demons](//www.archaeology.org/issues/465-2205/features/10481-the-world-of-egyptian-demons)

[Godfather of computational complexity](//blog.computationalcomplexity.org/2022/08/the-godfather-of-complexity.html)

[Faster Ruby](//www.mgaudet.ca/technical/2022/8/9/faster-ruby-thoughts-from-the-outside)

extension: markdown


text:
> 💡 If you are unfamiliar with the Tailwind CSS shorthand syntax please read the [Tailwind documentation](https://tailwindcss.com/docs) about [Utility-First](https://tailwindcss.com/docs/utility-first), [Responsive Design](https://tailwindcss.com/docs/responsive-design) and [Hover, Focus, & Other States](https://tailwindcss.com/docs/hover-focus-and-other-states).

```js
import { tw } from 'twind'

document.body.innerHTML = `
  <main class="${tw`h-screen bg-purple-400 flex items-center justify-center`}">
    <h1 class="${tw`font-bold text(center 5xl white sm:gray-800 md:pink-700)`}">This is Twind!</h1>
  </main>
`
```

> 🚀 [live and interactive demo](https://esm.codes/#aW1wb3J0IHsgdHcgfSBmcm9tICdodHRwczovL2Nkbi5za3lwYWNrLmRldi90d2luZCcKCmRvY3VtZW50LmJvZHkuaW5uZXJIVE1MID0gYAogIDxtYWluIGNsYXNzPSIke3R3YGgtc2NyZWVuIGJnLXB1cnBsZS00MDAgZmxleCBpdGVtcy1jZW50ZXIganVzdGlmeS1jZW50ZXJgfSI+CiAgICA8aDEgY2xhc3M9IiR7dHdgZm9udC1ib2xkIHRleHQoY2VudGVyIDV4bCB3aGl0ZSBzbTpncmF5LTgwMCBtZDpwaW5rLTcwMClgfSI+VGhpcyBpcyBUd2luZCE8L2gxPgogIDwvbWFpbj4KYA==)

- [The tw function](#the-tw-function)
- [The apply function](#the-apply-function)

## The tw function

Calling the {@link twind.tw | tw} function results in the shorthand rules to be interpreted, normalized and compiled into CSS rules which get added to a stylesheet in the head of the document. The function will return a string consisting of all the class names that were processed. These class names can then be applied to the element itself much like any other CSS-in-JS library.

```js
tw`bg-gray-200 rounded`
//=> bg-gray-200 rounded
tw`bg-gray-200 ${false && 'rounded'}`
//=> bg-gray-200
```

Show me more examples

```js
tw`bg-gray-200 ${[false && 'rounded', 'block']}`
//=> bg-gray-200 block
tw`bg-gray-200 ${{ rounded: false, underline: isTrue() }}`
//=> bg-gray-200 underline
tw`bg-${randomColor()}`
//=> bg-blue-500
tw`hover:${({ tw }) => tw`underline`}`
//=> hover:underline
tw`bg-${'fuchsia'}) sm:${'underline'} lg:${false && 'line-through'} text-${[
  'underline',
  'center',
]} rounded-${{ lg: false, xl: true }})`
// => bg-fuchsia sm:underline text-underline text-center rounded-xl

tw`text-${'gray'}-100 bg-${'red'}(600 hover:700 ${'focus'}:800)`
// => text-gray-100 bg-red-600 hover:bg-red-700 focus:bg-red-800
```

It is possible to invoke the {@link twind.tw | tw} function in a multitude of different ways. It can take any number of arguments, each of which can be an Object, Array, Boolean, Number, String or Template Literal. This ability is inspired heavily by the [clsx](https://npmjs.com/clsx) library by [Luke Edwards](https://github.com/lukeed).

> Note any falsey values are always discarded as well as standalone boolean and number values

```js
// Strings
tw('bg-gray-200', true && 'rounded', 'underline')
//=> bg-gray-200 rounded underline

// Objects
tw({ 'bg-gray-200': true, rounded: false, underline: isTrue() })
//=> bg-gray-200 underline

// Arrays
tw(['bg-gray-200', 0, false, 'rounded'])
//=> bg-gray-200 rounded

// Mixed
tw('bg-gray-200', [
  1 && 'rounded',
  { underline: false, 'text-black': null },
  ['text-lg', ['shadow-lg']],
])
//=> bg-gray-200 rounded text-lg shadow-lg
```

Show me more examples

```js
tw({ 'bg-gray-200': true }, { rounded: false }, null, { underline: true })
//=> bg-gray-200 underline

tw({ hover: ['bg-red-500', 'p-3'] }, 'm-1')
// => hover:bg-red-500 hover:p-3 m-1

tw(['bg-gray-200'], ['', 0, false, 'rounded'], [['underline']])
//=> bg-gray-200 rounded underline

tw({
  sm: ['hover:rounded', 'active:rounded-full'],
  md: { rounded: true, hover: 'bg-white' },
  lg: {
    'rounded-full': true,
    hover: 'bg-white text-black active:(underline shadow)',
  },
})
// sm:hover:rounded sm:active:rounded-full md:rounded md:hover:bg-white lg:rounded-full lg:hover:bg-white lg:hover:text-black lg:hover:active:underline lg:hover:active:shadow
```

## The apply function

Use {@link twind.apply | apply} to inline any existing utility classes into a single CSS class.

This is useful when you find a common utility pattern in your HTML that you'd like to extract to a new component.

```js
import { apply } from 'twind'

const btn = apply`inline-block bg-gray-500 text-base`
// => generates on CSS class with all declarations of the above rules when used

const btnBlock = apply`${btn} block`
// => generates on CSS class with all declarations of btn & block

<button class={tw`${btn}`}>gray-500</button>
// => tw-XXXXX

<button class={tw`${btn} bg-red-500 text-lg`}>red-500 large</button>
// => tw-XXXX bg-red-500 text-lg

<button class={tw`${btnBlock}`}>block button</button>
// => tw-YYYY
```

The component styles are added **before** the utility classes to the stylesheet which allows utilities to override component styles.

For more examples see the {@page Defining Components} guide.

> 💡 Another way to extract common component styles is by {@page Plugins | using an alias plugin}.

Continue to {@page Thinking in Groups}

repository: shrynx/twind

repo_name: shrynx/twind


text:
Requirements

- JDK 7+
- JSAGA libs (v1.1.x)
- jsaga-job-management (v1.5.9+)
- CORSIKA-LAGO-browse-portlet-<IP_ADDRESS>.war

About the CORSIKA-LAGO application

LAGO is an international project from more than 80 scientists of 8 latinamerican countries started in 2005 (complete list of the collaboration members and their institutions). The LAGO project aims at observing Gamma Ray Bursts (GRBs) by the single particle technique using water Cherenkov detectors (WCD). It consists of various sites at high altitude, in order to reach a good sensitivity to the faint signal expected from the high energy photons from GRBs.

CORSIKA (COsmic Ray SImulations for KAscade) is a program for detailed simulation of extensive air showers initiated by high energy cosmic ray particles. Protons, light nuclei up to iron, photons, and many other particles may be treated as primaries.

Contribute

- Fork it
- Create a branch (git checkout -b my_markup)
- Commit your changes (git commit -am "My changes")
- Push to the branch (git push origin my_markup)
- Create an Issue with a link to your branch

Sponsors

repository: csgf/corsika-lago-portlet

repo_name: csgf/corsika-lago-portlet


text:
# Kirby routing with attributes

Load routes from `site/routes` and annotate metadata with PHP 8 attributes.
No more business logic in your config files 🎉

****

## Usage

After [installing](#Installation), create a new folder `site/routes`. Then
create a new file for each route you want to add. The filename does not matter,
but every file must return a function, that is annotated with the provided
PHP 8 attributes:

```php
// site/routes/my-awesome-route.php
<?php

use Kirby\Http\Response;
use PresProg\RouteAttributes\Attributes\Get;

return #[Get('/foo/(:all)')] function ($all) {
    return new Response("<h1>$all</h1>", null, 200);
};
```

The following attributes are included:

* [Get](https://github.com/presprog/kirby-route-attributes/blob/master/src/Attributes/Get.php)
* [Head](https://github.com/presprog/kirby-route-attributes/blob/master/src/Attributes/Head.php)
* [Options](https://github.com/presprog/kirby-route-attributes/blob/master/src/Attributes/Options.php)
* [Post](https://github.com/presprog/kirby-route-attributes/blob/master/src/Attributes/Post.php)
* [Patch](https://github.com/presprog/kirby-route-attributes/blob/master/src/Attributes/Patch.php)
* [Delete](https://github.com/presprog/kirby-route-attributes/blob/master/src/Attributes/Delete.php)
* [Connect](https://github.com/presprog/kirby-route-attributes/blob/master/src/Attributes/Connect.php)
* [Trace](https://github.com/presprog/kirby-route-attributes/blob/master/src/Attributes/Trace.php)

All these attributes share the same base `Route` attribute, which you also may use directly too:
* [Route](https://github.com/presprog/kirby-route-attributes/blob/master/src/Attributes/Route.php)

```php
// site/routes/my-awesome-route.php
<?php

use Kirby\Http\Response;
use PresProg\RouteAttributes\Attributes\Route;

return #[Route('/foo/(:all)', 'GET')] function ($all) {
    return new Response("<h1>$all</h1>", null, 200);
};
```

When developing in `debug` mode, the files will always be read from disk.
When`debug` is `false`, the loaded routes will be read once and then cached.
Make sure to clear the plugin cache after deployment, when you have made
changes to the routes.

****

## Installation

### Composer

```
composer require presprog/kirby-route-attributes
```

### Download

Download and copy this repository to `/site/plugins/route-attributes`.

### Git submodule

```
git submodule add https://github.com/presprog/kirby-route-attributes.git site/plugins/route-attributes
```

## License

MIT

## Credits

**Designed and built with ☕ and ❤ by [Present Progressive](https://www.presentprogressive.de)**

repository: presprog/kirby-route-attributes

repo_name: presprog/kirby-route-attributes


text:
# Assignment for Week 3: _Memory Types, Segments and Management_

MIT License

Copyright (c) 2020 J. Alexander Gómez G.

@date 2019-January-7

## Overview

This assignment is about learning:

- **Memory Organization**
- **Memory Segments**
- **Symbol tables**

# Content

- misc.h : Header file for misc.c . Contains 1 variable defined.
- misc.c :	Aid script. Contains a function and some definitions.
- main.c : Main script.
- msp432p401r.lds : Linker script for building the .out executable.
- Memory segments by definition.csv : Document that explains where is each symbol in memory and its attributes.

## Usage

Build the executable with the following command:

```
arm-none-eabi-gcc -o main.out main.c misc.c -Wl,-T msp432p401r.lds -Wl,-Map=main.map --specs=nosys.specs
```

This command creates:

- main.out :  The ELF executable for the MSP432.
- main.map : The map of the memory for analysis.

Optionally you can run the following command to get more information:

```
arm-none-eabi-objdump main.out -D > main_objdump.txt
arm-none-eabi-nm -pn main.out > main_nm.txt
```

## References for this part of the course

- [nm Binary Utility](https://sourceware.org/binutils/docs/binutils/nm.html)


text:
# newsmth_jobs
This project uses scrapy to crawl jobs' JD from newsmth(http://www.newsmth.net/nForum/board/Career_Upgrade)
All the info will be store into [elasticsearch](https://www.elastic.co/products/elasticsearch)

# How to run
```
cd newsmth_jobs
scrapy crawl -L INFO newsmth_crawler
```
Now I hard code that when the above cmd execute, 30 latest pages in http://www.newsmth.net/nForum/board/Career_Upgrade will be crawled, the crawled content includes job post_title/post_date/JD-content.

# Elasticsearch(2.x) config

[elasticsearch-py](http://elasticsearch-py.readthedocs.io/en/master/index.html) is used as es client. You can install it(version elasticsearch>=2.0.0,<3.0.0) via
```
pip install elasticsearch
```

[elasticsearch-analysis-ik](https://github.com/medcl/elasticsearch-analysis-ik) is used as Chinese Lucene analyzer. Follow [this](https://github.com/medcl/elasticsearch-analysis-ik#install) to install it.

You can edit "newsmth_jobs/pipelines.py" tp specify the es config


text:
mtarep
================================
A ruby webapp to collect and report mail server reputations, deliverability and rbl statistics. The UI is powered by [Sinatra](https://github.com/sinatra/sinatra/) and the backend is provided by [Redis](http://redis.io/). If you follow the installation steps outlined in this README, you should be up and running within 15 minutes.

Requirements
------------
* [Thin](https://github.com/macournoyer/thin/)
* [Sinatra](https://github.com/sinatra/sinatra/)
* [Redis Server](http://redis.io/)
* [Redis Ruby Client](https://github.com/redis/redis-rb)
* [Ruby Net/SSH](https://github.com/net-ssh/net-ssh)
* [Fully Functional Postfix Mail Servers](http://www.postfix.org/)

Overview
--------
The following data is collected and displayed for each postfix MTA you report on using mtarep:

* [Return Path Sender Score](https://www.senderscore.org/)
* [Microsoft Smart Network Data Services](https://postmaster.live.com/snds/)
* Postfix SMTP Rejections
* [Cloudmark CSI](http://www.cloudmark.com/en/products/cloudmark-sender-intelligence/how-it-works)
* [Brightmail Reputation Service](http://www.symantec.com/security_response/glossary/define.jsp?letter=b&word=brightmail-reputation-service)
* RBL/DNSBL Listings

All the data is collected and inserted into a redis data store whenever the collector completes a run. The collector (collector.rb) can be scheduled via cron. The sinatra webapp (app.rb) handles generating the HTML and retrieving the data from redis.

Please note that the Microsoft SNDS data is only available for the previous day. Everyday at 3am EDT a process begins that aggregates data for the previous day from across various systems at Windows Live Hotmail. Due to the vast volume of data handled this process can take a few hours, so data may not be available for a few hours after 3am EDT.

Web Interface
-------------
![Alt text](screenshots/mtarep-webui-example.png?raw=true)

When a provider block or rbl cell contains a listing, it becomes clickable. For provider blocks, when you click a block link a modal appears containing the most recent smtp rejection message from your server's maillog (location and access are configurable in the mtarep.yml file), as well details about the listing and a direct link to that provider's block removal form or instructions. The same scenario occurs for rbl listings but without the maillog info, as mtarep queries rbls directly via a dns lookup.

![Alt text](screenshots/mtarep-modal-example.png?raw=true)

Each issue modal contains an acknowledgement button that can be clicked once you begin working an mtarep reported issue. When the acknowledgement button is clicked, a unique key is inserted back into redis that holds basic details about the issue, including a timestamp and the mtarep authenticated http username. Once acknowledged, the acknowledgement button is replaced with a timestamp and the mtarep authenticated http username that acknowledged the issue. This prevents multiple users working the same issue unknowingly.

Each column header in the web interface allows for rows sorting (eg: sort by rbl listings, microsoft SNDS filtering or trap hits, hostname, etc..)

Rest Api
--------
Mtarep comes with a very basic REST api. I expect to add more functionality to the api as needed. At the moment, the api can only be queried for single host data.

For example, to get mtarep data for a public fqdn of 'mta-test1.domain.tld', you could do something like this:
```ruby
require 'rest-client'
require 'json'

response =<EMAIL_ADDRESS>data_hash = JSON.parse(response)

 => {"hostname"=>"mta-test1.domain.tld", "senderscore"=>"98", "sndscolor"=>"green", "sndstraps"=>"2", "brightmail"=>"good", "provblocks"=>"no blocks", "listings"=>"unlisted"}
```

A JSON blob of the requested public fqdn's mtarep data is returned.

Graphing
--------
![Alt text](screenshots/mtarep-graphs-example.png?raw=true)

To enable graphing you will need to configure a few things outside the scope of mtarep.

Sent, bounced, expired and feedback loop bar graphs can be configured for the domains of your choosing via the 'graph_domains' YAML array collection in the mtarep.yml configuration file. The graphing is provided by the [HighCharts JS API](http://www.highcharts.com/products/highcharts). Individual bar graphs can be removed from view by clicking each type of graph in the graphing legend.

Each individual bar graph is calculated from midnight on the current day and continues to be calculated until 11:59pm on that same day. The data used to calculate the sent, bounced, fbl and expired bar graphs is not *collected* by mtarep. However, bar graphs will be calculated and rendered by mtarep if the appropriate data exists in the same redis db used by mtarep.

The mtarep graphing code will search your mtarep redis backend for HINCRBY based keys in the format of:
```lua
mycompany:20140208:expired
mycompany:20140208:fbl
mycompany:20140208:bounced
mycompany:20140208:sent
```
*Where '20140208' is the current date and 'mycompany' is some type of identifier (perhaps your sending domain, company name or client name?)*

These redis keys should contain an incrementing total for each unique domain that has been sent, bounced, expired or feedback-loop received. The exact redis operation is [HINCRBY](http://redis.io/commands/hincrby).

Using the [redis-rb](https://github.com/redis/redis-rb) ruby client you could do something like this:
```ruby
require 'redis'

@redis = Redis.new(:host => 'your redis server')

key = ['mycompany']
key << Time.now.strftime("%Y%m%d")
key << 'bounced'

@redis.hincrby(key.join(':'), 'gmail.com', 1)
```
The above code would increment a counter for each bounced email to 'gmail.com' under the redis key 'mycompany:20140208:bounced'. This could be accomplished by creating a custom redis output plugin with [Logstash](https://github.com/logstash/logstash) to filter and ship this data directly from your postfix mail logs to either a pubsub broker like [RabbitMQ](https://www.rabbitmq.com/) or perhaps even directly to your redis datastore.

Configuration
-------------
Mtarep comes with example configuration files for rackup (config.ru), thin (thin.yml) and mtarep itself (mtarep.yml). Please copy the example configs without the '.example' appendage and adjust each config according to your environment.

The individual mtarep.yml configuration file settings are as follows:

***error_log:***

   The absolute path to your main mtarep error log file. All directories in the path must already exist. If the error log file does not exist, it will be created.

***redis_server:***

   The DNS resolvable hostname of your redis server. Your redis server will be accessed over the default port of 6379 and the primary 'db0' database. Currently non standard ports and multiple redis databases are not supported.

***snds_key:***

   Your organization's microsoft [Smart Network Data Services](https://postmaster.live.com/snds/) data access key. If you do not use microsoft SNDS, you should signup immediately. There is a wealth of info regarding your inbox placement.

***maillog_path:***

   The absolute path to your current postfix mail log file on each postfix MTA that you are using mtarep to report major provider rejections/blocks for. Currently only postfix log formats are supported.

***ssh_key:***

   The absolute path to the ssh key file (on the server running mtarep) you want to use to access your remote postfix MTA mail logs with. The ssh key you provide here must have permissions to the remote 'maillog_path' specified above, and for the 'ssh_user' you specify below.

***ssh_user:***

   The ssh username associated with the 'ssh_key' you specified above.

***http_auth_file:***

   The absolute path to your mtarep app's http authentication file. This is used for authentcating login access credentials (username/password) to the mtarep web interface.

   The format of this file must be:
   ```lua
   username:{SHA}ME2JP/+546KPSPZQxQirw0qkUsQRyYWM=
   ```
   Currently only a SHA1 base64 digest is supported (```Digest::SHA1.base64digest('password')```).

***mta_map:***

   This setting can contain either a YAML array collection or a YAML hash collection.

   A YAML array collection is used when you want mtarep to use the same fqdn/hostname to lookup public fqdn/hostname/ip reputation data as well as the fqdn/hostname to ssh to for mail log parsing (ESP and ISP (provider) SMTP rejection log entries). Do not use this type of map if you ssh to your MTAs using a different fqdn/hostname or host alias from it's public mail fqdn/hostname.

   The YAML hash collection support for this configuration setting should be used if you ssh to your MTAs using an internal hostname or alias that is different from the host's public fqdn hostname.

   For example, if you have an MTA with a public HELO hostname of mta1.mydomain.com and you also access the MTA with ssh using that same hostname, then you want to use a YAML array collection here. If you have an MTA with a public HELO hostname of mta1.mydomain.com but you ssh to the MTA using the shortname 'mta1', then you want to use a YAML hash collection here (mta1: 'mta1.mydomain.com', etc..).

***graph_domains:*** (optional)

   The domains that you want mtarep to render sent, bounced, feedback-loop and expired bat graph totals for.

***rbls:***

   A YAML array collection of RBL/DNSBL's you want mtarep to check your MTA public IP addresses against. The format of these must be the RBL hostnames that are queried for listings (eg: bl.spamcop.net)

***provider_block_strings:***

   A YAML hash collection of external email provider names (the key) and a string (the value) that indicates a provider is blocking your MTA. These key/values are used by mtarep to search your remote MTA mail logs for particular rejection text patterns. The values for these are regular expressions. The rejection patterns for several major email providers are already included in the mtarep.yml.example file.

***removal_links:***

   A YAML hash collection of external email provider names and rbl lists (the key) and a corresponding URL (the value) to that provider or rbl's listing info and/or removal form.

***assistance_links:*** (optional)

   A YAML hash collection of any custom documentation you maintain that outlines steps your organization has for resolving a specific mtarep reported issue. These links are used in the modal of a clicked issue in mtarep.

Installation
------------
- git clone https://github.com/phantasm66/mtarep.git
- create config.ru, thin.yml and mtarep.yml configs from included example configs
- start the thin web server
- check the specified mtarep *error_log* location for any errors
- run mtarep/collector.rb manually to test your mtarep.yml (errors display on stderr)
- cron mtarep/collector.rb to run every 15 minutes (additional details below)
- go to http://hostname:port (according to your thin.yml config file)

Data Collection Schedule
------------------------
You may need to adjust your cron scheduling interval for mtarep/collector.rb according to the amount of data you want mtarep to collect, the number and size of your MTA maillogs, etc. Before you schedule the cron, it might be wise to do a manual collection run with your production mtarep.yml and time it. However, if collector runs *do* overlap, the collector will safely terminate previously running collector processes. This prevents cascading collection runs, collisions, etc.


text:
---
type: mina
title: 5.3 - Compression Filter
navPrev: ch5.2-buffered-write-filter.html
navPrevText: 5.2 - Buffered Write Filter
navUp: ch5-filters.html
navUpText: Chapter 5 - Filters
navNext: ch5.4-connection-throttle-filter.html
navNextText: 5.4 - Connection Throttle Filter
---

# 5.3 - Compression Filter

The _CompressionFilter_ class is used to compress data before it gets sent and decompress it when it's received. It uses the [JZLIB library](http://www.jcraft.com/jzlib/).

It only handles two events :

* _messageReceived_: The received message will be decompressed, if it's contained in a _IoBuffer_.
* _filterWrite_: The message to write will be compressed, assuming it's stored in a _IoBuffer_ (otherwise an exception will be generated).

## Configuration

It's possible to configure the _CompressionFilter_, with the listed parameters :

* _compressInbound_: if set to _true_, the incoming data will be decompressed, otherwise they will be left intact.
* _compressOutbound_: if set to _true_, the outgoing data will be compressed, otherwise they will be ignored.
* _compressionLevel_: one of _COMPRESSION_DEFAULT_ (-1), _COMPRESSION_MAX_ (9), _COMPRESSION_MIN_ (1), _COMPRESSION_NONE_ (0). Sets the level, of desired compression.

There is one more parameter that can be used, injected into the session's attributes, the _DISABLE_COMPRESSION_ONCE_ flag. If present in the session's attributes, the first compression will be ignored (this is probably useful for application that needs to send a message that the flowing messages are going to be compressed).

## Initialization

When the filter is added to the chain, instances of the deflater and inflater are created and injected into the session's attributes. This could change, as each session has its own instance of the filter in its chain, so there is no reason not to store those instances in the filter itself.

## Side notes

The way this filter works does not make it very efficient. It requires that the received data to be decompressed are fully read - and there are no control that it's the case of not -, and it also requires that the data to be compressed be fully compressed in one pass, which is quite inefficient from the memory perspective, as we may compress data by blocks, and send them immediately, waiting for the block to be really sent to compress the next one.

One more thing: there is no way this filter can be used to compress something like a file or anything that is not contained in a _IoFilter_. This is a pretty strong limitation.

All in all, it's a brittle filter, you'd better not use it as it is!

## Future improvements

So we need a compression filter that does not eat all the memory, possibly a stateless one - why should we have to create as many instances as we have sessions ? -, that is fast, AL 2.0 compatible, and that can flush data pieces by pieces.

### Stateless compression/decompression

The idea is to have a function that can be called statically, with a context. It's not necessarily complex  we just need to keep track of a context.

It should be possible top compress a block of data, send it, and process the next block when the first block has been processed. Same thing with received data: it should be possible to process a buffer, decompress it and wait for the remaining bytes until a block of data has been fully decompressed.

repository: apache/mina-site

repo_name: apache/mina-site


text:
# Verify Releases

To verify the release, you can check @wbobeirne's signature against the sha256 manifest file. First import the public key:

```sh
curl https://raw.githubusercontent.com/joule-labs/joule-extension/master/keys/wbobeirne.asc | gpg --import
```

Download the manifest and sig file and verify it:

```sh
gpg --verify manifest-[version].wbobeirne.sig manifest-[version].txt
```

Now that we have a verified manifest, we'll verify the contents of the zip file. Download and unzip the zip file, and run `sha256sum -c` against the manifest.

```sh
cd joule-[version]
sha256sum -c ../manifest-[version].txt --ignore-missing
```

You should see a series of files and `OK` next to them if the hashes match.

## Build & verify with docker

You can also build your own release and manifest with `yarn build:docker`, then verify the sha256sums using the `manifest.txt` file in `docker-dist/manifest.txt`

repository: joule-labs/joule-extension

branch_name: refs/heads/develop

gha_language: TypeScript

repo_name: joule-labs/joule-extension


text:
## Compiled HTML Docs
The generated API document, presented as a CHM file, is available here: [ApiRefXNACC.chm](Object Reference_ApiRefXNACC.chm).
**Note:** This file may not display correctly if you open it directly from this site.  Better to save it to a known location and then try to launch it.  If all the HTML Help viewer shows are browser-related errors (e.g. navigation canceled, etc.), close the file, raise its Properties in Explorer and _unblock_ it.

## Web Site Docs
There is also a navigable web site for the docs, available in this archive:  [ApiRefXNACC.zip](Object Reference_ApiRefXNACC.zip).
Note that the HTML pages appear to require I.E. to work correctly. Chrome, as an example, does not work well with the pages.  I have not tested with other browsers.

license: MS-PL

repository: jtwine/XNA-Command-Console

path: /docs/Object Reference.md

filename: Object Reference.md

repo_name: jtwine/XNA-Command-Console


text:
## FUSE :o:

|          |              |
| -------- | ------------ |
| title    | FUSE         |
| status   | 10           |
| section  | File systems |
| keywords | File systems |

FUSE (Filesystem in Userspace)

> ``is an interface for userspace programs to export a filesystem to
> the Linux kernel'' [@www-fuse].

The FUSE project consists of two components:
the fuse kernel module and the libfuse userspace library. libfuse
provides the reference implementation for communicating with the FUSE
kernel module.The code for FUSE itself is in the kernel, but the
filesystem is in userspace.  As per a 2006 paper on HPTFS which has
been built on top of FUSE [@fuse-paper-hptfs]. It mounts a tape as
normal file system based data storage and provides file system
interfaces directly to the application.  Another implementation of
FUSE FS is CloudBB [@fuse-paper-CloudBB]. Unlike conventional
filesystems CloudBB creates an on-demand two-level hierarchical
storage system and caches popular files to accelerate I/O
performance. On evaluating performance of real data-intensive HPC
applications in Amazon EC2/S3, results show CloudBB improves
performance by up to 28.7 times while reducing cost by up to 94.7\%
compared to the ones without CloudBB.

Some more implementation examples of FUSE are - mp3fs (A VFS to
convert FLAC files to MP3 files instantly), Copy-FUSE (To access cloud
storage on Copy.com), mtpfs (To mount MTP devices) etc.


text:
Python
======

To use Snap's Python functions, add the following to your `.bashrc`:

    export PYTHONPATH=/path/to/snap2/snap-python
    alias snap='PYTHONSTARTUP=/path/to/snap2/snap-python/bootstrap.py python'

You can then access the functions anywhere:

    $ python
    >>> from wikinet import find
    >>> wikinet.find('Ajaigarh')
    set([Article(title='Ajaigarh', redirect=None, summary='Ajaigarh or Adjygurh is a town and a nagar panchayat in the Panna District of Madhya Pradesh state in central India.\n')])

Or, start a Python console with the functions already boostrapped:

    $ snap
    >>> find('Ajaigarh')
    set([Article(title='Ajaigarh', redirect=None, summary='Ajaigarh or Adjygurh is a town and a nagar panchayat in the Panna District of Madhya Pradesh state in central India.\n')])

gha_language: Java


text:
Change Log
==========

Version 3.1
-----------
Code Cleanup & Formatting
Removed trailing ?>'s

Version 3.0
-----------

Fixed bug that prevented request retries from operating correctly.
Added capability to enable verbose output and/or progress output.
Added debug output capability.

Version 2.4
-----------

Removed WSSDK_REQUEST_RETRY_ON_ERROR_DELAY from config_sample.php and set the retry delay
    to double the expected delay per retry attempt.

Version 2.3
-----------

Fixed bug where sleep was for seconds rather than microseconds.

Version 2.2
-----------

Added cURL option to prevent HTTP 100 responses
Improved memory efficiency
Added warm-up scaling logic to retry requests

Version 2.1
-----------

Added warm-up scaling feature to reduce connection errors when making high volumes of
	requests. By default, an initial 1000 requests per minute are allowed, doubling
	every 7 minutes until the Max Requests Per Minute is reached.

Version 2.0
-----------

Rearchitected for multi-threaded requests.
Changes to config_sample.php are not backwards compatable. Update your config.php file.
Code written for Version 1.X is not compatable with 2.0, and must be ported.

repository: DavidLiedle/wsapi-sdk-php

repo_name: DavidLiedle/wsapi-sdk-php


text:
---
title: Learning Terraform
layout: post
use_toc: true
excerpt: Here I collected information which was helpful for me to learn about Terraform
---

### References
  - Books:Getting started with Terraform 2nd edition(Packt)
  - [Terraform guides](https://github.com/hashicorp/terraform-guides)
  - [Create reusable infrastructure](https://medium.com/faun/creating-reusable-infrastructure-with-terraform-on-gcp-e17745ac4ff2)
  - Automating Terraform deploys with Gitlab pipeline
      - https://medium.com/@timhberry/terraform-pipelines-in-gitlab-415b9d842596
      - https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow
  - [gloud Cheat Sheet](https://gist.github.com/pydevops/cffbd3c694d599c6ca18342d3625af97#other-cheatsheets)

### Vocabulary
   - Software as a Service (SaaS)
   - Infrastructure as Code (IaC)

### Structure
- *terraform\modules*
    * gcp
        - `backend.tf` – Remote State(before we need to have Google Cloud Storage: ```gsutil mb -c regional -l europe-west1 gs://<your-project-id>-tfstate```)
        - `main.tf` – for the connection to GCP.
        - `kubernetes.tf` – for the configuration defining the characteristics of the Kubernetes cluster I’m working toward getting built.
        - `terraform.tfvars` – for assigning variables created in variables.tf.
        - `variables.tf` – for declaring and adding doc/descriptions for the variables I use.

### k8s Cluster role
```yaml
	provider "kubernetes" {}

	resource "kubernetes_cluster_role_binding" "service-default-experimental" {
	  metadata {
	    name = "service-default-experimental"
	  }
	  role_ref {
	    api_group = "rbac.authorization.k8s.io"
	    kind = "ClusterRole"
	    name = "cluster-admin"
	  }
	  subject {
	    kind      = "ServiceAccount"
	    name      = "default"
	    namespace = "default"
	  }
	}
```
### Deploy dev/prod environments:
1. terraform workspace new dev
2. terraform workspace select (dev/prod)
3. terraform plan -var-file="dev.tfvars" -out=dev.out
4. terraform apply "dev.out"


text:
---
type: rule
title: Do you check the calendar when planning an event?
uri: check-the-calendar-when-planning-an-event
authors:
  - title: Camilla Rosa Silva
    url: https://www.ssw.com.au/people/cammy
related: []
redirects:
  - do-you-check-the-calendar-when-planning-an-event
created: 2014-10-20T00:50:45.000Z
archivedreason: null
guid: 2bb22444-cfa0-45bc-840b-d8c18dabf875
---

When planning an event, everything revolves around the date so it’s vital to be sure there are no potential clashes or conflicts. We recommend using [a SharePoint calendar](http://www.ssw.com.au/ssw/Events/Events.aspx), to let employees and the public keep up to date with what your organisation is holding or attending. It is best to have more than 1 date in mind for your event when you start planning, as this affords you flexibility if your first choice of date won’t work out.

Be sure to check the dates and times of other events happening for that day. Depending on your event, it might also be worth looking for events on either side of your date, in case one of the events will be especially exhausting or costly, as this is likely to make people less interested in attending a second event right away.

<!--endintro-->

gha_language: TSQL


text:
---
title: "At Scope Exit: Generic Scoped Resource Management in C++"
date: June 30, 2015
---
# AT_SCOPE_EXIT: Generic Scoped Resource Management in C++11 #

C++ has long used scoped resource managers, where a resource (e.g., pointer or mutex) is encapsulated in an object. The object
creates or accepts the resource in the constructor and releases it in the destructor, creating a (nearly) foolproof way of making
sure that all resources are managed properly.

Perhaps the best example is the standard library [unique_ptr](http://en.cppreference.com/w/cpp/memory/unique_ptr) Given
a pointer, it will manage the pointer during the scope it is in. The following example from cppreference.com shows how it works:

```
#include <iostream>
#include <memory>

struct Foo
{
    Foo()      { std::cout << "Foo::Foo\n";  }
    ~Foo()     { std::cout << "Foo::~Foo\n"; }
    void bar() { std::cout << "Foo::bar\n";  }
};

void f(const Foo &)
{
    std::cout << "f(const Foo&)\n";
}

int main()
{
    std::unique_ptr<Foo> p1(new Foo);  // p1 owns Foo
    if (p1) p1->bar();

    {
        std::unique_ptr<Foo> p2(std::move(p1));  // now p2 owns Foo
        f(*p2);

        p1 = std::move(p2);  // ownership returns to p1
        std::cout << "destroying p2...\n";
    }

    if (p1) p1->bar();

    // Foo instance is destroyed when p1 goes out of scope
}
```

The nice thing is that it provides a single point of management for the pointer no matter the exit of the scope, whether by return
or exception.

What if we could do that for any resource? Have a database connection, and want to release it after exiting the function? How about
a file or a 3rd party library network connection? (Many libraries come with such scoped resource managers, but still...).

C++11 now has lambdas, making it easy to create arbitrary scoped managers. Here is an example of a small one for Windows file
handling:

```
...

hr srcFile = CreateFile2(src, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL);
if (srcFile == INVALID_HANDLE_VALUE)
{
    // handle error
}
AT_SCOPE_EXIT({
    CloseHandle(srcFile);
});

...
```

This ensures that `srcFile` will be closed no matter how the function exits, and I didn't have to write a custom class.

`AT_SCOPE_EXIT` is defined as a class with a single `std::function<void()>` member. Then a convenience macro wraps it so that the
function body can simply be included:

```
struct at_scope_exit
{
    std::function < void() > at_exit_;

    at_scope_exit(std::function< void() > at_exit)
        : at_exit_(at_exit)
    {
    }

    ~at_scope_exit()
    {
        try {
            at_exit_();
        }
        catch(...) {}
    }
};

#define AT_SCOPE_EXIT_CAT(x,y)  x##y
#define AT_SCOPE_EXIT_ID(index) AT_SCOPE_EXIT_CAT(at_scope_exit, index)
#define AT_SCOPE_EXIT(expr) at_scope_exit AT_SCOPE_EXIT_ID(__LINE__), ([&] () { expr; } );
```

I've found this immensely useful for such a small snippet. Hope you find it useful too.

Just to cover the legal side of things, *the AT_SCOPE_EXIT macro and attendant code is licensed under the WTF 1.0 license.*

license: Unlicense

repository: icosahedron/flagrantsystemerror

repo_name: icosahedron/flagrantsystemerror


text:
---
layout: docs
title: Command Line Interface
prev_section: installation
next_section: cli/installation
permalink: /docs/cli/home/
---

Scaland CLI module allows to create command line applications easily.

Let's have an easy tour.

Add this to your build.sbt file:

{% highlight scala %}
resolvers += "alanrodas" at "https://alanrodas.com/maven/releases/"

libraryDependencies += "com.alanrodas" %% "scaland-cli" % "0.1"
{% endhighlight %}

Now, follow the following steps:

1. Import `com.alanrodas.scaland.cli._`
2. Import `import language.postfixOps`
3. Create an object extending `CLIApp`

You are all set, create your commands.

{% highlight scala %}
import com.alanrodas.scaland.cli._
import language.postfixOps

object MainApp extends CLIApp {
	root accepts (
		flag named "verbose" alias "v",
		flag named "quiet" alias "q",
		flag named "dry-run",
		flag named "force" alias "f",
		arg named "repo" taking 1 value,
		arg named "recurse-submodules" taking 1 as "check",
		arg named "exec" taking 2 values
	) receives (
		value named "target" mandatory,
		value named "branch" as "master"
	) does { commandCall =>
		dump(commandCall)
	}
	command named "add" accepts (
		flag named "quiet" alias "q",
		flag named "dry-run" alias "n",
		flag named "force" alias "f",
		flag named "intent-to-add",
		flag named "all" alias "A"
	) minimumOf 1 does { commandCall =>
		dump(commandCall)
	}
}
{% endhighlight %}

Now you can call your application as

{% highlight bash %}
~ $ sbt "run theOrigin --verbose -f"
Called command: <root>
Values are: (2)
target: (User defined) theOrigin
branch: (Default) master
Flags Are: (4)
--verbose -v: (Passed)
--force -f: (Passed)
--quiet -q: (Not Passed)
--dry-run : (Not Passed)
Arguments are: (3)
--repo : (Default) None
--recurse-submodules : (Default) check
--exec : (Default) None
{% endhighlight %}

or as

{% highlight bash %}
~ $ sbt "run add theOrigin -f"
Called command: add
Values are: (1)
theOrigin
Flags Are: (5)
--quiet -q: (Not Passed)
--intent-to-add : (Not Passed)
--all -A: (Not Passed)
--dry-run -n: (Not Passed)
--force -f: (Passed)
Arguments are: (0)
{% endhighlight %}

Check the [Usage](/docs/usage) to learn more about how to use it.

repository: alanrodas/scaland

repo_name: alanrodas/scaland


text:
---
layout: project
type: project
image: images/hobnob.jpg
title: Hobnob.io
permalink: projects/hobnob
date: 2015
labels:
  - Ruby on Rails
  - Elixir
  - React
  - Twilio
summary: Create party invities for your guests and send them via text message
---

Hobnob is an event invitations app for iOS and Android. Hosts will enter in their event details (name, date/time, and location) and then select a design for their invite. After that, the host will select guests from their phone contacts and any other details. The invites are then sent out via text message. Guests receive the flyer design along with a link to view the event's details on the web. To RSVP for the event, guests can either go to the event's web page or respond directly using SMS. Guests who also have the app will be able to view the event details within the app and chat guests or the hosts.

I have been a software engineer at Hobnob since November, 2015. Since then, we created a new web invite frontend using React.js, which takes advantage of several modern frontend techniques including server side rendering and client side routing. We have also built numerous features on the main API web server, including the ability to send invites to email addresses and adding cohosts. We also built a chat messaging service built on Elixir and Phoenix. Since Elixir runs on the battle-tested Erlang VM, it is able to handle the amount of traffic we get on the service.

You can learn more at [Hobnob](http://hobnob.io).

repository: keokilee/techfolio

repo_name: keokilee/techfolio