Skip to content

Instantly share code, notes, and snippets.

View wongsyrone's full-sized avatar
😂
Babysitting

Syrone Wong wongsyrone

😂
Babysitting
View GitHub Profile
@wongsyrone
wongsyrone / tmux-cheatsheet.markdown
Created November 6, 2021 08:52 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@wongsyrone
wongsyrone / Correct_GnuPG_Permission.sh
Created July 26, 2021 03:29 — forked from oseme-techguy/Correct_GnuPG_Permission.sh
This fixes the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error while using Gnupg .
#!/usr/bin/env bash
# To fix the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error
# Make sure that the .gnupg directory and its contents is accessibile by your user.
chown -R $(whoami) ~/.gnupg/
# Also correct the permissions and access rights on the directory
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg
@wongsyrone
wongsyrone / dump-pyc-with-gdb.md
Created June 14, 2021 13:09 — forked from stecman/dump-pyc-with-gdb.md
Dumping all bytecode from a packaged Python application

This is a technique for extracting all imported modules from a packaged Python application as .pyc files, then decompiling them. The target program needs to be run from scratch, but no debugging symbols are necessary (assuming an unmodified build of Python is being used).

This was originally performed on 64-bit Linux with a Python 3.6 target. The Python scripts have since been updated to handle pyc files for Python 2.7 - 3.9.

Theory

In Python we can leverage the fact that any module import involving a .py* file will eventually arrive as ready-to-execute Python code object at this function:

PyObject* PyEval_EvalCode(PyObject *co, PyObject *globals, PyObject *locals);

KVM OSX Guest 10.11 (El Capitan) with Clover

  • Some notes about this approach:
    • An OSX Installer USB drive for Install OS X El Capitan is created
    • Clover is then installed on the USB drive
    • Clover Configurator is then run on the USB drive
    • The USB drive contents are copied to the VM host
    • VNC is used to connect to the guest UI
  • The qxl virtual video device is used (part of the standard kvm qemu install)
@wongsyrone
wongsyrone / nginx-v2ray.conf
Last active February 18, 2019 13:23 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/dhparam.pem 2048
@wongsyrone
wongsyrone / OpenSSL-1_1_0-stable-VS2015.md
Created February 4, 2018 14:52 — forked from terrillmoore/OpenSSL-1_1_0-stable-VS2015.md
Building OpenSSL 1.1.0 with Microsoft VS 2015

Building OpenSSL 1.1.0 with Microsoft VS 2015

MCCI needs OpenSSL for a Windows project (that will be cross-platform). A casual search didn't turn up either a good source for cross-platform libraries, which meant we have to build them ourselves. A deeper search found a detailed guide here, and yet the details don't match what I found when I checked out the code; and the post doesn't talk about doing it directly from GitHub (which I wanted to do).

Here's the procedure for building OpenSSL on 64-bit Windows 10, with Visual Studio 2015.

  1. If you don't have it, please install git bash from git-scm.com.
  2. Start a git bash window.

    In the following, I'll use lines beginning with {dir} $ to designate input to a bash Window. We'll also have to use a cmd.exe Window for much of the build, and those lines will be marked {dir}>, just as on Windows..

@wongsyrone
wongsyrone / part2.sh
Last active January 21, 2018 15:21 — forked from fgoinai/part2.sh
ln -sf /usr/share/zoneinfo/$(tzselect) /etc/localtime
hwclock --systohc
nano /etc/locale.gen && locale-gen
read -p "Default LANG is? [en_US,zh_CN...]" loc
echo "LANG=$loc.UTF-8" >> /etc/locale.conf
read -p "Hostname is?" hn
echo $hc > /etc/hostname
echo "127.0.1.1\t$hc.localdomain\t$hc" > /etc/hosts
@wongsyrone
wongsyrone / part1.sh
Created January 21, 2018 15:21 — forked from fgoinai/part1.sh
#!/bin/bash
#check network connection
con=$(ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` > /dev/null && echo ok || echo error)
if [ $con == "error" ]; then
exit -1
fi
timedatectl set-ntp true
lsblk
@wongsyrone
wongsyrone / introrx.md
Created November 26, 2017 00:53 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing