Skip to content

Instantly share code, notes, and snippets.

@ProjectEli
ProjectEli / recordvoice.py
Created May 5, 2021 17:31
Record voice and save to wav file (PCM)
import speech_recognition
with speech_recognition.Microphone() as src:
audio = speech_recognition.Recognizer().listen(src)
print("Listening...")
with open('recordedaudio.wav','wb') as f:
f.write(audio.get_wav_data())
@ProjectEli
ProjectEli / VoiceRecognition.py
Created May 5, 2021 17:33
Voice recognition with speech_recognition and google speech to text API
import speech_recognition
recognizer = speech_recognition.Recognizer()
with speech_recognition.Microphone() as src:
try:
audio = recognizer.adjust_for_ambient_noise(src)
print("Threshold Value After calibration:" + str(recognizer.energy_threshold))
print("Please speak:")
audio = recognizer.listen(src)
@ProjectEli
ProjectEli / ExcelControl.py
Created May 5, 2021 17:36
Simple Microsoft Excel controller with win32com.client
import win32com.client, win32ui
class ExcelControl:
def __init__(self):
# Initialize Excel app
self.excel = win32com.client.Dispatch("Excel.Application")
self.excel.Visible=True
def Openfile(self):
# open file
@ProjectEli
ProjectEli / redcolor.py
Created May 9, 2021 09:48
draw red line on windows screen
import win32gui
import win32api
dc = win32gui.GetDC(0)
red = win32api.RGB(255, 0, 0)
x = 3030
y= 100
# for k in range(100):
# win32gui.SetPixel(dc, x, y+k, red) # draw red at 0,0
@ProjectEli
ProjectEli / gamma_eqn.m
Created May 9, 2021 09:52
[MATLAB] RGB gamma interpolation 3D
close all; clear; clc;
color_raw=0:0.05:1;
RGB_Lift_raw=(0:0.05:2).';
Ncolor = length(color_raw); vcolor=ones(1,Ncolor);
NLift = length(RGB_Lift_raw); vLift = ones(NLift,1);
color = vLift * color_raw;
RGB_Lift = RGB_Lift_raw * vcolor;
@ProjectEli
ProjectEli / MATLAB_struct_innerval_looptest.m
Created May 19, 2021 02:16
Check lazy copy behavior of struct in MATLAB
% ref: https://kr.mathworks.com/matlabcentral/answers/719-declaring-many-variables-from-work-space-into-function-workspace
%% Init
close all; clear; clc; disp(mfilename);
N=5;
%% Main
S = struct;
S.increment = 1;
S.x = 0;
S = allocatelargevariable(S);
@ProjectEli
ProjectEli / Alpaca.py
Created July 7, 2021 14:51
알파카 - GPT-3를 사용한 음성인식
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
# https://cloud.google.com/translate/docs/basic/quickstart?hl=ko
def translate_text(target, text):
"""Translates text into the target language.
Target must be an ISO 639-1 language code.
See https://g.co/cloud/translate/v2/translate-reference#supported_languages
@ProjectEli
ProjectEli / Philips_328E_6500K_smart_uniformity
Last active November 8, 2021 06:54
Philips 328E (ProjectEli measured)
Wavelength(nm) Relative_spectral_irradiance(a.u.)
166.7 10.1667
167.18 12.3333
167.659 17.1111
168.139 21.8889
168.618 24.5556
169.098 23.5556
169.577 21.6667
170.057 20.5556
170.536 21.3333
@ProjectEli
ProjectEli / Make C# dll with cdecl support for autohotkey.md
Last active July 29, 2024 08:49
Make C# dll with cdecl support for autohotkey

Why this gist needs?

Autohotkey library supports DllCall() and it can call dll with standard decl feature of c dll. However, typical c# library runs on IL and cannot be called from autohotkey. To support standard dll call, DllExport package is required in Visual Studio.

Step by step

1. Create C# .Net framework library project in Visual studio

image

2. Set projectName

The name will be automatically set to the namespace. image

@ProjectEli
ProjectEli / 레벨별 스탯포인트
Last active August 3, 2024 08:11
테일즈위버 재분배 관련
# 자동 재분 업데이트 ref: https://tales.nexon.com/News/DevNote/698?pageSize=20
# 1~255 ref: https://tw-chapter.tistory.com/230
# 원래 테일즈 가이드북에 있었으나 현재 소실된것으로 추정
# 255~310 ref: https://blog.naver.com/tatelulove4
# 직접 눌러보면서 구현된 것 리버스 엔지니어링
2~6 = 2
7~22 = 3
23~48 = 4
49~80 = 5
81~129 = 6