- Beijing -> Xi’an: 4h30m
- Xi’an -> Chengdu: 4h13m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import dataclass | |
from datetime import timedelta | |
from uuid import UUID | |
from temporalio import activity | |
from temporalio import workflow | |
from parrot.core.logging import get_logger | |
logger = workflow.LoggerAdapter(get_logger(__name__), None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker run -it --entrypoint=/bin/bash datadog/agent | |
root@c2c1c5bb0c16:/# python | |
Python 3.7.4 (default, Dec 31 2019, 19:02:30) | |
[GCC 4.7.2] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import socket | |
>>> # create socket for receive | |
>>> sock_read = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) | |
>>> sock_read.bind('/tmp/socket-test') | |
>>> # create socket for send |
I hereby claim:
- I am mrknmc on github.
- I am mrknmc (https://keybase.io/mrknmc) on keybase.
- I have a public key ASBnBlIOALinHweBJaXKr6VPqPwCIQmBxPaApeIPNaNrdQo
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function WSUSUpdate { | |
$LogFile = "UpdateLogs\" + (Get-Date -format yyyy-MM-dd--HH-mm) + ".log" | |
Start-transcript $LogFile | |
$Criteria = "IsInstalled=0 and Type='Software'" | |
$Searcher = New-Object -ComObject Microsoft.Update.Searcher | |
try { | |
$SearchResult = $Searcher.Search($Criteria) | |
[Object[]] $Critical = $SearchResult.updates | where { $_.MsrcSeverity -eq "Critical" } | |
[Object[]] $Important = $SearchResult.updates | where { $_.MsrcSeverity -eq "Important" } | |
[Object[]] $Moderate = $SearchResult.updates | where { $_.MsrcSeverity -eq "Moderate" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
ERROR="Invalid discount code!" | |
for run in {1..1000} | |
do | |
NEW_UUID=$(cat /dev/urandom | LC_ALL=C tr -cd "[:upper:]" | head -c 9) | |
echo -e "Trying out ${NEW_UUID}" | |
RESPONSE=$(curl -s "http://www.snapfaxtakeaways.co.uk/discount/usersnapcode" --data "promocode=${NEW_UUID}&code_type=2" --compressed) | |
echo "$RESPONSE" | |
if [[ "$RESPONSE" != "$ERROR" ]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
### This only works assuming that you have all the necessary cookies in ./cookies.txt. | |
### I use this plugin: https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg | |
### Execute as follows: ./shopping.sh ./cookies.txt output.csv | |
# get last order id | |
order_id=$(curl -s -b $1 'https://groceries.asda.com/api/order/view?showmultisave=true&showrefund=true&pagenum=1&pagesize=25&requestorigin=gi' | jq -r '.orders | .[0] | .orderId') | |
# get url for last order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def md5(s): | |
... return hashlib.md5(s).hexdigest() | |
... | |
>>> def sha1(s): | |
... return hashlib.sha1(s).hexdigest() | |
... | |
>>> def sha256(s): | |
... return hashlib.sha256(s).hexdigest() | |
... | |
>>> def sha512(s): |