Skip to content

Instantly share code, notes, and snippets.

View zhang-ray's full-sized avatar
😁
Focusing

Ruihuai(Ray) Zhang zhang-ray

😁
Focusing
View GitHub Profile
# prerequisites
sudo apt -y install imagemagick x264 ffmpeg
# orig.jpg is the original high-quality image
# convert to H.264(AVC) format
convert orig.jpg a.yuv
x264 -o a.avc --input-res 4608x3456 a.yuv
ffmpeg -i a.avc rec.bmp
#!/bin/bash
# Build and distribute Ardour. Make ready-to-run Ardour more accessable.
# However, paying for Ardour is appreciated - developing Ardour is not a easy work, they have been spending too much time and energey on Ardour.
myinstall () {
sudo apt --quiet --fix-missing -y install $1
}
sudo apt update
@zhang-ray
zhang-ray / randomize-mac-addresses.sh
Last active February 19, 2019 02:11 — forked from fawkesley/randomize-mac-addresses.sh
In Ubuntu 16.04, randomize WiFi MAC addresses with a daily rotation - /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses.sh
#!/bin/sh
#LOG_FILE=/var/log/randomize-mac-addresses
#echo "$(date): $*" > ${LOG_FILE}
UUID_DAILY_HASH=$(echo "$(date +%F)" | md5sum)
RANDOM_MAC="b2:$(echo -n ${UUID_DAILY_HASH} | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5/')"
ip link set dev wlp1s0 down
@zhang-ray
zhang-ray / build.gradle
Last active April 18, 2021 15:48
maven mirror from aliyun for android
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven{ url 'https://maven.aliyun.com/repository/jcenter/'}
maven{ url 'https://maven.aliyun.com/repository/google/'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
# THIS SCRIPT IS UNDER TEST
# reference: https://www.jb51.net/article/142818.htm
# assume you're root
egrep -c '(svm|vmx)' /proc/cpuinfo
apt update
apt -y install qemu qemu-kvm libvirt-bin bridge-utils virt-manager
systemctl start libvirtd.service
//g++ main.cpp -lcrypto
#include <openssl/aes.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <string>
#include <sstream>
#include <vector>
#include <iostream>
using std::string;
sudo mdutil -a -i off # creepy spotlight