Skip to content

Instantly share code, notes, and snippets.

@hgn
hgn / tcpdump IPv6 router advertisement
Created March 16, 2015 18:59
Capture of IPv6 advertisement message via tcpdump
@virgo:~ $ sudo tcpdump -vvvv -ttt -i eth1 icmp6 and 'ip6[40] = 134'
00:00:00.000000 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 200) fe80::b675:eff:fefa:1cb > ip6-allnodes: [icmp6 sum ok] ICMP6, router advertisement, length 200
hop limit 0, Flags [managed, other stateful], pref medium, router lifetime 1800s, reachable time 0s, retrans time 0s
source link-address option (1), length 8 (1): b4:75:0e:fa:01:cb
0x0000: b475 0efa 01cb
mtu option (5), length 8 (1): 1280
0x0000: 0000 0000 0500
prefix info option (3), length 32 (4): 2a01:ffff:43f::/64, Flags [onlink, auto], valid time 7200s, pref. time 1800s
0x0000: 40c0 0000 1c20 0000 0708 0000 0000 2a01
0x0010: ffff 043f 0000 0000 0000 0000 0000
@sio
sio / minttycolor.py
Last active May 8, 2024 13:17
Helper functions for creating Mintty color scheme with Python
"""
Manipulate color schemes for mintty
For simplicity, support only "value = r, g, b" format with decimal values
Copyright 2017 Vitaly Potyarkin
Licensed under the Apache License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0
@maartenba
maartenba / inspectcode.xslt
Last active May 8, 2024 13:15
R# InspectCode XSLT
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:key name="ISSUETYPES" match="/Report/Issues/Project/Issue" use="@TypeId"/>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/" name="TopLevelReport">
<html>
<head>
<title>Resharper InspectCode Report</title>
@ohader
ohader / rename-git-master-branch.sh
Created November 29, 2021 11:31
Rename Git master to main branch via GitHub API
#!/bin/bash
#
# replace `GITHUBTOKEN` with custom token from https://github.com/settings/tokens, having `repo` admin access
#
for repo in $(curl -s -H "Authorization: token GITHUBTOKEN" 'https://api.github.com/orgs/TYPO3-CMS/repos?per_page=100' | jq -r '.[] | .url' | sort)
do
echo "Renaming ${repo}..."
response=$(curl -s -X POST \
@gothburz
gothburz / colorama-class.py
Created March 19, 2020 21:41
Colorama Python Class
from colorama import init,Fore,Style
class PCOLOR:
# init() = Required for Colorama on Windows for Termcolor
init()
def __init__(self):
# COLORS
self.green = Fore.GREEN
self.red = Fore.RED
@gonchar
gonchar / a_visionOS_Xcode_snippets
Last active May 8, 2024 13:12
visionOS Xcode snippets
// hello
@shengjie-chen
shengjie-chen / gist:ba434a63c89ad8b081afee348db2f81c
Created May 3, 2024 05:59
Activity Watch的任务分类规则,适配我个人的工作习惯和使用的应用
{
"categories": [
{
"name": [
"Work"
],
"rule": {
"type": "regex",
"regex": "MathType|Excel|远程桌面连接|计算器|visio|WPS|vivado|siyuan|explorer.exe|IDM|vmware|Ditto|chrome|localsend_app|TencentDocs|word|SunloginClient|ppt|xilinx",
"ignore_case": true
@flrichar
flrichar / rancher-backup-version.md
Last active May 8, 2024 13:10
rancher backup version check

Check Rancher Backup tar.gz Version with x0f

...$ tar -xOf 010a-e3614234-218f-4666-9609-22b1e5743db6-2022-07-03T10-00-00Z.tar.gz settings.management.cattle.io#v3/server-version.json | jq .value
"v2.6.6"

Fun walk down history lane. Prints the versions of rancher backups found in a dir, from settings stdout.

  • find restore/backups/ -name '*.tar.gz' -exec tar -xOf {} settings.management.cattle.io#v3/server-version.json \; | jq -r .value
@mathcodes
mathcodes / dsa_pattern.md
Last active May 8, 2024 13:10
14 DSA Patterns to Master

14 Coding Patterns To Master

This is a collection of coding patterns I have learned to solve not only some of the most common problems, but the 14 patterns (yes, there are way more than 14, but the point here is taking 6 months of preparation and condensing it into a 30 minute read that would not take more than 1-2 weeks to master. I have found these problems and patterns to be the most useful in that the data structures and algorithms are used in many other problems and become familiar over time. Good luck!

Please feel free to comment if you got some value or find any errors!

Thanks!

Table of Contents