Skip to content

Instantly share code, notes, and snippets.

@steelywing
steelywing / SerializableDictionary.cs
Last active October 9, 2024 17:06
C# SerializableDictionary
using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
/// <summary>
/// Base on https://weblogs.asp.net/pwelter34/444961
/// </summary>
/// <typeparam name="TKey"></typeparam>
@steelywing
steelywing / EnableSSH.js
Created January 31, 2021 05:51
Enable RedMi 2100 SSH access
// Work for RedMi 2100 firmware 2.0.23
// http://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/rm2100/miwifi_rm2100_all_fb720_2.0.23.bin
function getSTOK() {
let match = location.href.match(/;stok=(.*?)\//);
if (!match) {
return null;
}
return match[1];
}
@steelywing
steelywing / couns.md
Last active October 13, 2020 07:13
Couns Door Setup

Default Mode

  • Access door
    • Input password (Default 1234)
    • Press #
  • Enter programming mode
    • Press *
    • Input admin password (Default 9999)
    • Press #
  • Exit programming mode and Save
    • Press * in 1 minute
//--VAR
$puts(brd,28-28-28)
$puts(brd2,70-70-70)
$puts(brd_g1,50-50-50)
$puts(brd_g2,35-35-35)
$puts(transparent, 0-0-0-0)
// Column padding
$puts(padding, 16)
@steelywing
steelywing / hosts.bat
Last active October 28, 2015 14:27
add host entry to windows hosts, run as administrator
@echo off
set hosts_file=%WINDIR%\System32\drivers\etc\hosts
set host=127.0.0.1 fvc_stat.freemake.com
find /i "%host%" %hosts_file% > nul
if %ERRORLEVEL% == 0 (
echo "%host%" already exist.
) else (
(echo. & echo %host%) >> %hosts_file%
@steelywing
steelywing / putty-serial.nsi
Last active August 29, 2015 14:27
Auto detect serial port to execute putty
# Wrap putty-serial.vbs to exe
Name "PuTTY Serial"
Icon "putty.ico"
OutFile "putty-serial.exe"
InstallDir "$TEMP"
RequestExecutionLevel user
SilentInstall silent
Section
@steelywing
steelywing / ldap_escape.php
Last active September 4, 2023 08:07
ldap_escape() for PHP < 5.6
// Source: https://stackoverflow.com/a/8561604/1877620
if (!function_exists('ldap_escape')) {
define('LDAP_ESCAPE_FILTER', 0x01);
define('LDAP_ESCAPE_DN', 0x02);
/**
* @param string $subject The subject string
* @param string $ignore Set of characters to leave untouched
* @param int $flags Any combination of LDAP_ESCAPE_* flags to indicate the
@steelywing
steelywing / gpsd.md
Last active August 29, 2015 14:07
gpsd build build from source (CentOS 6.5)

Install

  • Download and extract
  • Refer INSTALL and build.txt in gpsd source
  • yum install gcc
  • yum install ncurses ncurses-devel
  • yum install python-devel
  • Install scons
  • Run scons in gpsd source folder
  • Run scons check
  • Run scons install
@steelywing
steelywing / Mcrypt.php
Last active August 29, 2015 14:07
php mcrypt class
<?php
class Mcrypt
{
/**
* @var string Encryption key
*/
public $key;