Skip to content

Instantly share code, notes, and snippets.

computed: {
...mapState({
sidebar: state => state.app.sidebar,
device: state => state.app.device,
showSettings: state => state.settings.showSettings,
needTagsView: state => state.settings.tagsView,
fixedHeader: state => state.settings.fixedHeader
}),
classObj() {
@andrewpedia
andrewpedia / BUILDING.md
Created September 12, 2020 01:07 — forked from yan12125/BUILDING.md
Build a custom kernel for Android emulator
git clone https://android.googlesource.com/kernel/goldfish/ -b android-goldfish-3.18
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9
cd goldfish
export CROSS_COMPILE=x86_64-linux-android-
export ARCH=x86_64
export PATH=$PATH:/path/to/x86_64-linux-android-4.9/bin
make x86_64_ranchu_defconfig
make menuconfig  # enable overlayfs and namespaces support here
make -j8
@andrewpedia
andrewpedia / hook_native.py
Created September 12, 2020 03:13
Frida spawn Android app + hook native function
import frida, sys
ss = """
Interceptor.attach(Module.findExportByName(null, "dlopen"), {
onEnter: function (args) {
this.path = Memory.readUtf8String(args[0]);
},
onLeave: function (retval) {
if(!retval.isNull() && this.path.includes('libtest.so')) {
var fstatat = resolveAddress('libtest.so', '0x0', '0x17FEB5');
@andrewpedia
andrewpedia / 1_kubernetes_on_macOS.md
Created September 13, 2020 08:05 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@andrewpedia
andrewpedia / .md
Created September 16, 2020 13:29 — forked from rahulrajaram/.md
Python: Write to a file from multiple threads

I recently came across the need to spawn multiple threads, each of which needs to write to the same file. Since the file will experience contention from multiple resources, we need to guarantee thread-safety.

NOTE: The following examples work with Python 3.x. To execute the following programs using Python 2.7, please replace threading.get_ident() with thread.get_ident(). As a result, you would need to import thread and not threading.

  1. (The following example will take a very long time). It will create 200 threads, each of which will wait until a global lock is available for acquisition.
# threading_lock.py
import threading
@andrewpedia
andrewpedia / Ethereum_private_network.md
Created September 21, 2020 13:15 — forked from 0mkara/Ethereum_private_network.md
Ethereum private network configuration guide.

Create your own Ethereum private network

Introduction

Used nodes:

Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux
Linux localhost.localdomain 4.14.5-200.fc26.x86_64 #1 SMP Mon Dec 11 16:29:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
@andrewpedia
andrewpedia / django-json-example.py
Created October 6, 2020 05:31 — forked from cspanring/django-json-example.py
Basic example for iterating over a Django queryset and returning JSON objects.
import json
from .models import MyModel
def get_json(request):
# Return JSON for filtered MyModel objects
records = MyModel.objects.filter(myproperty=myvalue)
@andrewpedia
andrewpedia / nginx
Created October 16, 2020 12:44 — forked from brunoqs/gist:219f5e9852b718d831bce502bdd2e511
Easy deploy Django Nginx + gunicorn and Vuejs or Reactjs
---------------- Django Nginx + gunicorn ----------------
Primeiro rode o gunicorn no repositorio do projeto:
$ gunicorn --bind 0.0.0.0:8000 my_academic.wsgi &
Depois crie a seguinte configuração no Nginx (/etc/nginx/sites-available):
server {
access_log /home/user/code_back/logs/access.log;
error_log /home/user/code_back/logs/error.log;
@andrewpedia
andrewpedia / genesis.json
Created October 30, 2020 13:20 — forked from dickolsson/genesis.json
Example genesis.json for an Ethereum blockchain
{
"config": {
"chainId": 33,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000033",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
@andrewpedia
andrewpedia / RSA_example.py
Created October 31, 2020 05:46 — forked from syedrakib/RSA_example.py
An example of asymmetric encryption in python using a public/private keypair - utilizes RSA from PyCrypto library
# Inspired from http://coding4streetcred.com/blog/post/Asymmetric-Encryption-Revisited-(in-PyCrypto)
# PyCrypto docs available at https://www.dlitz.net/software/pycrypto/api/2.6/
from Crypto import Random
from Crypto.PublicKey import RSA
import base64
def generate_keys():
# RSA modulus length must be a multiple of 256 and >= 1024
modulus_length = 256*4 # use larger value in production