Skip to content

Instantly share code, notes, and snippets.

View jck's full-sized avatar

Keerthan Jaic jck

  • London, UK
View GitHub Profile
from random import randint
from myhdl import *
class MemPort:
def __init__(self,depth=128):
self.addr = Signal(modbv(0, min=0, max=depth))
self.wdata = Signal(intbv(0)[8:])
self.we = Signal(bool(0))
self.rdata = Signal(intbv(0)[8:])
def get_signals(self):
@harvimt
harvimt / metastruct.py
Last active December 19, 2015 14:49
Example metaclass implementation for Python 3 for the construct3 library
class CustomCollection():
def __init__(self):
super().__init__()
self.items = []
def __setitem__(self, key, value):
if key == '_':
self.items.append(value)
else:
self.items.append((key, value))
@nstarke
nstarke / release-android-debuggable.md
Last active May 19, 2024 12:58
How to make a Release Android App debuggable

How to make a Release Android App debuggable

Let's say you want to access the application shared preferences in /data/data/com.mypackage.
You could try to run adb shell and then run-as com.mypackage ( or adb shell run-as com.mypackge ls /data/data/com.mypackage/shared_prefs), but on a production release app downloaded from an app store you're most likely to see:

run-as: Package 'com.mypackage' is not debuggable
@habibutsu
habibutsu / distance.py
Last active October 29, 2021 15:38
Different ways calculate geo-distance in Python
'''
Requirements:
geographiclib==1.46.3
pyproj==1.9.5.1
geopy==1.11.0
git+https://github.com/xoolive/geodesy@c4eb611cc225908872715f7558ca6a686271327a
geo-py==0.4
'''
from math import radians, sin, cos, asin, sqrt, pi, atan, atan2, fabs
from time import time
// ==UserScript==
// @name Literotica DatatableJS
// @namespace botmtl
// @description literotica sort/filter tables
// @match https://www.literotica.com/*
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.16/js/jquery.dataTables.min.js
// @resource customCSS https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.16/css/jquery.dataTables.css
// @grant GM_addStyle
// @grant GM_getResourceText
@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active May 20, 2024 01:18
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

@hamidzr
hamidzr / sof-audio-setup-carbonx1.sh
Last active June 2, 2023 01:43
Lenovo Carbon X1 Gen 7 - Audio and microphone fix - https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_7) might be all you need.
#!/bin/bash
# README You probablyl don't need this script anymore. Please read the comments below to catch up.
## Description
# Lenovo Carbon X1 Gen 7 - Audio and microphone fix - kernel 5.3+ required.
# The script has only been tested for Arch and OpenSuse,
# Original thread: https://forums.lenovo.com/t5/Ubuntu/Guide-X1-Carbon-7th-Generation-Ubuntu-compatability/td-p/4489823
# Prereq: Install Linux 5.3 or newer
@stewartmcgown
stewartmcgown / takeout-discovery.json
Last active April 27, 2024 15:43
Google Takeout API
{
"title": "Takeout API",
"discoveryVersion": "v1",
"ownerName": "Google",
"version_module": true,
"resources": {
"exports": {
"methods": {
"get": {
"flatPath": "v2/{service}/exports/{exportId}",
@jevakallio
jevakallio / readme.md
Last active May 7, 2024 14:18
`adb pull` from app data directory without root access

TL;DR;

com.package.name is your app identifier, and the file path is relative to the app user's home directory, e.g. '/data/user/0/com.package.name.

adb shell run-as com.package.name cp relative/path/file.ext /sdcard
adb pull /sdcard/file.ext

See long explanation below.

@abersheeran
abersheeran / proxy.worker.js
Last active April 13, 2024 08:45
A proxy download cloudflare worker
addEventListener("fetch", (event) => {
event.respondWith(
handleRequest(event.request).catch(
(err) => new Response(err.stack, { status: 500 })
)
);
});
async function handleRequest(request) {
const url = getUrl(request)