Skip to content

Instantly share code, notes, and snippets.

View dongguangming's full-sized avatar

dongguangming dongguangming

View GitHub Profile
@dongguangming
dongguangming / build-gcc.sh
Created April 27, 2021 04:25 — forked from jeetsukumaran/build-gcc.sh
Build and Install GCC Suite from Scratch
#! /bin/bash
GCC_VERSION="5.2.0"
WORKDIR="$HOME/src/"
INSTALLDIR="/platform"
## NOTE: XCode must be installed (through App Store) and the following run to install command-line tools.
## THIS IS IMPORTANT! Among other things, it creates '/usr/include' and installs the system header files.
# xcode-select --install

Building GCC 9.2.0 on CentOS 7

Introduction

CentOS 7 distribution (as well as RHEL 7) ships with a somewhat outdated version of the GCC compiler (4.8.5 on CentOS 7.5), which may not be suitable to your compilation requirements. For example, C11 - which supersedes C99 - is fully supported only starting from GCC 4.9).

Additionally, recent versions of GCC (GCC6, GCC7, GCC8, GCC9) come with improvements which help detect issues at build time and offer suggestions on how to fix them. Sometimes, these are even actually helpful!

This note describes how to build the latest GCC (9.2.0 as of October 2019) from sources on CentOS 7. This should be applicable as is on RHEL 7. For other Linux distributions, adapt as needed.

@dongguangming
dongguangming / tcp_connect.stp
Created April 21, 2021 08:48 — forked from fireflyc/tcp_connect.stp
systemtap统计TCP连接数量
#!/usr/bin/stap
global connections
global filter_port = 80
//
global report
global spend_time
global active_count
global have_spend_time = 0
@dongguangming
dongguangming / rabbitmq-autocluster_k8s_persistent.bash
Created December 12, 2020 18:33 — forked from gmr/rabbitmq-autocluster_k8s_persistent.bash
Deploy rabbitmq-autocluster on k8s with persistent storage (EBS)
#!/bin/bash
set -eo pipefail
export KUBE_NAMESPACE=test
export REPLICA_COUNT=3
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1beta1
kind: StatefulSet
@dongguangming
dongguangming / UnsafeTest.java
Created October 21, 2020 21:10 — forked from raphw/UnsafeTest.java
A demonstration of sun.misc.Unsafe
import org.junit.Before;
import org.junit.Test;
import sun.misc.Unsafe;
import sun.reflect.ReflectionFactory;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import static org.junit.Assert.assertEquals;
@dongguangming
dongguangming / ffmpeg_install.sh
Created August 27, 2018 05:08 — forked from nekojaxa/ffmpeg_install.sh
ffmpeg_install.sh
#!/bin/sh
sudo yum -y install autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
#Yasm
cd ~/ffmpeg_sources
git clone --depth 1 git://github.com/yasm/yasm.git
cd yasm
autoreconf -fiv
@dongguangming
dongguangming / run-jar-as-a-service.md
Created May 11, 2018 06:43 — forked from marlonbernardes/run-jar-as-a-service.md
How to make a jar file run on startup
  1. Create the start and stop scripts of your application.
  • Example:

myapp-start.sh

#!/bin/bash
cd /home/ubuntu/myapp/
java -jar myapp.jar --server.port=8888 &

install kubernetes 1.6 on centos 7.3

Install kubelet, kubeadm, docker, kubectl and kubernetes-cni

1. Install Yum Repo

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64
@dongguangming
dongguangming / readme.md
Created July 28, 2017 04:39 — forked from troyfontaine/readme.md
Resize root partition (or how to remove the default /home partition) on CentOS 7 online

Resize root partition (or how to remove the default /home partition) on CentOS 7 online

This requires you to be able to ssh into the instance using the root user account and that no services be running as users out of /home on the target machine.

The examples are from a default installation with no customation-you NEED to know what you're working with for volumes/partitions to not horribly break things.

By default, CentOS 7 uses XFS for the file system and Logical Volume Manager (LVM), creating 3 partitions: /,/home and

Step 1 - Copy /home Contents

To backup the contents of /home, do the following:

@dongguangming
dongguangming / whatsapp_phone_enumerator_floated_div.js
Created June 5, 2017 08:47
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses (floated div)
/****** I've created a Chrome extension from this script, take a look at https://github.com/LoranKloeze/WhatsAllApp ********/
/*
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses
Floated div edition
01-05-2017
(c) 2017 - Loran Kloeze - [email protected]
This script creates a UI on top of the WhatsApp Web interface. It enumerates certain kinds
of information from a range of phonenumbers. It doesn't matter if these numbers are part