Skip to content

Instantly share code, notes, and snippets.

Github Authentication Failed

Use SSH

  1. Run ( < /dev/zero ssh-keygen -q -N ""); echo ""; cat .ssh/id_rsa.pub in container CLI
  2. Copy the output ssh-rsa XXXXXXXXXXXXXXXXXX root@334134babe59
  3. Paste it to Github -- Settings -- SSH and GPG Keys -- New SSH Key
  4. In container CLI, clone your repo with SSH

Use HTTPS

  1. Create a Personal Token
@I0x0I
I0x0I / pcapng2log.py
Created April 9, 2022 23:12
Convert pcapng with CAN messages to CAN log
import struct
import argparse
import pcapng.blocks
from pcapng import FileScanner
def unpackCANFrame(frame,reverse=False):
#https://github.com/hardbyte/python-can/blob/ae0bc1746c04b3c1ccd8b56aba99895d50c87d2d/can/interfaces/socketcan/socketcan.py#L511
CAN_FRAME_HEADER_STRUCT = struct.Struct(">IBB2x") if reverse == False else struct.Struct("=IBB2x")
can_id, can_dlc, flags = CAN_FRAME_HEADER_STRUCT.unpack_from(frame)
data = frame[8 : 8 + can_dlc]
@I0x0I
I0x0I / gist:a324eb67bd40ee1383d99d48171b4d4e
Created November 23, 2016 11:44
Script for zhihu.com
import requests
method = 'POST'
url = 'https://www.zhihu.com/node/QuestionAnswerListV2'
headers = {'Origin': 'https://www.zhihu.com', 'Content-Length': '93', 'Accept-Language': 'en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4', 'Accept-Encoding': 'gzip, deflate, br', 'Connection': 'keep-alive', 'Accept': '*/*', 'User-Agent': 'Mozilla/5.0(Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36', 'Host': 'www.zhihu.com', 'X-Requested-With': 'XMLHttpRequest', 'Pragma': 'no-cache', 'Cache-Control': 'no-cache', 'Referer': 'https://www.zhihu.com/question/19563390', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Cookie': 'd_c0="ACBCIuNN5AqPTukv-7RO2Eqf2ixB8sRZkh8=|1479899930"; q_c1=650fee33b22647cfa5c335eb424ed790|1479899930000|1479899930000; l_cap_id="NzU3NzQ4YmMyNTgxNDEyNjk1NjkwODk2YjBlMzJiYTk=|1479899930|6e41c4f08075457e53f3d37650e2cff841596ce5"; cap_id="NmZkMDYyMTU5NjAxNGVjMmIxOTE1YjVjNzhhZWI2Mjc=|1479899930|365f20a0d522da2b6a8122e940426e3a31f624e8"; n_c=1'}
data