Skip to content

Instantly share code, notes, and snippets.

@mine260309
mine260309 / Example_2_so_loading_1_a
Last active July 26, 2017 11:53
Sample code for dynamic libraries loadling a static library
This is the sample code for dynamic libraries loadling a static library, the behavior could be different with different compile/link options and dlopen() options.
@mine260309
mine260309 / main.py
Last active September 13, 2018 09:24
Script to get Zhangjian, Shanghai's AQI, take a picture and tweet the status
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import os
import re
import requests
from datetime import datetime
from twython import Twython
@mine260309
mine260309 / gist:70da43f6799efb9277c12172c65f8940
Last active March 8, 2019 08:15
Permissions used in Alipay 9.6.6
APK is pulled from Nexus6p and dumped with `aapt dump permissions base.apk`
package: com.eg.android.AlipayGphone
uses-permission: name='com.alipay.permission.ALIPAY_UPDATE_CREDENTIALS'
uses-permission: name='com.android.launcher.permission.INSTALL_SHORTCUT'
uses-permission: name='android.permission.BLUETOOTH'
uses-permission: name='android.permission.CHANGE_WIFI_STATE'
uses-permission: name='android.permission.CAMERA'
uses-permission: name='android.permission.ACCESS_NETWORK_STATE'
uses-permission: name='android.permission.MODIFY_AUDIO_SETTINGS'
#include "message.hpp"
#include <gtest/gtest.h>
namespace {
static uint8_t p[] ={0x3, 0x32, 0x34, 0x36};
constexpr auto eventspath = "./events";
event_record_t build_event_record(
const char* message,
const char* severity,
@mine260309
mine260309 / upload_and_update.py
Last active May 9, 2017 08:53
A single util to upload and update OpenBMC image
#!/usr/bin/env python
"""
Usage: upload_and_update.py <--file tarball>
<--tftp user@tftp-ip:/path/to/tftproot>
[--password SSH-PASSWORD-TO-TFTP]
--bmc <bmc-ip>
[-v]
This scripts copies OpenBMC tarball to TFTP server,
and uses REST APIs to update the tarball to BMC.
@mine260309
mine260309 / download_youku_to_aac.sh
Last active August 2, 2018 03:39
Download from youku and convert it to aac, as a podcast
#!/bin/sh
# Depends:
# you-get
# ffmpeg
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <url>"
exit 1
fi
@mine260309
mine260309 / Makefile
Last active February 11, 2019 04:52
Demo of bug about init priority in both gcc and clang
CC=g++
#CC=clang++
CFLAGS=-c -Wall -fpic
BUGFLAG=-DBUG
SOURCES=main.cpp bar.cpp
all: main
main: main.o libbar.so
$(CC) -o main main.o -ldl
# Put the binaries on BMC
### Test test_sdbusplus_emit_object
root@romulus:/tmp# ./test_sdbusplus_emit_object&
[1] 445
### By default, the object has 4 interfaces
root@romulus:/tmp# busctl call xyz.openbmc_project.ObjectMapper /xyz/openbmc_project/object_mapper xyz.openbmc_project.ObjectMapper GetObject sas /xyz/openbmc_project/leiyu 0
a{sas} 1 "xyz.openbmc_project.LeiYu.Test" 4 "org.freedesktop.DBus.Introspectable" "org.freedesktop.DBus.ObjectManager" "org.freedesktop.DBus.Peer" "org.freedesktop.DBus.Properties"
@mine260309
mine260309 / libpldm (including oem) test on Big Endian system
Last active March 17, 2020 09:09
Run OpenBMC Jenkins jobs in Shanghai Lab
#Environment to be set in Jenkins
# BIG_ENDIAN_SYSTEM_IP=<IP>
# USER=<USER> (setup by ssh-copy-id)
#!/bin/bash
set -xe
BRANCH_LOCAL=local_test
TMP_LOCAL_REPO=/tmp/test_pldm
rm -rf ${TMP_LOCAL_REPO}