Skip to content

Instantly share code, notes, and snippets.

@pinge
pinge / 010-mt7615_txpower_fix.patch
Last active November 23, 2024 09:19
OpenWrt patch txpower 6dbm limit for MT7615 MT7615E MT7615N MT7615DN
diff --git a/mt7615/eeprom.c b/mt7615/eeprom.c
index ccedea7e8a..d95809c22c 100644
--- a/mt7615/eeprom.c
+++ b/mt7615/eeprom.c
@@ -332,6 +332,7 @@ static void mt7615_cal_free_data(struct mt7615_dev *dev)
int mt7615_eeprom_init(struct mt7615_dev *dev, u32 addr)
{
+ static const u8 eeprom_mt7615[] = {0x15, 0x76, 0xA0, 0x00, 0x00, 0x0C, 0x43, 0x26, 0x60, 0x00, 0x15, 0x76, 0xC3, 0x14, 0x00, 0x80, 0x02, 0x00, 0xC3, 0x14, 0x15, 0x76, 0x03, 0x22, 0xFF, 0xFF, 0x23, 0x04, 0x0D, 0x02, 0x8F, 0x02, 0x00, 0x80, 0x0A, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x60, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x20, 0x20, 0x00, 0xB3, 0x40, 0xB6, 0x40, 0xC4, 0x24, 0x00, 0x00, 0x00, 0xC0, 0xC3, 0x24, 0x00, 0x00, 0x00, 0xC0, 0xC4, 0x14, 0x00, 0x00, 0x00, 0x40, 0xC4, 0x14, 0x00, 0x00, 0x00, 0x40, 0xC5, 0x14, 0x00, 0x00, 0xC0, 0xC4, 0x20, 0x00, 0x00,
@pinge
pinge / mobile.video.encoding.md
Last active October 22, 2024 06:22
Video and audio encoding for playback in Android and iOS devices

Video and audio encoding for playback in Android and iOS devices

This document aims to provide an easy way encode video optimized for playback in mobile devices that use the Android or the iOS operating systems.

libx264 is used for (single or two-pass) video encoding and libfdk_aac for audio encoding.

ffmpeg, libx264 and libfdk_aac settings are optimized for playback quality and compatibility on Android and iOS. There is extensive documentation and references for each of the settings used and contributions are very welcome :)

@pinge
pinge / ffmpeg.md
Last active July 18, 2023 18:51
FFmpeg Cheatsheet

FFmpeg

remove audio from video file

ffmpeg -i example.mp4 -c copy -an example_no_audio.mp4

extract audio track from video file without re-encoding

ffmpeg -i input.mp4 -vn -acodec copy audio_track.aac

Yolo_mark on Ubuntu 16.04 LTS

clone repo

git clone https://github.com/AlexeyAB/Yolo_mark.git
cd Yolo_mark

add linux yolo mark command

@pinge
pinge / iphone.ubuntu.md
Last active September 14, 2024 08:18
mounting iPhone storage in Ubuntu 16.04 LTS

mounting iPhone storage in Ubuntu 16.04 LTS

check if your device was recognized correctly

$ dmesg | grep ipheth
[62051.385352] ipheth 1-5:4.2: Apple iPhone USB Ethernet device attached
[62051.385437] usbcore: registered new interface driver ipheth

create mounting point and make it writable (optional)

dir1='image-builder-rpi'
dir2='gateway-image-builder-rpi'
IFS=$'\n'
for file in $(grep -Ilsr -m 1 '.' "$dir1"); do
diff -q "$file" "${file/${dir1}/${dir2}}"
done
# coding: utf8
"""
from http://orator.readthedocs.io/en/latest/migrations.html
orator.py is the default migration configuration file for the Orator ORM
this file uses the Config class, so we've decided to use sys.path.append() method at runtime to avoid having to specify
the PYTHONPATH environment variable, making required command line a bit more user friendly

fluentd setup

system tweaks
  • sudo vim /etc/security/limits.conf (append to EOF)

root soft nofile 65536 root hard nofile 65536

  • soft nofile 65536
#!/usr/bin/env python
import os
import sys
import base64
import json
# Add the lib directory to the path for Lambda to load our libs
sys.path.append(os.path.join(os.path.dirname(__file__), 'lib'))
WORLD_REGIONS = [
# -*- coding: utf-8 -*-
import unittest
from app.lib.geo import generate_convex_hull
class GenerateConvexHullTest(unittest.TestCase):
def test_generate_convex_hull_with_degenerate_input(self):