护你周全

文章 评论 浏览 28

护你周全 2025-02-19 20:39:47

谢谢大家,我只是发现问题是我无法在Create()之后立即链接Save(),这将调用Entity's Save()FN,而不是EntityManager的save(),然后开始新的交易。

async createPrice(dto, entityManager){
  //wrong code
  return entityManager.create(PriceEntity, {...}).save();

  //works
  const price = entityManager.create(PriceEntity, {...});
  return entityManager.save(price);
  }
}

Thanks everyone, I just found the problem is I can't chain the save() right after create() which will call the entity's save() fn instead of the entityManager's one, and start a new transaction.

async createPrice(dto, entityManager){
  //wrong code
  return entityManager.create(PriceEntity, {...}).save();

  //works
  const price = entityManager.create(PriceEntity, {...});
  return entityManager.save(price);
  }
}

如何在Nestjs中使用Typeorm的Nestjs中使用交易

护你周全 2025-02-19 17:25:57

它们被标记为错误并过时,因为多年。

他们仍然起作用的是因为浏览器往往不会破坏网络并在多年内支持这些事情。但是,不应依靠这一点,因为支持随时可以消失,恕不另行通知。

检查此类事情的方式是使用数十年来一直存在的W3C工具:

w3c html html html a>

W3C CSS验证器

They are marked as errors and obsolete because they are obsolete and have been for many years.

That they still work is because browsers tend not to break the web and support such things for many years afterwards. However, one should not rely on this as support can disappear at any time without notice.

The way you check for such things is to use the W3C tools that have been around for decades:

W3C HTML Validator

W3C CSS Validator

从Internet Explorer切换到Edge时的样式问题

护你周全 2025-02-19 17:10:00

对于HTTPS,请尝试:

cd /path/to/repo
git remote set-url origin https://github.com/name/repo.git
                                                         ^^^
                                                    (no trailing ~/)

对于SSH:

cd /path/to/repo
git remote set-url origin [email protected]:name/repo.git

For HTTPS, try:

cd /path/to/repo
git remote set-url origin https://github.com/name/repo.git
                                                         ^^^
                                                    (no trailing ~/)

For SSH:

cd /path/to/repo
git remote set-url origin [email protected]:name/repo.git

git& GitHub:可以通过SSH或HTTPS推送或克隆,请求的URL返回错误400

护你周全 2025-02-19 11:46:18

erc-721 标准标准定义了 holderof()函数,将令牌ID作为输入参数。

它要么返回NFT持有人的地址,要么如果不存在令牌ID(即分配给地址零)。

const collection = new web3.eth.Contract(ABI, ADDRESS);
try {
    await collection.methods.ownerOf(tokenId).call();
    // exists
} catch (e) {
    // does not exist
}

The ERC-721 standard defines the ownerOf() function, accepting the token ID as an input param.

It either returns address of the NFT holder, or throws if the token ID does not exist (i.e. is assigned to address zero).

const collection = new web3.eth.Contract(ABI, ADDRESS);
try {
    await collection.methods.ownerOf(tokenId).call();
    // exists
} catch (e) {
    // does not exist
}

检查合同上给定的NFT ID是否已铸造

护你周全 2025-02-19 02:30:10

将您的“矛盾”检查与相关的“确认”检查结合在一起。例如,在测试包含数字的测试时,还要确保它们不是全部数字:

if( userPassword.Any(char.isDigit)
    && !userPassword.All(char.isDigit) )
{
    points += 5;
}
else /*if(userPassword.All(char.isDigit)*/ // if desired
{
    points -= 5; // if appropriate
}

现在让我们讨论重组您的算法。我们可以创建一个可以用来定义检查的类,而不是定义 的长链,而语句,

public class PasswordEvaluator
{
    public Func<string, bool> TestCondition { get; init set; }
    public int AffirmativeResultValue { get; init set; }
    public int NegativeResultValue { get; init set; }

    public int Evaluate(string password) =>
        TestCondition(password)
            ? AffirmativeResultValue 
            : NegativeResultValue ;
}

则可以定义测试。使用上述解决方案:

var hasDigitEvaluator = new PasswordEvaluator
{
    Condition = (string password) => password.Any(char.isDigit)
        && !password.All(char.isDigit),
    AffirmativeResultValue = 5,
    NegativeResultValue = -5, // or 0, whatever
};

然后,您可以使用此对象执行操作:

points += hasDigitEvaluator.Evalutate(userPassword);

现在,要处理多个评估器,您可以组合 iEnumerable&lt; passwordEvaluator&gt; ,然后在其上调用单个操作以获取您的聚合结果:

var passwordEvaluators = new[]
{
    new PasswordEvaluator { ... },
    new PasswordEvaluator { ... },
    ...
};

var points = passwordEvaluators
    .Select(test => test.Evaluate(userPassword))
    .Sum();

Combine your "contradiction" check with the relevant "affirmation" check. For example, when testing for containing a digit, also ensure they're not all digits:

if( userPassword.Any(char.isDigit)
    && !userPassword.All(char.isDigit) )
{
    points += 5;
}
else /*if(userPassword.All(char.isDigit)*/ // if desired
{
    points -= 5; // if appropriate
}

