Skip to content

Instantly share code, notes, and snippets.

@karnauskas
karnauskas / webhook.py
Created October 19, 2024 18:31 — forked from xjxckk/webhook.py
Discord webhook with Python requests
import requests, json
url = 'https://discord.com/api/webhooks/123/131232123' # Create webhook in your server integrations and copy webhook URL here
## Text only:
data = {
"content" : "Test webhook message"
}
result = requests.post(url, json=data)
@karnauskas
karnauskas / MC7710 GPS and Mikrotik
Created July 31, 2024 17:17 — forked from mmv-ru/MC7710 GPS and Mikrotik
Sierra Wireless MC7710 GPS and Mikrotik
Sierra Wireless MC7710 Ports
It depends on enumeration scheme. For DIP mode with (default) USB composition #3 selected, /dev/ttyUSBn ports are expected to be mapped as follows:
n=0 - HIP (CnS);
n=1 - QCDM (diag);
n=2 - NMEA;
n=3 - AT command;
n=4 - modem.
Please note that there isn't necessarily a 1-1 relationship between the MCxxxx serial interface numbers and the Linux /dev/ttyUSBn devices. The latter number space is shared between all USB serial devices in the system, and there is no guarantee that the AT port always will be /dev/ttyUSB2 (or whatever).
@karnauskas
karnauskas / dhcp_server.py
Created June 22, 2023 05:00 — forked from yosshy/dhcp_server.py
DHCP Server with Python Scapy
from scapy.all import DHCP_am
from scapy.base_classes import Net
dhcp_server = DHCP_am(iface='eth1', domain='example.com',
pool=Net('192.168.10.0/24'),
network='192.168.10.0/24',
gw='192.168.10.254',
renewal_time=600, lease_time=3600)
dhcp_server()
@karnauskas
karnauskas / init.c
Created March 20, 2023 10:40 — forked from rofl0r/init.c
minimal init daemon by rich felker, author of musl libc
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
int main()
{
sigset_t set;
int status;
if (getpid() != 1) return 1;
@karnauskas
karnauskas / now_tv_hg_612_openwrt.md
Created February 27, 2023 03:08 — forked from gzzsound/now_tv_hg_612_openwrt.md
NOW TV configuration for Openreach HG612 + OpenWRT router

I am hoping to save a few hours for people like me who have a modem + router setup and switched to NOW TV ISP.

Extract Client ID and Vendor Class ID from DHCP handshake

  • Connect to the NOW TV router and select "WANOE only" from advanced > router mode
  • With a computer connected to LAN 2, using Wireshark, collect DHCP Client ID and Vendor Class ID (options 60 and 61) (1)
  • Convert those two values to hexadecimal

Configuration for HG 612

@karnauskas
karnauskas / deskew.py
Created December 13, 2021 22:32 — forked from russss/deskew.py
Automatic scanned image rotation/deskew with OpenCV
import cv2
import numpy as np
def deskew(im, max_skew=10):
height, width = im.shape
# Create a grayscale image and denoise it
im_gs = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
im_gs = cv2.fastNlMeansDenoising(im_gs, h=3)
/*****************************************
* Read QSee/Zmodo cameras *
* Forward stream to FIFO pipe *
* Author: Daniel Osborne *
* Based on IP Cam Viewer by Robert Chou *
* License: Public Domain *
*****************************************/
/* Version history
* 0.41 - 2013-05-03
@karnauskas
karnauskas / 00README.md
Created November 27, 2021 16:36 — forked from smarek/00README.md
E3372s-153 from Stick mode to HiLink mode automatic installer

E3372s from STICK to HiLink mode installer

You need

  • curl, usb-modeswitch, grep, awk, sudo (not necessary, last step can fail safely)
  • balong_flash in $PATH ( https://github.com/forth32/balongflash.git )
  • atinout in $PATH ( https://github.com/beralt/atinout.git will work fine )
  • 2 files we flash (core sw update version 22.x, WebUI installer), we use these (you can probably use different balong-compatible):
    • core sw: "E3372sUpdate_22.298.03.02.965.BIN" / "E3372sUpdate_22.298.03.02.965.exe"
    • webui: "Update_WEBUI_17.100.06.00.03_Hilink_V7R2_9x25_CPIO.exe"
@karnauskas
karnauskas / androidManifestDecompress.py
Created November 24, 2021 01:14 — forked from i64/androidManifestDecompress.py
decompress androidmanifest file in python
class AndroidXMLDecompress():
endDocTag = 0x00100101
startTag = 0x00100102
endTag = 0x00100103
def decompressXML(self, xml: bytearray) -> str:
finalXml = str()
numbStrings = self.LEW(xml, 4*4)
@karnauskas
karnauskas / PKPass.md
Created November 16, 2021 21:32 — forked from rlanyi/PKPass.md
How to create Apple PKPass .p12 certificate using Linux

How to create Apple PKPass .p12 certificate using Linux

You don't need a Mac to do this :-)

For generating PKPass files, you'll need 4 things after this tutorial:

  • Certificate Identifier (pass.com.example.www)
  • Team Identified (Organizational Unit (OU) in the cert generated by Apple)
  • The .p12 file
  • The password for the .p12 file