This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SRC_DIR="${1}" | |
MARK="${2}" | |
if [[ "$#" -lt "2" ]] ; then | |
echo "A small script for adding watermark to images." | |
echo "Usage: $0 INPUT_IMAGE_FOLDER WATER_MARK_FILE" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# need to install ffmpeg with x265 enabled, on macOS: | |
# sudo port install ffmpeg +nonfree | |
# or | |
# brew install ffmpeg --HEAD --with-fdk-aac --with-sdl2 --with-freetype \ | |
# --with-libass --with-libbluray --with-libvorbis --with-libvpx \ | |
# --with-opus --with-webp --with-x265 | |
encode() { | |
ffmpeg -i "$1" \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A script to convert a CentOS Minimal to an oVirt template | |
yum install https://resources.ovirt.org/pub/yum-repo/ovirt-release43.rpm | |
yum install -y wget git vim ovirt-guest-agent-common cloud-init | |
yum clean all | |
systemctl enable ovirt-guest-agent | |
# systemctl enable cloud-init | |
echo > /etc/machine-id | |
rm -f /etc/ssh/ssh_host_* | |
rm -rf /root/.ssh/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function y = kMeans(m, k, i) | |
% m: input matrix | |
% row: each column is a sample | |
% column: sample number | |
% k: k clusters | |
% y: vector consist of the cluster number of each sample | |
[sampleNum, featureNum] = size(m); | |
centers = m(1:k, :); | |
y = zeros(sampleNum,1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% usage: | |
% octave-cli iris.m | |
fid = fopen('iris.data'); | |
irisTextData = textscan(fid,'%f %f %f %f %s', 200, 'Delimiter',','); | |
fclose (fid); | |
irisMatrix = cell2mat(irisTextData(:,1:4)); | |
k = 3; | |
clusterID = kMeans(irisMatrix, k); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Y=KLTransform(X, d) | |
[sampleNum, featureNum] = size(X); | |
m = mean(X); | |
for i = 1:sampleNum | |
X(i,:) = X(i,:) - m; | |
end | |
C = cov(X); | |
[V, D] = eig(C); | |
S = [diag(D), V]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Y=glcm(X, dx, dy, grayScale) | |
% (dx, dy): | |
% ( 1, 0) 0° | |
% ( 0, 1) 45° | |
% ( 1, 1) 90° | |
% (-1, 1) 135° | |
[m, n] = size(X); | |
maxGrayScale = max(X) + 1; | |
X = floor(X.*grayScale./maxGrayScale); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LEARNING_RATE = 0.1; | |
MAX_ITERATIONS = 1e3; | |
MIN_ERROR = 1e-3; | |
%load input and target | |
perceptron_data; | |
[numInst, numDims] = size(input); | |
numClasses = size(target,2); | |
weights = randn(numClasses, 3*numDims); | |
isDone = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
bool CONVERGED = false; | |
int const MUTATION_STEP = 1e2; | |
int const ROULETTE_SIZE = 1e3; | |
int const MAX_INTERATION = 1e5; | |
void init(vector<string>& status) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# for dep in $(pip show somepackage | grep Requires | sed 's/Requires: //g; s/,//g') ; do pip uninstall -y $dep ; done | |
for dep in $(pip show "$1" | grep Requires | sed 's/Requires: //g; s/,//g') ; do | |
pip uninstall -y $dep | |
done | |
pip uninstall -y "$1" |
OlderNewer