Now lets discuss restructuring your algorithm. Instead of defining long chains of if or if/else statements, let's create a class you can use to define your checks:

public class PasswordEvaluator
{
    public Func<string, bool> TestCondition { get; init set; }
    public int AffirmativeResultValue { get; init set; }
    public int NegativeResultValue { get; init set; }

    public int Evaluate(string password) =>
        TestCondition(password)
            ? AffirmativeResultValue 
            : NegativeResultValue ;
}

Then you can define your tests. Using the above solution:

var hasDigitEvaluator = new PasswordEvaluator
{
    Condition = (string password) => password.Any(char.isDigit)
        && !password.All(char.isDigit),
    AffirmativeResultValue = 5,
    NegativeResultValue = -5, // or 0, whatever
};

Then you can use this object to perform the operation:

points += hasDigitEvaluator.Evalutate(userPassword);

Now, to handle multiple evaluators, you can compose an IEnumerable<PasswordEvaluator> and then call a single operation over it to get your aggregate result:

var passwordEvaluators = new[]
{
    new PasswordEvaluator { ... },
    new PasswordEvaluator { ... },
    ...
};

var points = passwordEvaluators
    .Select(test => test.Evaluate(userPassword))
    .Sum();

如何使我的if陈述较少矛盾?

护你周全 2025-02-18 21:16:05

通过 组尝试:

