Skip to content

Instantly share code, notes, and snippets.

View dpavlin's full-sized avatar

Dobrica Pavlinušić dpavlin

View GitHub Profile
@enjoy-digital
enjoy-digital / arty.py
Last active January 27, 2022 22:37
LiteEth Interboard demo between Arty and Butterstick
#!/usr/bin/env python3
# LiteEth UDP Inter-board stream demo.
#
# Copyright (c) 2022 Florent Kermarrec <florent@enjoy-digital.fr>
# SPDX-License-Identifier: BSD-2-Clause
# ./arty.py --build --load
import os
@supix
supix / postgres_recovery.md
Last active April 22, 2024 20:37
Postgres error: Missing chunk 0 for toast value in pg_toast

The problem

In some cases, it is possible that PostgreSQL tables get corrupted. This can happen in case of hardware failures (e.g. hard disk drives with write-back cache enabled, RAID controllers with faulty/worn out battery backup, etc.), as clearly reported in this wiki page. Furthermore, it can happen in case of incorrect setup, as well.

One of the symptoms of such corruptions is the following message:

ERROR: missing chunk number 0 for toast value 123456 in pg_toast_45678

This almost surely indicates that a corrupted chunk is present within a table file. But there is a good way to get rid of it.

@varhub
varhub / Android - Enable ADB from recovery.md
Created December 23, 2016 17:54
Android - Enable ADB from recovery

Android - Enable ADB from recovery

Credits to @TheOnlyAnil-@Firelord[^stackoverflow]

  • Requirements: a) stock recovery + rooted phone b) custom recovery

  • Files changed:

@ali1234
ali1234 / quintic.py
Created June 3, 2016 01:42
Reverse engineering of budget fitness band using quintic qn9021...
#!/usr/bin/env python
#Connecting to: 08:7C:BE:8F:3C:FB, address type: public
#Service <uuid=Generic Attribute handleStart=12 handleEnd=15> :
# Characteristic <Service Changed>, hnd=0xd, supports READ INDICATE
# -> '\x01\x00\xff\xff'
#Service <uuid=Generic Access handleStart=1 handleEnd=11> :
# Characteristic <Device Name>, hnd=0x2, supports READ WRITE
# -> 'Quintic BLE'
# Characteristic <Appearance>, hnd=0x4, supports READ
@EatMoreCode
EatMoreCode / mojo_and_mqtt.pl
Created August 28, 2015 02:59
WebApp consuming MQTT messages and providing data via HTTP
#!/usr/bin/env perl
# ./mojo_and_mqtt.pl daemon
use Mojolicious::Lite;
use EV;
use AnyEvent;
use AnyEvent::MQTT;
my $mqtt = AnyEvent::MQTT->new;
@warewolf
warewolf / gist:c185d17008dd1639138f
Created January 1, 2015 02:21
SMI USB flash drive controller identification page
# sg_raw -r 525 /dev/sg2 f0 04 00 00 00 00 00 00 00 00 00 01
>>> transport error: Host_status=0x03 [DID_TIME_OUT]
Driver_status=0x00 [DRIVER_OK, SUGGEST_OK]
SCSI Status: Good
Received 525 bytes of data:
00 02 00 43 30 4b 40 02 c0 17 22 22 30 4b 38 02 c0 ..C0K@...""0K8..
10 1a 22 22 30 4b 30 02 c0 1d 22 22 30 4b 29 02 c0 .""0K0...""0K)..
@dpavlin
dpavlin / qr-wifi.sh
Created August 21, 2013 12:08
Generate #QR code for #WIFI network
#/bin/sh -xe
# Generate QR code for WIFI network
test -z "$1" && echo -n "ssid: " && read ssid || ssid=$1
test -z "$2" && echo -n "password: " && read pass || pass=$2
qrencode -o /tmp/qr-${ssid}.png "WIFI:S:$ssid;T:WPA;P:$pass;" ; qiv -m /tmp/qr-${ssid}.png
use warnings;
use Getopt::Std;
getopt('xytGgwsf',\%opts);
# pcm file = $opts{f}
# samples per pixel x
$xscale = $opts{x} // 1200;
@afresh1
afresh1 / tcpbench_client.pl
Created December 14, 2012 04:23
This is a [Mojolicious](http://mojolicio.us) streaming http server that opens a [tcpbench](http://www.openbsd.org/cgi-bin/man.cgi?query=tcpbench) connection to back to you. For me this lets me put the page on my server on the net and connect back to my home system and see the results on anything with a web browser. Mostly based on the [EventSour…
#!/usr/bin/perl
# Start this on a server someplace with tcpbench
# Start tcpbench -s on a machine that is the remote IP you are connecting the the web from
# Browse to the page.
use Mojolicious::Lite;
use Mojo::IOLoop;
use Mojo::IOLoop::Stream;
# Template with browser-side code
get '/' => sub {
@chrox
chrox / github-upload.py
Created November 2, 2012 15:34
build and upload customupdate of kindlepdfviewer automatically
#!/usr/bin/python
import os
import sys
import time
from datetime import datetime,timedelta
import subprocess
from github import Github
PROXY = "http://192.168.1.101:7071"
USER_TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"