File Upload Vulnerability Accessment

We've seen various different types of filter now -- both client side and server side -- as well as the general methodology for file upload attacks. In the next task you're going to be given a black-box file upload challenge to complete, so let's take the opportunity to discuss an example methodology for approaching this kind of challenge in a little more depth. You may develop your own alternative to this method, however, if you're new to this kind of attack, you may find the following informati

2349. Design a Number Container System

Design a number container system that can do the following: Insert or Replace a number at the given index in the system. Return the smallest index for the given number in the system. Implement the NumberContainers class: NumberContainers() Initializes the number container system. void change(int index, int number) Fills the container at index with the number. If there is already a number at that index, replace it. int find(int number) Returns the smallest index for the given number, or -1 if there is no index that is filled by number in the system.
// Constructor for NumberContainers class
var NumberContainers = function() {
    // Map to store the relationship between index and number
    this.indexMap = new Map();
    // Map to store the relationship between number and MinHeap of indices
    this.numberMap = new Map();
};

/** 
 * Change the number at a specific index
 * @param {number} index 
 * @param {number} number
 * @return {void}
 */
NumberContainers.prototype.change = function(index, number) {
    // If the index already maps to 

Async/Await Tricks

/*
@url https://levelup.gitconnected.com/7-simple-async-await-tricks-for-developers-who-hate-asynchronous-javascript-fe370ac7fe72
*/

// 1. Use Promise.allSettled() for Safer Batch Processing
const results = await Promise.allSettled([
  fetchData1(),
  fetchData2(),
  fetchData3(),
]);
results.forEach(result => {
  if (result.status === 'fulfilled') {
    console.log('Success:', result.value);
  } else {
    console.error('Failed:', result.reason);
  }
});


// 2. Use Timeouts to Prevent Hanging

vpn

# shadowsocksr-cli

https://github.com/TyrantLucifer/ssr-command-client/tree/master

## doc  

https://github.com/TyrantLucifer/ssr-command-client/blob/master/README_CH.md

## usage 

```
shadowsocksr-cli --setting-url <subscribe_url>

# 更新订阅
shadowsocksr-cli -u

# 打印节点列表
shadowsocksr-cli -l

# 开启 socks5 代理
shadowsocksr-cli -s <id>

# 转换为 http 代理
shadowsocksr-cli -p 1080 --http start --http-proxy-port 7890

# 快捷命令
alias setproxy="export ALL_PROXY=socks5://127.0.0.1:1080"
alias unsetproxy="unset 

3160. Find the Number of Distinct Colors Among the Balls

You are given an integer limit and a 2D array queries of size n x 2. There are limit + 1 balls with distinct labels in the range [0, limit]. Initially, all balls are uncolored. For every query in queries that is of the form [x, y], you mark ball x with the color y. After each query, you need to find the number of distinct colors among the balls. Return an array result of length n, where result[i] denotes the number of distinct colors after ith query. Note that when answering a query, lack of a color will not be considered as a color.
/**
 * @param {number} limit
 * @param {number[][]} queries
 * @return {number[]}
 */
var queryResults = function(limit, queries) {
     // Map to store the color of each ball
    const ballColors = new Map();
    // Map to store the frequency of each color
    const colorFreqs = new Map();
    // Array to store the result for each query
    const result = new Array(queries.length);

    // Process each query
    for (let i = 0; i < queries.length; ++i) {
        const [ball, color] = queries[i]

Deferred payment / cart vaulting / pre-order

Cards vaulting and deferred payment: https://preproduct.io/tag/deferred-payment/

CM Client Reinstall

function Invoke-CMClientReinstall {
    [CmdletBinding()]
    param(
        $SMSMP
        ,
        $SMSSITECODE
    )
    #region Get variables for reinstall
        if (!$SMSMP -or !$SMSSITECODE) {
            $SMS_Authority = Get-CimInstance -Namespace root\ccm -Class SMS_Authority -ErrorAction SilentlyContinue
            if ($SMS_Authority -isnot [Microsoft.Management.Infrastructure.CimInstance]) {
                Write-Host "WMI class not found. (SMS_Authority)"
             

HTML 5: Restricted datalist

<!DOCTYPE html>
<html lang="cs">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Výběr s Datalist</title>
  <script>
    function validateInput(input) {
      const datalist = document.getElementById('fruit-list');
      const options = datalist.getElementsByTagName('option');
      const values = Array.from(options).map(option => option.value);

      if (!values.includes(input.value)) {
        input.value = ''; // 

HTML 5 - role

@link https://www.w3.org/TR/wai-aria-1.1/#role_definitions

banner: Hlavní záhlaví stránky.
complementary: Doplňkový obsah.
contentinfo: Informace o obsahu stránky (patička).
main: Hlavní obsah stránky.
navigation: Navigace.
search: Vyhledávací formulář.
article: Samostatný článek nebo příspěvek.
region: Oblast obsahu, která má svůj vlastní význam.
alert: Důležité zprávy nebo upozornění.
dialog: Dialogové okno.
button: Tlačítko.
link: Odkaz.
form: Formulář.
tab: Karta v kartách.
tabpanel: Obsah 

要素の高さ合わせ

/*!--------------------------------------------------------------------------*
* 要素の高さ合わせ
*--------------------------------------------------------------------------*/
function setEqualHeight() {
  var maxHeight = 0;
  
  // スマホ時は高さ調整を無効にする
  if ($(window).width() <= 768) {
    $('.js--adjust_eight').css('height', 'auto'); // 高さリセット
    return; // 処理を終了
  }

  // 一旦高さをリセットして再計算
  $('.js--adjust_eight').css('height', 'auto');

  // 各要素の高さを比較して最大値を取得
  $('.js--adjust_eight').each(f

Transformace (transform) does not change flow

	<div>
		<figure>
				<img src="http://picsum.photos/400/400?grayscale" alt="">
			<figcaption>
				Nakej popis
			</figcaption>
		</figure>
		
		
	</div>

Pipeline operator

/* https://medium.com/@asierr/javascripts-pipeline-operator-the-game-changer-for-cleaner-code-e9eb46179510 */

const first = (x) => x + 1 
const second = (x) => x + 2 
const last = (x) => x + 1000 


const x = 0

const result = first(second(last(x)))
const result2 = x |> increment |> square |> double;


console.log(result)
console.log(result2)



/* examples */

// before
fetch('/api/data')
  .then(response => response.json())
  .then(data => transformData(data))
  .then(

スクロールバーを非表示

参考サイト:[【CSS】スクロールバーを非表示にする方法](https://recooord.org/overflow-hide-scrollbar/)
.hoge {
  -ms-overflow-style: none;
  scrollbar-width: none;
  
  &::-webkit-scrollbar{
    display:none;
  }
}

数値Aから数値Bまでのインクリメントをループさせる

const loop = 3
let count = 0;

const loopIncriment = function(){
  count = (count % loop) + 1;
}

Permutation in String

https://leetcode.com/problems/permutation-in-string/
class Solution {
    public boolean checkInclusion(String s1, String s2) {
        if (s1.length() > s2.length()) {
            return false;
        }

        int[] s1Count = new int[26];
        int[] windowCount = new int[26];

        // Count the frequency of characters in s1
        for (char c : s1.toCharArray()) {
            s1Count[c - 'a']++;
        }

        // Initialize the sliding window
        for (int i = 0; i < s1.length(); i++) {
            windowCount[s2.

1726. Tuple with Same Product

Given an array nums of distinct positive integers, return the number of tuples (a, b, c, d) such that a * b = c * d where a, b, c, and d are elements of nums, and a != b != c != d.
/**
 * @param {number[]} nums
 * @return {number}
 */
var tupleSameProduct = function(nums) {
     // Create a map to store the frequency of each product.
    let productMap = new Map();
    // Initialize the count of unique tuples.
    let count = 0;

    // Loop through each pair of numbers in the array.
    for (let i = 0; i < nums.length; i++) {
        for (let j = i + 1; j < nums.length; j++) {
            // Calculate the product of the current pair.
            let product = nums[i] * nu