Skip to content

Instantly share code, notes, and snippets.

View j40903272's full-sized avatar

YunDa Tsai j40903272

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@j40903272
j40903272 / ffmpeg.md
Created July 28, 2020 17:56 — forked from protrolium/ffmpeg.md
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@j40903272
j40903272 / hpc_hw3.md
Last active June 1, 2020 17:18
ntu csie hpc hw3

install r-base

sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo apt update
sudo apt install r-base

install bigstatsr, bigsnpr

# open R

[TOC]

clone

git clone -b v1.6.1 https://github.com/facebookresearch/faiss.git
cd faiss

requirement

install BLAS

@j40903272
j40903272 / jupyter_add_kernel.md
Last active March 3, 2020 06:33
jupyter notebook add new kernel
@j40903272
j40903272 / Install_python3.7.md
Last active May 21, 2025 13:04
Install python3.7

Install from apt

  1. setup
python3 -V
apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
apt update
import sys
import numpy as np
import pandas as pd
from Trace import Trace
from AES import Sbox, Rcon
CipherCsv, TraceCsv = sys.argv[2], sys.argv[1]
all_trace_df = pd.read_csv("case1/Trace.csv", header=None)
all_cipher_df = pd.read_csv("case1/Ciphertext.csv", header=None)
cipher_state = all_cipher_df.values
@j40903272
j40903272 / facenet_distance.py
Created August 23, 2018 10:04
Facenet distance
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
import scipy.misc
import cv2
import facenet
image_size = 200 #don't need equal to real image size, but this value should not small than this
modeldir = '' #change to your model dir [https://drive.google.com/open?id=1EXPBSXwTaqrSC0OhUdXNmKSh9qJUQ55-]
@j40903272
j40903272 / tf_keras_gpu_memory
Created July 17, 2018 06:05
Limit gpu memory usage
import tensorflow as tf
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.3)
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
# keras
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.1
#config.gpu_options.allow_growth=True
set_session(tf.Session(config=config))
@j40903272
j40903272 / malconv_keras
Last active July 17, 2018 09:31
This is the implementation of MalConv proposed in [Malware Detection by Eating a Whole EXE](https://arxiv.org/abs/1710.09435).
from keras.models import Model
from keras.layers import Dense, Embedding, Conv1D, multiply, GlobalMaxPool1D, Input, Reshape, Activation
class Malconv()
def __init__(self, max_len=30000, win_size=500, vocab_size=257):
inp = Input((max_len,))
emb = Embedding(vocab_size, 8)(inp)
conv1 = Conv1D(kernel_size = (win_size), filters = 128, strides=(win_size), padding='same')(emb)