Skip to content

Instantly share code, notes, and snippets.

View KireinaHoro's full-sized avatar

Pengcheng Xu KireinaHoro

View GitHub Profile
@KireinaHoro
KireinaHoro / switch-vlan.ps1
Created January 21, 2024 17:16
Switch between VLANs with Hyper-V vEthernet
<#
Make adapter use gravity (untagged) or upstream network (tagged 1).
This depends on the switch (ER-X) configuration:
- upstream port has PVID=1 (untagged vlan 1)
- gateway port has PVID=1 VID=200 (untagged vlan 1, tagged vlan 200)
- downstream ports have PVID=200 VID=1 (untagged vlan 200, tagged vlan 1)
#>
#Requires -RunAsAdministrator
@KireinaHoro
KireinaHoro / photo-redate.swift
Created January 20, 2024 00:26
Update all photo dates from filename. Useful for bulk import into iCloud from Google Photos.
//
// main.swift
// photo-redate
//
// Created by Pengcheng on 19.01.2024.
//
import Foundation
import Photos
import os
package pionic
import axi.sim.{Axi4Master, Axi4StreamMaster, Axi4StreamSlave}
import spinal.core._
import spinal.core.sim._
import spinal.lib.BinaryBuilder
import scala.util._
case class PacketDescSim(addr: BigInt, size: BigInt)(implicit config: PioNicConfig) {
package axi.sim
import pionic.RichByteArray
import spinal.core._
import spinal.core.sim._
import spinal.lib.bus.amba4.axi._
import spinal.lib.sim._
import java.util.concurrent.atomic.{AtomicBoolean, AtomicReference}
import scala.collection.mutable
package axi.sim
import spinal.core._
import spinal.core.sim._
import spinal.lib._
import spinal.lib.bus.amba4.axi._
import spinal.lib.bus.misc._
import spinal.lib.sim._
import scala.collection.mutable
@KireinaHoro
KireinaHoro / docker-compose.yml
Created May 10, 2020 02:45
Grafana + Prometheus template.
version: '3'
volumes:
prometheus_data: {}
grafana_data: {}
services:
# Prometheus backend.
prometheus:
restart: always
image: prom/prometheus
volumes:
@KireinaHoro
KireinaHoro / snmp.yml
Last active February 10, 2022 08:12
snmp_exporter config for Geist (Vertiv) IMD PDUs
# WARNING: This file was auto-generated using snmp_exporter generator, manual changes will be lost.
geist_imd:
walk:
- 1.3.6.1.4.1.21239.5.2.3
metrics:
- name: pduMainIndex
oid: 1.3.6.1.4.1.21239.5.2.3.1.1.1
type: gauge
help: Table entry index value - 1.3.6.1.4.1.21239.5.2.3.1.1.1
indexes:
@KireinaHoro
KireinaHoro / hashcash.go
Created October 23, 2019 16:05
Basic implementation of the Bitcoin hashcash algorithm,
package main
import (
"crypto/sha256"
"encoding/binary"
"encoding/hex"
"encoding/json"
"fmt"
"math/big"
"os"
@KireinaHoro
KireinaHoro / system.diff
Last active October 6, 2018 06:16
DPT-RP1 system diff
diff --git a/system-orig/build.prop b/system-new/build.prop
index 6afadb0..1f57459 100644
--- a/system-orig/build.prop
+++ b/system-new/build.prop
@@ -10,11 +10,11 @@ ro.build.version.all_codenames=REL
ro.build.version.release=1.2.02.07211
ro.build.date=Fri Jul 21 17:15:08 JST 2017
ro.build.date.utc=1500624908
-ro.build.type=user
+ro.build.type=userdebug
@KireinaHoro
KireinaHoro / bootimg.diff
Last active October 6, 2018 06:11
DPT-RP1 boot.img diff
diff --git a/orig/boot.img b/new/boot.img
index cdcfca4..15a594e 100644
Binary files a/orig/boot.img and b/new/boot.img differ
diff --git a/orig/bootimg.cfg b/new/bootimg.cfg
index 42eaa62..fc7b66f 100644
--- a/orig/bootimg.cfg
+++ b/new/bootimg.cfg
@@ -5,5 +5,5 @@ ramdiskaddr = 0x11000000
secondaddr = 0x10f00000
tagsaddr = 0x10000100