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
#!/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
#!/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
#!/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
#!/bin/sh | |
# | |
# Binary file padder. | |
# Pads binary file with 0xFF to match full size of flashing chip. | |
# | |
# Example: | |
# ./binpadder.sh openipc-u-boot-t10-universal.bin 8 | |
# | |
# Running this command will produce a new binary file | |
# openipc-u-boot-t10-universal-8MB-padded.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
#!/usr/bin/env ruby | |
# | |
# Outward spiral matrix builder | |
# 2012, Paul Philippov <[email protected]> | |
# | |
def show_usage | |
puts 'Usage: $0 <number>' | |
exit | |
end |
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
<pre> | |
<%= "<em>text</em>".class %> | |
<%= raw("<em>text</em>").class %> | |
<%= "<em>text</em>" %> | |
<%= raw("<em>text</em>") %> | |
<%= ["<em>text</em>"].join %> | |
<%= [raw("<em>text</em>")].join %> |
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
<?php | |
// php equivalent of ruby one-liner | |
// "строка текста!".chars.to_a.last | |
function u_str_split($string, $split_length=1) | |
{ | |
preg_match_all('`.`u', $string, $arr); | |
$arr = array_chunk($arr[0], $split_length); | |
$arr = array_map('implode', $arr); | |
return $arr; |
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
# | |
# a request to http://lastfm-api-ext.appspot.com/2.0/ | |
# with outtype=js sometimes gives me an error like this: | |
# | |
Traceback (most recent call last): | |
File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 507, in __call__ | |
handler.get(*groups) | |
File "/base/data/home/apps/lastfm-api-ext/1.178/main.py", line 60, in get | |
result = packages[package](params)[method]() |