This file contains hidden or 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/sh | |
# | |
# ANSI color codes | |
# Paul Philippov, themactep.com | |
# | |
for k in {1..9}; do | |
for i in {0..9}; do | |
echo -en " \e[1;${k}${i}m$(printf "%02s" "${k}${i}")\e[0m" | |
done | |
echo |
This file contains hidden or 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 | |
## Get the primary and secundary IPs | |
awk '/\|--/ && !/\.0$|\.255$/ {print $2}' /proc/net/fib_trie | |
## Get only the primary IPs | |
awk '/32 host/ { print i } {i=$2}' /proc/net/fib_trie |
This file contains hidden or 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/perl | |
# latest release at https://gitlab.com/667bdrm/sofiactl | |
# | |
# Simple clock synchronization for some chinese HiSilicon based DVRs supporting CMS (Sofia software) with json-like protocol. Tested with: | |
# | |
# HJCCTV HJ-H4808BW (XiongMai, Hi3520, MBD6304T) | |
# http://www.aliexpress.com/item/Hybird-NVR-8chs-H-264DVR-8chs-onvif-2-3-Economical-DVR-8ch-Video-4-AUDIO-AND/1918734952.html | |
# | |
# |
This file contains hidden or 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/ruby | |
# frozen_string_literal: true | |
# | |
# Firmware spitter | |
# Paul Philippov <[email protected]> | |
# | |
# 2022-11-16: Initial version | |
# 2023-04-16: Support for dd older than v9.0 | |
# Use the last found mtdparts | |
# 2024-03-02: Extract an arbitrary range of addresses |
This file contains hidden or 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/bash | |
# | |
# OpenIPC full firmware file assembler. | |
# Creates a file suitable for programming a flash chip. | |
# | |
# Example: | |
# ./compile4programmer.sh uboot.bin uImage rootfs.squashfs 8 | |
# | |
# Running this command will produce a new binary file | |
# full4programmer-8MB.bin or full4programmer-16MB.bin |
This file contains hidden or 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/bash | |
# | |
# Convert deprecated apt-key keys storage to GPG keys. | |
# Paul Philippov <[email protected]> | |
# | |
keys=$(sudo apt-key list | grep -A1 ^pub | grep "^ " | sed "s/\s*//g" | sort | uniq) | |
for k in $keys; do | |
sudo apt-key export $k | \ | |
sudo gpg --dearmour -o /usr/share/keyrings/$k.gpg --yes && |
This file contains hidden or 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/sh | |
# GPIO switcher | |
# Paul Philippov <[email protected]> | |
PIN=$1 | |
MODE=$2 | |
if [ -z "$PIN" ] || [ -z "$MODE" ]; then | |
echo "Usage: $0 <pin#> <1|0|x>" | |
exit 1 |
This file contains hidden or 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/sh | |
# Convert text from GB 2312 charset to Unicode, translate to English. | |
# cn2en.sh <file.txt> | |
# Paul Philippov <[email protected]> | |
# 20200926 | |
infile=$1 | |
cnfile="${infile%.*}.cn.${infile##*.}" | |
enfile="${infile%.*}.en.${infile##*.}" |
This file contains hidden or 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/sh | |
# | |
# Format SD card to two small FAT32 partitions | |
# for guaranteed usage with embedded devices | |
# Paul Philippov <[email protected]> | |
# | |
show_help() { | |
echo "Usage: $0 [OPTIONS]> | |
Where: | |
-d <device> SD Card device (e.g. /dev/sdc). |
This file contains hidden or 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
// ==UserScript== | |
// @name CSDN tweaker | |
// @namespace http://themactep.com/ | |
// @version 0.1 | |
// @description Show full articles | |
// @author [email protected] | |
// @match https://*.blog.csdn.net/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=csdn.net | |
// @grant none | |
// ==/UserScript== |