Skip to content

Instantly share code, notes, and snippets.

View wiccy46's full-sized avatar

Jiajun wiccy46

  • Holoplot
  • Berlin
View GitHub Profile
@wiccy46
wiccy46 / conversion.py
Created February 7, 2020 08:21
[conversion] A collection of python conversion #python
# List of string to a long string.
alist = ['1', '2', '3', '4']
alist_joint = ' '.join(alist)
# Long string to list
astring = '1 2 3 4'
alist = astring.split(sep=' ')
@wiccy46
wiccy46 / gammatone.py
Created December 18, 2019 21:59
[gammatone]Gammatone filter #python
# Try Gammatonefilter
t = np.linspace(0, 1, 1000) # Time
f = 4 # center freq
theta = 0 # phase
b = 1 # filter bandwidth
n = 3 # filter order
a = 1. # Amp
g = a * np.power(t, (n-1)) * np.exp(-2 * np.pi * b * t) * np.cos(2 * np.pi * f * t + theta)
@wiccy46
wiccy46 / youtube_dl.txt
Last active February 11, 2020 21:50
[youtube-dl]Download Youtube Video as Audio Format #terminal #bash #shell
youtube-dl --extract-audio --audio-format wav --audio-quality 0 --postprocessor-args "-ss 00:00:00.00 -t 00:05:00.00" https://www.youtube.com/watch?v=n
@wiccy46
wiccy46 / juce_logger.cpp
Created September 22, 2019 15:19
[Juce_logger]Juce Logger on GUI #c++ #juce
TextEditor diagnosticsBox;
void logMessage(const String& m){
diagnosticsBox.moveCaretToEnd();
diagnosticsBox.insertTextAtCaret(m + newLine);
}
// resized()
diagnosticsBox.setBounds;
@wiccy46
wiccy46 / 1darray2colvec.py
Last active September 20, 2019 08:10
[1darray2colvec]Convert 1D array to Column Vector in Python #python
a = np.arange(10) # (10, )
a.reshape(-1, 1) # (10, 1)
@wiccy46
wiccy46 / flutter_filler.dart
Created August 28, 2019 15:39
[flutter_filler] Basic filler of a flutter project #dart #flutter
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
home: MyApp(),
));
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
@wiccy46
wiccy46 / [tmux.md]
Last active August 26, 2019 08:50
[tmux_cheatsheet]Useful tmux commands #tmux
## Session Management
Sessions are useful for completely separating work environments. I have a ‘Work’ session and a ‘Play’ session; in ‘Work’, I keep everything open that I need during my day-to-day development, while in ‘Play’, I keep open current open-source gems or other work I hack on at home.
tmux new -s session_name
creates a new tmux session named session_name
tmux attach -t session_name
attaches to an existing tmux session named session_name
tmux switch -t session_name
switches to an existing session named session_name
@wiccy46
wiccy46 / multichannel_vector_to_matrix.py
Last active August 13, 2019 14:36
[multichannel_vector_to_matrix]Convert a long multichannel audio vector into a n columns numpy array #python #audio
n_columns_ndarray = long_audio_vector.reshape((-1, num_of_channels))
@wiccy46
wiccy46 / get_all_files_name.py
Last active August 12, 2019 16:32
[get_all_files_name]Get all files names into a list #python
import os
file_names = os.listdir("file_path")
@wiccy46
wiccy46 / printVector.cpp
Created August 9, 2019 09:27
[printVector]Print C++ vector #c++
for (std::vector<int>::const_iterator i = vecName.begin(); i != vecName.end(); ++i)
std::cout << *i << std::endl;