Skip to content

Instantly share code, notes, and snippets.

@grimpy
grimpy / isp_status.py
Created July 8, 2019 06:47
isp_status
from i3pystatus import IntervalModule
import time
class VodaFone(IntervalModule):
interval = 3600
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
try:
import vodafone
for _ in range(3):
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.14.83-IMMENSITY (marionette@rom-factory) (Android (4691093 based on r316199) clang version 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55536e7d904e0abae47888fc7f) (https://android.googlesource.com/toolchain/llvm 34361f192e41ed6e4e8f9aca80a4ea7e9856f327) (based on LLVM 6.0.2svn)) #19 SMP PREEMPT Sun Aug 4 22:22:34 CEST 2019
[ 0.000000] Boot CPU: AArch64 Processor [51df805e]
[ 0.000000] Powerup reason=0x20001
[ 0.000000] Machine: Qualcomm Technologies, Inc. SM8150 V2 PM8150 RAPHAEL
[ 0.000000] ramoops: msm_reserve_ramoops_memory addr=b0000000,size=400000
[ 0.000000] ramoops: msm_reserve_ramoops_memory record_size=0,ftrace_size=0
[ 0.000000] Memory limit set/overridden to 6075MB
[ 0.000000] Reserved memory: created CMA memory pool at 0x00000000f5c00000, size 160 MiB
[ 0.000000] OF: reserved mem: initialized node secure_display_region, compatible id shared-dma-pool
@grimpy
grimpy / gdrivedl
Last active June 6, 2020 07:29 — forked from joshtch/gdrive-dl.py
Google Drive file downloader for Python, with progress bar with tqdm. Based on this SO answer https://stackoverflow.com/a/39225039/3175094
#!/usr/bin/env python
import requests
import sys
import os
from tqdm import tqdm
def download_file_from_google_drive(id, destination=None):
URL = "https://docs.google.com/uc?export=download"
10-14 22:32:24.895 1473 6619 W ActivityManager: Unable to start service Intent { cmp=com.teslacoilsw.notifier/.NotificationService (has extras) } U=0: not found
10-14 22:32:29.731 589 600 E secnvm : ch [sec_nvm_sp_nvm] Link Up timeout expired.
10-14 22:32:29.731 589 603 E secnvm : ch [sec_nvm_iuicc] Link Up timeout expired.
10-14 22:32:29.731 589 602 E secnvm : ch [sec_nvm_sampleapp] Link Up timeout expired.
10-14 22:32:29.733 589 600 E secnvm : ch [sec_nvm_sp_nvm] can't register spcom service
10-14 22:32:29.733 589 602 E secnvm : ch [sec_nvm_sampleapp] can't register spcom service
10-14 22:32:29.733 589 603 E secnvm : ch [sec_nvm_iuicc] can't register spcom service
10-14 22:32:29.733 589 600 E secnvm : fail to start Spcom Manager for sp_nvm (-19)
10-14 22:32:29.733 589 602 E secnvm : fail to start Spcom Manager for sampleapp (-19)
#!/bin/sh
macs="30:24:32:a9:f8:49 e0:2c:b2:57:45:64"
max="104857600"
for mac in $macs; do
datused=$(nlbw -c csv -g ip,mac | grep "\"$mac"\" | awk '{s+=$4 + S6} END {print s}')
#datused=$(cat /home/Jo/sample2.csv | grep "\"$mac"\" | awk '{s+=$4 + S6} END {print s}')
echo $mac $datused
ip=$(nlbw -c csv -g mac,ip | grep "\"$mac\"" | awk '{print $2}' | tr -d \")
if [ -z "$ip" ]; then
#!/usr/bin/micropython
import os
import ujson
import time
LIMIT = 100 * 1024 ** 2
@grimpy
grimpy / vm
Created November 5, 2019 08:54
#!/bin/bash
set -e
debug=0
reset=0
bridge=virbr0
storage=
basepath="$HOME/.cache/vm/"
image="$basepath/vmlinuz.efi"
kernelargs=""
--------- beginning of crash
11-23 16:42:24.004 3380 3401 E AndroidRuntime: FATAL EXCEPTION: pool-3-thread-1
11-23 16:42:24.004 3380 3401 E AndroidRuntime: Process: com.topjohnwu.magisk, PID: 3380
11-23 16:42:24.004 3380 3401 E AndroidRuntime: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14 SQLITE_CANTOPEN): Could not open database
11-23 16:42:24.004 3380 3401 E AndroidRuntime: at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
11-23 16:42:24.004 3380 3401 E AndroidRuntime: at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:215)
11-23 16:42:24.004 3380 3401 E AndroidRuntime: at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:197)
11-23 16:42:24.004 3380 3401 E AndroidRuntime: at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:505)
11-23 16:42:24.004 3380 3401 E AndroidRuntime: at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:2
@grimpy
grimpy / gproxy.py
Last active February 29, 2020 12:47
import gevent
from gevent.server import StreamServer
# we patch all
from gevent import monkey
monkey.noisy = False
monkey.patch_all()
import socket
#!/usr/bin/env python3
import mpd
def sorter(song):
return (int(song['date']), song['album'], int(song['disc']), int(song['track']))
def main():
client = mpd.MPDClient()