=QUERY(A3:C6; 
 "select B,sum(C) 
  where A matches '.*Walmart.*' 
    and B='USA' 
  group by B 
  order by sum(C) desc 
  label sum(C) 'Kgs'"; 0)

try with group by:

=QUERY(A3:C6; 
 "select B,sum(C) 
  where A matches '.*Walmart.*' 
    and B='USA' 
  group by B 
  order by sum(C) desc 
  label sum(C) 'Kgs'"; 0)

在Gsheets中查询中与不同重复的关键字相对应的组值

护你周全 2025-02-18 20:16:44
df.set_index(['index', 'id'], inplace=True)
out = df[df.count(axis=1).eq(1)]
print(out)

counts = out.count().reset_index(name='unique_count').rename(columns={'index':'actions'})
print(counts)

输出:

            pass  shoot  flick  through-ball
index id
22450 123    NaN    NaN    NaN         600.0
22451 6565   NaN    NaN    NaN         625.0
22453 101    NaN    NaN  119.0           NaN

        actions  unique_count
0          pass             0
1         shoot             0
2         flick             1
3  through-ball             2
df.set_index(['index', 'id'], inplace=True)
out = df[df.count(axis=1).eq(1)]
print(out)

counts = out.count().reset_index(name='unique_count').rename(columns={'index':'actions'})
print(counts)

output:

            pass  shoot  flick  through-ball
index id
22450 123    NaN    NaN    NaN         600.0
22451 6565   NaN    NaN    NaN         625.0
22453 101    NaN    NaN  119.0           NaN

        actions  unique_count
0          pass             0
1         shoot             0
2         flick             1
3  through-ball             2

滤波行只有一个列中的一个具有值和创建列以在熊猫中附加记分卡

护你周全 2025-02-18 17:47:29

如果您的主要目标是对按钮产生悬停效果,则可以使用动画容器(效果)和墨水(inspherve)的组合(通知何时发生悬停的方法)

AnimatedContainer(
      height: 70,
      duration: Duration(milliseconds: 200),
      padding: EdgeInsets.only(
          top: (isHover) ? 25 : 30.0, bottom: !(isHover) ? 25 : 30),
      child: Container(
        height: 30,
        color: Colors.blue,
        child: InkWell(
          onTap: () {},
          child: Text("Hover Button"),
          onHover: (val) {
            print("Val--->{}$val");
            setState(() {
              isHover = val;
            });
          },
        ),

If your main goal is giving a hover effect on a button, you can use the combination of animated container(for the effect) and inkwell(onHover method to notify when hovering happens)

AnimatedContainer(
      height: 70,
      duration: Duration(milliseconds: 200),
      padding: EdgeInsets.only(
          top: (isHover) ? 25 : 30.0, bottom: !(isHover) ? 25 : 30),
      child: Container(
        height: 30,
        color: Colors.blue,
        child: InkWell(
          onTap: () {},
          child: Text("Hover Button"),
          onHover: (val) {
            print("Val--->{}$val");
            setState(() {
              isHover = val;
            });
          },
        ),

如何更改颤动中的小部件亮度?

护你周全 2025-02-18 13:16:26

product.js:

new Date()。toisostring() add replace> replace()更改为“:” 对接受的字符。

Windows OS不接受“:”

YouTube上的人使用Mac OS的

文件,例如

new Date()。toisostring()。替换(/:/:/G,' - ' )

in product.js:

After new Date().toISOString() add replace() to change ":" to an accepted character.

Windows OS doesn't accept files with a ":"

The person on Youtube is using MAC OS

E.g

new Date().toISOString().replace(/:/g, '-')

Inoent:没有这样的文件或目录。

护你周全 2025-02-18 03:50:45

您应该使用 accepts_nested_attributes_for 用户的方法
并尝试通过用户创建相关记录。

https://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods. html

或者您可以尝试一次自定义操作,以一次接受自定义表格,并同时使用多个记录。但是,第一个选项将更容易预测,并且更易于支持。

对于视图,您可以使用 Cocoon GEM。它很旧,但仍然有效。
或者,您可以通过它启发并制定自定义解决方案)
https://github.com/nathanvda/cocoon

You should use accepts_nested_attributes_for method for User
And try to create related records via User.

https://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html

Or you can try to make custom action for accepting custom form with multiple records at once. But first option will be more predictable and easier for supporting.

For views you can use cocoon gem. It's pretty old, but it still works good.
Or you can inspire by it and make your custom solution)
https://github.com/nathanvda/cocoon

用一个表单提交创建多个记录

护你周全 2025-02-18 02:51:26

您程序引发错误的原因是因为您的输入代码有两个项目(使用 fn ),但是您正在尝试将整个内容作为单个进行解析。 item 带有 syn :: parse2 行。这也解释了如果您删除使用 fn ,它也会说明为什么它可以工作。

如果您想要代码中的所有顶级项目,则可以从 file struct syn :: parse_file 返回:

fn main() {
    let code = "use std::result::Result;

fn init() {
}";

    let file = syn::parse_file(&code).unwrap();

    dbg!(file.items);
}
[src/main.rs:9] file.items = [
    Use(
        ItemUse {
            attrs: [],
            vis: Inherited,
            use_token: Use,
            leading_colon: None,
            tree: Path(
                UsePath {
                    ident: Ident {
                        sym: std,
                        span: bytes(5..8),
                    },
                    colon2_token: Colon2,
                    tree: Path(
                        UsePath {
                            ident: Ident {
                                sym: result,
                                span: bytes(10..16),
                            },
                            colon2_token: Colon2,
                            tree: Name(
                                UseName {
                                    ident: Ident {
                                        sym: Result,
                                        span: bytes(18..24),
                                    },
                                },
                            ),
                        },
                    ),
                },
            ),
            semi_token: Semi,
        },
    ),
    Fn(
        ItemFn {
            attrs: [],
            vis: Inherited,
            sig: Signature {
                constness: None,
                asyncness: None,
                unsafety: None,
                abi: None,
                fn_token: Fn,
                ident: Ident {
                    sym: init,
                    span: bytes(30..34),
                },
                generics: Generics {
                    lt_token: None,
                    params: [],
                    gt_token: None,
                    where_clause: None,
                },
                paren_token: Paren,
                inputs: [],
                variadic: None,
                output: Default,
            },
            block: Block {
                brace_token: Brace,
                stmts: [],
            },
        },
    ),
]

The reason your program throws an error is because your input code has two items (use and fn) but you're attempting to parse the whole thing as a single Item with the syn::parse2 line. This also explains why it works if you remove either the use or the fn.

If you want all the top level items in the code, you can already get that from the File struct that syn::parse_file returns:

fn main() {
    let code = "use std::result::Result;

fn init() {
}";

    let file = syn::parse_file(&code).unwrap();

    dbg!(file.items);
}
[src/main.rs:9] file.items = [
    Use(
        ItemUse {
            attrs: [],
            vis: Inherited,
            use_token: Use,
            leading_colon: None,
            tree: Path(
                UsePath {
                    ident: Ident {
                        sym: std,
                        span: bytes(5..8),
                    },
                    colon2_token: Colon2,
                    tree: Path(
                        UsePath {
                            ident: Ident {
                                sym: result,
                                span: bytes(10..16),
                            },
                            colon2_token: Colon2,
                            tree: Name(
                                UseName {
                                    ident: Ident {
                                        sym: Result,
                                        span: bytes(18..24),
                                    },
                                },
                            ),
                        },
                    ),
                },
            ),
            semi_token: Semi,
        },
    ),
    Fn(
        ItemFn {
            attrs: [],
            vis: Inherited,
            sig: Signature {
                constness: None,
                asyncness: None,
                unsafety: None,
                abi: None,
                fn_token: Fn,
                ident: Ident {
                    sym: init,
                    span: bytes(30..34),
                },
                generics: Generics {
                    lt_token: None,
                    params: [],
                    gt_token: None,
                    where_clause: None,
                },
                paren_token: Paren,
                inputs: [],
                variadic: None,
                output: Default,
            },
            block: Block {
                brace_token: Brace,
                stmts: [],
            },
        },
    ),
]

Playground

使用SYN :: PARSE2解析令牌流进行解析时出乎意料的令牌错误。2

护你周全 2025-02-18 01:13:53

计算 iacpower 后,您需要重新包装它,也就是说,将字节打包成字节并将其作为float包装:

>>> iacpower = 1130444800
>>> facpower, = struct.unpack('f', struct.pack('I', iacpower))
>>> facpower
225.21875

After you've computed iacpower you need to repack it, that is, pack int to bytes and unpack as a float:

>>> iacpower = 1130444800
>>> facpower, = struct.unpack('f', struct.pack('I', iacpower))
>>> facpower
225.21875

3个字节浮子值为Python float转换

护你周全 2025-02-17 03:31:15

您可以使用

pd.crosstab(df['region'], df['label']).plot.bar()

输出:

”在此处输入图像描述

InterMediate Crosstab

label     0  1
region        
region_A  2  3
region_B  3  3
region_C  5  4
region_D  3  6
region_E  1  0

You can use a crosstab:

pd.crosstab(df['region'], df['label']).plot.bar()

output:

enter image description here

intermediate crosstab:

label     0  1
region        
region_A  2  3
region_B  3  3
region_C  5  4
region_D  3  6
region_E  1  0

获取和图形组结果列的分布

护你周全 2025-02-16 17:11:03

您必须将字符串分配给电子邮件。调试创建JWT令牌的方法。这是我的方法:

import jwt from 'jsonwebtoken'
const generateJwtToken = (email:string): string => {
    const token = jwt.sign({ email: email }, jwtKey)
    return token
}

You have to assign string to the email. Debug the method that creates jwt token. Here is my method:

import jwt from 'jsonwebtoken'
const generateJwtToken = (email:string): string => {
    const token = jwt.sign({ email: email }, jwtKey)
    return token
}

jwt.verify(token,process.env.access_token_secret,function(err,解码)未正确解码

护你周全 2025-02-16 07:46:19

您唯一的真正问题是尴尬字段,数组和字符串都从1开始,而不是0,因此您的循环应该以1的速度开始,而不是0。作为第一次写入您的循环打印$ i 。正在执行打印$ 0

话虽如此,我认为您想要的是以下其他事情,而其他几件事都弥补了:

$ cat tst.awk
BEGIN { FS=OFS="/" }    
sub(/^raw$/,RS,$6) && sub(OFS RS,"") {
    $3 = "raw.githubusercontent.com"
    print
}

$ awk -f tst.awk urls.txt
https://raw.githubusercontent.com/2RDLive/Pi-Hole/master/Blacklist.txt
https://raw.githubusercontent.com/34730/asd/master/adaway-export
https://raw.githubusercontent.com/568475513/secret_domain/master/filter.txt
https://raw.githubusercontent.com/BlackJack8/iOSAdblockList/master/Regular%20Hosts.txt
https://raw.githubusercontent.com/CipherOps/MiscHostsFiles/master/MiscAdTrackingHostBlock.txt
https://raw.githubusercontent.com/DK-255/Pi-hole-list-1/main/Ads-Blocklist
https://raw.githubusercontent.com/DRSDavidSoft/additional-hosts/master/domains/blacklist/adservers-and-trackers.txt
https://raw.githubusercontent.com/DRSDavidSoft/additional-hosts/master/domains/blacklist/unwanted-iranian.txt
https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareHosts.txt
https://raw.githubusercontent.com/DavidTai780/AdGuard-Home-Private-Rules/master/hosts.txt
https://raw.githubusercontent.com/DivineEngine/Profiles/master/Quantumult/Filter/Guard/Advertising.list
https://raw.githubusercontent.com/Hariharann8175/Indicators-of-Compromise-IOC-/master/Ransomware%20URL's
https://raw.githubusercontent.com/JumbomanXDA/host/main/hosts
https://raw.githubusercontent.com/Kees1958/W3C_annual_most_used_survey_blocklist/master/EU_US%2Bmost_used_ad_and_tracking_networks
https://raw.githubusercontent.com/KurzGedanke/kurzBlock/master/kurzBlock.txt
https://raw.githubusercontent.com/MajkiIT/polish-ads-filter/master/polish-adblock-filters/adblock.txt
https://raw.githubusercontent.com/MitaZ/Better_Filter/master/Quantumult_X/Filter.list
https://raw.githubusercontent.com/MrWaste/Ad-BlockList-2019-08-31/master/Pi-Hole%20BackUps/Black%20List/All%20Server%20Black%20List
https://raw.githubusercontent.com/Neo23x0/signature-base/master/iocs/c2-iocs.txt
https://raw.githubusercontent.com/Pentanium/ABClientFilters/master/ko/korean.txt
https://raw.githubusercontent.com/Phentora/AdguardPersonalList/master/blocklist.txt
https://raw.githubusercontent.com/ShadowWhisperer/BlockLists/master/Lists/Malware
https://raw.githubusercontent.com/SlashArash/adblockfa/master/adblockfa.txt
https://raw.githubusercontent.com/SukkaW/Surge/master/List/domainset/reject_sukka.conf
https://raw.githubusercontent.com/Th3M3/blocklists/master/tracking%26ads.list
https://raw.githubusercontent.com/TonyRL/blocklist/master/hosts
https://raw.githubusercontent.com/UnbendableStraw/samsungnosnooping/master/README.md
https://raw.githubusercontent.com/UnluckyLuke/BlockUnderRadarJunk/master/blockunderradarjunk-list.txt
https://raw.githubusercontent.com/VernonStow/Filterlist/master/Filterlist.txt
https://raw.githubusercontent.com/What-Zit-Tooya/Ad-Block/main/Main-Blocklist/Ad-Block-HOSTS.txt
https://raw.githubusercontent.com/XionKzn/PiHole-Lists/master/PiHole/Blocklist_HOSTS.txt
https://raw.githubusercontent.com/YanFung/Ads/master/Mobile
https://raw.githubusercontent.com/Yuki2718/adblock/master/adguard/tracking-plus.txt
https://raw.githubusercontent.com/Yuki2718/adblock/master/japanese/jp-filters.txt
https://raw.githubusercontent.com/ZYX2019/host-block-list/master/Custom.txt
https://raw.githubusercontent.com/abc45628/hosts/master/hosts
https://raw.githubusercontent.com/aleclee/DNS-Blacklists/master/AdHosts.txt
https://raw.githubusercontent.com/angelics/pfbng/master/ads/ads-domain-list.txt
https://raw.githubusercontent.com/blocklistproject/Lists/master/ransomware.txt
https://raw.githubusercontent.com/cchevy/macedonian-pi-hole-blocklist/master/hosts.txt
https://raw.githubusercontent.com/craiu/mobiletrackers/master/list.txt
https://raw.githubusercontent.com/curutpilek12/adguard-custom-list/main/custom
https://raw.githubusercontent.com/damengzhu/banad/main/jiekouAD.txt
https://raw.githubusercontent.com/deletescape/noads/master/lists/add-switzerland.txt
https://raw.githubusercontent.com/doadin/Pi-Hole-Blocklist/main/block.list
https://raw.githubusercontent.com/dreammjow/MyFilters/main/src/filters.txt
https://raw.githubusercontent.com/durablenapkin/block/master/streaming.txt
https://raw.githubusercontent.com/easylist-thailand/easylist-thailand/master/subscription/easylist-thailand.txt
https://raw.githubusercontent.com/fandagroupofficial/hosts/main/pihole/ads
https://raw.githubusercontent.com/fandagroupofficial/hosts/main/pihole/log
https://raw.githubusercontent.com/fandagroupofficial/hosts/main/pihole/trackers
https://raw.githubusercontent.com/faralai/Pihole-Rules/master/Fara-Popups_Head
https://raw.githubusercontent.com/faralai/Pihole-Rules/master/Fara-Xiaomi-info
https://raw.githubusercontent.com/farrokhi/adblock-iran/master/filter.txt
https://raw.githubusercontent.com/fskreuz/blocklists/dev/domains.txt
https://raw.githubusercontent.com/ftpmorph/ftprivacy/master/regex-blocklists/smartphone-and-general-ads-analytics-regex-blocklist-ftprivacy.txt
https://raw.githubusercontent.com/hell-sh/Evil-Domains/master/evil-domains.txt
https://raw.githubusercontent.com/hosts-file/BulgarianHostsFile/master/bhf.txt
https://raw.githubusercontent.com/igorskyflyer/ad-void/main/AdVoid.Core.txt
https://raw.githubusercontent.com/jackrabbit335/UsefulLinuxShellScripts/master/Hosts%20%26%20sourcelist/blacklist.txt
https://raw.githubusercontent.com/jakdev121/AMS2/master/pi_indo_ads.txt
https://raw.githubusercontent.com/jakejarvis/ios-trackers/master/blocklist.txt
https://raw.githubusercontent.com/jasirfayas/jBlocklist/master/domains.lst
https://raw.githubusercontent.com/javabean/dnsmasq-antispy/master/dnsmasq.ghostery_bugs.conf
https://raw.githubusercontent.com/javabean/dnsmasq-antispy/master/dnsmasq.zz-extra-servers-manual.conf
https://raw.githubusercontent.com/jdlingyu/ad-wars/master/hosts
https://raw.githubusercontent.com/jlonborg/piblacklist/main/blacklist.txt
https://raw.githubusercontent.com/joaopinto14/PiHole/main/adverts
https://raw.githubusercontent.com/kang49/kang49regexblacklistproject/main/blacklist
https://raw.githubusercontent.com/lesong/Surge/main/rule/BanProgramAD.list
https://raw.githubusercontent.com/lhie1/Rules/master/Auto/REJECT.conf
https://raw.githubusercontent.com/mayesidevel/PiHoleLists/master/MiscBlocklist
https://raw.githubusercontent.com/meinhimmel/hosts/master/hosts
https://raw.githubusercontent.com/mhhakim/pihole-blocklist/master/custom-blocklist.txt
https://raw.githubusercontent.com/migueldemoura/ublock-umatrix-rulesets/master/Hosts/ads-tracking
https://raw.githubusercontent.com/minoplhy/filters/main/Resources/blocked.txt
https://raw.githubusercontent.com/monojp/hosts_merge/master/hosts_blacklist.txt
https://raw.githubusercontent.com/mtbnunu/ad-blocklist/master/kr-list.txt
https://raw.githubusercontent.com/mtxadmin/ublock/master/hosts/_telemetry
https://raw.githubusercontent.com/mullvad/dns-adblock/main/lists/doh/adblock/custom
https://raw.githubusercontent.com/muxcc/AdsBlockLists/master/aumm.hosts
https://raw.githubusercontent.com/nimasaj/uBOPa/master/uBOPa.txt
https://raw.githubusercontent.com/notracking/hosts-blocklists/master/dnscrypt-proxy/dnscrypt-proxy.blacklist.txt
https://raw.githubusercontent.com/npljy/npljy.github.io/main/blocks/dns.txt
https://raw.githubusercontent.com/npljy/npljy.github.io/main/blocks/filter.txt
https://raw.githubusercontent.com/olegwukr/polish-privacy-filters/master/adblock.txt
https://raw.githubusercontent.com/parseword/nolovia/master/skel/hosts-government-malware.txt
https://raw.githubusercontent.com/parseword/nolovia/master/skel/hosts-nolovia.txt
https://raw.githubusercontent.com/pathforwardit/BlockList/main/DomainList
https://raw.githubusercontent.com/pirat28/IHateTracker/master/iHateTracker.txt
https://raw.githubusercontent.com/sa-ki13/jmsf/master/japanese_mobile_site_dns_filter.txt
https://raw.githubusercontent.com/saurane/Turkish-Blocklist/master/Blocklist/domains.txt
https://raw.githubusercontent.com/scomper/surge-list/master/reject.list
https://raw.githubusercontent.com/sirsunknight/QuantumultX/master/Filter/Radical-Advertising
https://raw.githubusercontent.com/smed79/blacklist/master/hosts.txt
https://raw.githubusercontent.com/stamparm/maltrail/master/trails/static/suspicious/pua.txt
https://raw.githubusercontent.com/sutchan/dnsmasq_ads_filter/main/dnsmasq-ads-filter-list.txt
https://raw.githubusercontent.com/svetlyobg/svet-custom-domains/master/ads-domains
https://raw.githubusercontent.com/tomzuu/blacklist-named/master/ad.sites.conf
https://raw.githubusercontent.com/tomzuu/blacklist-named/master/phishing.sites.conf
https://raw.githubusercontent.com/tomzuu/blacklist-named/master/pushing.sites.conf
https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/badware.txt
https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt
https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/privacy.txt
https://raw.githubusercontent.com/unchartedsky/adguard-kr/master/adguard-kr.txt
https://raw.githubusercontent.com/unflac/adFILTER/master/filter.txt
https://raw.githubusercontent.com/vokins/ad/main/ad.list
https://raw.githubusercontent.com/willianreis89/ADsBlock/master/list.txt
https://raw.githubusercontent.com/wrysunny/ad_list/master/adlist.txt
https://raw.githubusercontent.com/xOS/Config/Her/Surge/RuleSet/Advertising.list
https://raw.githubusercontent.com/xinggsf/Adblock-Plus-Rule/master/rule.txt
https://raw.githubusercontent.com/xlimit91/xlimit91-block-list/master/blacklist.txt
https://raw.githubusercontent.com/xylagbx/ADBLOCK/master/BLOCK/customadblockdomain.txt
https://raw.githubusercontent.com/ziozzang/adguard/master/filter.txt
https://raw.githubusercontent.com/zznidar/BAR/master/BAR-list

其中唯一有点棘手的部分是 sub(/^raw $/,rs,$ 6)&amp; amp; sub(ofs rs,“”),这是您删除尴尬中的中录字段的方式 - 首先将字段转换为与RS匹配的字符串,因为它不能存在于输入中(我们可以使用RS直接是 \ n 而不是regexp的字符串时,我们将 raw 更改为 \ n 在第6个字段中,这意味着现在记录包含/\ n/,然后删除/\ n ,从而删除了第六个字段和先进的/

Your only real problem is that awk fields, arrays, and strings all start at 1, not 0, so your loop should have started at 1, not 0. As written first time through your loop print $i is doing print $0.

Having said that, I think what you want is the following with a couple of other things tidied up:

$ cat tst.awk
BEGIN { FS=OFS="/" }    
sub(/^raw$/,RS,$6) && sub(OFS RS,"") {
    $3 = "raw.githubusercontent.com"
    print
}

$ awk -f tst.awk urls.txt
https://raw.githubusercontent.com/2RDLive/Pi-Hole/master/Blacklist.txt
https://raw.githubusercontent.com/34730/asd/master/adaway-export
https://raw.githubusercontent.com/568475513/secret_domain/master/filter.txt
https://raw.githubusercontent.com/BlackJack8/iOSAdblockList/master/Regular%20Hosts.txt
https://raw.githubusercontent.com/CipherOps/MiscHostsFiles/master/MiscAdTrackingHostBlock.txt
https://raw.githubusercontent.com/DK-255/Pi-hole-list-1/main/Ads-Blocklist
https://raw.githubusercontent.com/DRSDavidSoft/additional-hosts/master/domains/blacklist/adservers-and-trackers.txt
https://raw.githubusercontent.com/DRSDavidSoft/additional-hosts/master/domains/blacklist/unwanted-iranian.txt
https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareHosts.txt
https://raw.githubusercontent.com/DavidTai780/AdGuard-Home-Private-Rules/master/hosts.txt
https://raw.githubusercontent.com/DivineEngine/Profiles/master/Quantumult/Filter/Guard/Advertising.list
https://raw.githubusercontent.com/Hariharann8175/Indicators-of-Compromise-IOC-/master/Ransomware%20URL's
https://raw.githubusercontent.com/JumbomanXDA/host/main/hosts
https://raw.githubusercontent.com/Kees1958/W3C_annual_most_used_survey_blocklist/master/EU_US%2Bmost_used_ad_and_tracking_networks
https://raw.githubusercontent.com/KurzGedanke/kurzBlock/master/kurzBlock.txt
https://raw.githubusercontent.com/MajkiIT/polish-ads-filter/master/polish-adblock-filters/adblock.txt
https://raw.githubusercontent.com/MitaZ/Better_Filter/master/Quantumult_X/Filter.list
https://raw.githubusercontent.com/MrWaste/Ad-BlockList-2019-08-31/master/Pi-Hole%20BackUps/Black%20List/All%20Server%20Black%20List
https://raw.githubusercontent.com/Neo23x0/signature-base/master/iocs/c2-iocs.txt
https://raw.githubusercontent.com/Pentanium/ABClientFilters/master/ko/korean.txt
https://raw.githubusercontent.com/Phentora/AdguardPersonalList/master/blocklist.txt
https://raw.githubusercontent.com/ShadowWhisperer/BlockLists/master/Lists/Malware
https://raw.githubusercontent.com/SlashArash/adblockfa/master/adblockfa.txt
https://raw.githubusercontent.com/SukkaW/Surge/master/List/domainset/reject_sukka.conf
https://raw.githubusercontent.com/Th3M3/blocklists/master/tracking%26ads.list
https://raw.githubusercontent.com/TonyRL/blocklist/master/hosts
https://raw.githubusercontent.com/UnbendableStraw/samsungnosnooping/master/README.md
https://raw.githubusercontent.com/UnluckyLuke/BlockUnderRadarJunk/master/blockunderradarjunk-list.txt
https://raw.githubusercontent.com/VernonStow/Filterlist/master/Filterlist.txt
https://raw.githubusercontent.com/What-Zit-Tooya/Ad-Block/main/Main-Blocklist/Ad-Block-HOSTS.txt
https://raw.githubusercontent.com/XionKzn/PiHole-Lists/master/PiHole/Blocklist_HOSTS.txt
https://raw.githubusercontent.com/YanFung/Ads/master/Mobile
https://raw.githubusercontent.com/Yuki2718/adblock/master/adguard/tracking-plus.txt
https://raw.githubusercontent.com/Yuki2718/adblock/master/japanese/jp-filters.txt
https://raw.githubusercontent.com/ZYX2019/host-block-list/master/Custom.txt
https://raw.githubusercontent.com/abc45628/hosts/master/hosts
https://raw.githubusercontent.com/aleclee/DNS-Blacklists/master/AdHosts.txt
https://raw.githubusercontent.com/angelics/pfbng/master/ads/ads-domain-list.txt
https://raw.githubusercontent.com/blocklistproject/Lists/master/ransomware.txt
https://raw.githubusercontent.com/cchevy/macedonian-pi-hole-blocklist/master/hosts.txt
https://raw.githubusercontent.com/craiu/mobiletrackers/master/list.txt
https://raw.githubusercontent.com/curutpilek12/adguard-custom-list/main/custom
https://raw.githubusercontent.com/damengzhu/banad/main/jiekouAD.txt
https://raw.githubusercontent.com/deletescape/noads/master/lists/add-switzerland.txt
https://raw.githubusercontent.com/doadin/Pi-Hole-Blocklist/main/block.list
https://raw.githubusercontent.com/dreammjow/MyFilters/main/src/filters.txt
https://raw.githubusercontent.com/durablenapkin/block/master/streaming.txt
https://raw.githubusercontent.com/easylist-thailand/easylist-thailand/master/subscription/easylist-thailand.txt
https://raw.githubusercontent.com/fandagroupofficial/hosts/main/pihole/ads
https://raw.githubusercontent.com/fandagroupofficial/hosts/main/pihole/log
https://raw.githubusercontent.com/fandagroupofficial/hosts/main/pihole/trackers
https://raw.githubusercontent.com/faralai/Pihole-Rules/master/Fara-Popups_Head
https://raw.githubusercontent.com/faralai/Pihole-Rules/master/Fara-Xiaomi-info
https://raw.githubusercontent.com/farrokhi/adblock-iran/master/filter.txt
https://raw.githubusercontent.com/fskreuz/blocklists/dev/domains.txt
https://raw.githubusercontent.com/ftpmorph/ftprivacy/master/regex-blocklists/smartphone-and-general-ads-analytics-regex-blocklist-ftprivacy.txt
https://raw.githubusercontent.com/hell-sh/Evil-Domains/master/evil-domains.txt
https://raw.githubusercontent.com/hosts-file/BulgarianHostsFile/master/bhf.txt
https://raw.githubusercontent.com/igorskyflyer/ad-void/main/AdVoid.Core.txt
https://raw.githubusercontent.com/jackrabbit335/UsefulLinuxShellScripts/master/Hosts%20%26%20sourcelist/blacklist.txt
https://raw.githubusercontent.com/jakdev121/AMS2/master/pi_indo_ads.txt
https://raw.githubusercontent.com/jakejarvis/ios-trackers/master/blocklist.txt
https://raw.githubusercontent.com/jasirfayas/jBlocklist/master/domains.lst
https://raw.githubusercontent.com/javabean/dnsmasq-antispy/master/dnsmasq.ghostery_bugs.conf
https://raw.githubusercontent.com/javabean/dnsmasq-antispy/master/dnsmasq.zz-extra-servers-manual.conf
https://raw.githubusercontent.com/jdlingyu/ad-wars/master/hosts
https://raw.githubusercontent.com/jlonborg/piblacklist/main/blacklist.txt
https://raw.githubusercontent.com/joaopinto14/PiHole/main/adverts
https://raw.githubusercontent.com/kang49/kang49regexblacklistproject/main/blacklist
https://raw.githubusercontent.com/lesong/Surge/main/rule/BanProgramAD.list
https://raw.githubusercontent.com/lhie1/Rules/master/Auto/REJECT.conf
https://raw.githubusercontent.com/mayesidevel/PiHoleLists/master/MiscBlocklist
https://raw.githubusercontent.com/meinhimmel/hosts/master/hosts
https://raw.githubusercontent.com/mhhakim/pihole-blocklist/master/custom-blocklist.txt
https://raw.githubusercontent.com/migueldemoura/ublock-umatrix-rulesets/master/Hosts/ads-tracking
https://raw.githubusercontent.com/minoplhy/filters/main/Resources/blocked.txt
https://raw.githubusercontent.com/monojp/hosts_merge/master/hosts_blacklist.txt
https://raw.githubusercontent.com/mtbnunu/ad-blocklist/master/kr-list.txt
https://raw.githubusercontent.com/mtxadmin/ublock/master/hosts/_telemetry
https://raw.githubusercontent.com/mullvad/dns-adblock/main/lists/doh/adblock/custom
https://raw.githubusercontent.com/muxcc/AdsBlockLists/master/aumm.hosts
https://raw.githubusercontent.com/nimasaj/uBOPa/master/uBOPa.txt
https://raw.githubusercontent.com/notracking/hosts-blocklists/master/dnscrypt-proxy/dnscrypt-proxy.blacklist.txt
https://raw.githubusercontent.com/npljy/npljy.github.io/main/blocks/dns.txt
https://raw.githubusercontent.com/npljy/npljy.github.io/main/blocks/filter.txt
https://raw.githubusercontent.com/olegwukr/polish-privacy-filters/master/adblock.txt
https://raw.githubusercontent.com/parseword/nolovia/master/skel/hosts-government-malware.txt
https://raw.githubusercontent.com/parseword/nolovia/master/skel/hosts-nolovia.txt
https://raw.githubusercontent.com/pathforwardit/BlockList/main/DomainList
https://raw.githubusercontent.com/pirat28/IHateTracker/master/iHateTracker.txt
https://raw.githubusercontent.com/sa-ki13/jmsf/master/japanese_mobile_site_dns_filter.txt
https://raw.githubusercontent.com/saurane/Turkish-Blocklist/master/Blocklist/domains.txt
https://raw.githubusercontent.com/scomper/surge-list/master/reject.list
https://raw.githubusercontent.com/sirsunknight/QuantumultX/master/Filter/Radical-Advertising
https://raw.githubusercontent.com/smed79/blacklist/master/hosts.txt
https://raw.githubusercontent.com/stamparm/maltrail/master/trails/static/suspicious/pua.txt
https://raw.githubusercontent.com/sutchan/dnsmasq_ads_filter/main/dnsmasq-ads-filter-list.txt
https://raw.githubusercontent.com/svetlyobg/svet-custom-domains/master/ads-domains
https://raw.githubusercontent.com/tomzuu/blacklist-named/master/ad.sites.conf
https://raw.githubusercontent.com/tomzuu/blacklist-named/master/phishing.sites.conf
https://raw.githubusercontent.com/tomzuu/blacklist-named/master/pushing.sites.conf
https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/badware.txt
https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt
https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/privacy.txt
https://raw.githubusercontent.com/unchartedsky/adguard-kr/master/adguard-kr.txt
https://raw.githubusercontent.com/unflac/adFILTER/master/filter.txt
https://raw.githubusercontent.com/vokins/ad/main/ad.list
https://raw.githubusercontent.com/willianreis89/ADsBlock/master/list.txt
https://raw.githubusercontent.com/wrysunny/ad_list/master/adlist.txt
https://raw.githubusercontent.com/xOS/Config/Her/Surge/RuleSet/Advertising.list
https://raw.githubusercontent.com/xinggsf/Adblock-Plus-Rule/master/rule.txt
https://raw.githubusercontent.com/xlimit91/xlimit91-block-list/master/blacklist.txt
https://raw.githubusercontent.com/xylagbx/ADBLOCK/master/BLOCK/customadblockdomain.txt
https://raw.githubusercontent.com/ziozzang/adguard/master/filter.txt
https://raw.githubusercontent.com/zznidar/BAR/master/BAR-list

The only slightly tricky part in that is sub(/^raw$/,RS,$6) && sub(OFS RS,"") which is how you remove a mid-record field in awk - first convert the field to a string that matches RS since that can't be present in the input (we can use RS directly when it's a string like \n rather than a regexp) so we changed raw to \n in the 6th field which meant the record now contained /\n/ and then removed /\n thereby removing the 6th field and preceding /.

问题将github.com/*/raw/* urls转换为raw.githubusercontent.com urls使用awk

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文