Skip to content

Instantly share code, notes, and snippets.

View NeuroWhAI's full-sized avatar
🤔
Thinking

NeuroWhAI NeuroWhAI

🤔
Thinking
View GitHub Profile
@NeuroWhAI
NeuroWhAI / index.js
Created January 18, 2023 14:14
Google Drive API - List folders and download images inside
import { google } from 'googleapis';
import * as fs from 'fs';
function authGoogleApi() {
let auth = new google.auth.GoogleAuth({
keyFile: './service-account.json',
scopes: [
'https://www.googleapis.com/auth/drive.readonly',
],
});
@NeuroWhAI
NeuroWhAI / video.py
Created August 15, 2020 07:19
이미지 시퀀스를 ffmpeg로 YouTube용 영상으로 변환하기. (720p)
import os
from os import walk
list_file = "img_paths.txt"
for (_, _, filenames) in walk("img"):
with open(list_file, "w") as f:
f.writelines(map(lambda name: f"file img/{name}\n", filenames))
break
@NeuroWhAI
NeuroWhAI / kma-radar.py
Created August 5, 2020 13:35
날씨누리 레이더 영상 크롤링
import urllib.request
from datetime import datetime, timedelta
import time
tm = datetime(2020, 8, 5, 22, 00) # 이 시점부터 과거로 가면서 얻음.
while True:
tm_str = tm.strftime("%Y%m%d%H%M")
url = f"https://www.weather.go.kr/w/cgi-bin/rdr_new/nph-rdr_sat_lgt_img_v3?tm={tm_str}&sat=ir1&rdr=lng&map=HC&size=640&zoom_level=0&zoom_x=0000000&zoom_y=0000000&fog=0"
print(tm_str)
try:
@NeuroWhAI
NeuroWhAI / Program.cs
Created June 25, 2020 13:16
Send a message to the FCM.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Net;
using System.IO;
using Google.Apis.Auth.OAuth2;
using Newtonsoft.Json;
@NeuroWhAI
NeuroWhAI / pews.py
Created May 4, 2020 11:21
기상청 실시간 지진 감시에서 관측소 진도 데이터만 얻는 예시
import requests
import datetime
head_len = 4
station_cnt = 265 # 원래는 s 파일에서 얻어와야할 정보.
time_offset = 1000
time = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(milliseconds=time_offset)
bin_time = time.strftime('%Y%m%d%H%M%S')
@NeuroWhAI
NeuroWhAI / stereo-visualizer.rs
Created February 22, 2020 12:15
Stereo Visualizer
use ggez::{
audio::{self, SoundSource},
conf::{WindowSetup, WindowMode},
error::GameError,
event, graphics,
input::keyboard,
graphics::DrawParam,
Context, GameResult,
};
use rodio::Source;
@NeuroWhAI
NeuroWhAI / rule.rs
Created January 24, 2020 11:34
규칙 찾기 문제 풀다가 머리가 잘 안 돌아가서 뇌 준비운동으로 만듦.
use std::iter::FromIterator;
/// A rule for repositioning characters in a string.
struct Rule(Vec<usize>);
impl Rule {
/// Applies this rule to the input and returns the result.
///
/// # Examples
///
@NeuroWhAI
NeuroWhAI / Pews.cs
Last active May 3, 2020 12:21
기상청 실시간 지진 감시 페이지 크롤러.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Threading;
using System.Net.Http;
using System.Net;
using System.IO;
@NeuroWhAI
NeuroWhAI / rocketguide.md
Created December 17, 2019 14:01 — forked from belst/rocketguide.md
Deploy Rocket in production

Deploy Rocket using Letsencrypt and nginx

Information

This guide uses the domain your-domain.tld and its www. prefixed version. It starts the rocket application on 127.0.0.1:1337 and as the user www-data. The proxy listens on port 80 and 443 though.
If you need other values, update them accordingly in your nginx and systemd configs.

Prerequisites

You need to have nginx, certbot and rust installed.

<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Anime4K</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='stylesheet' type='text/css' media='screen' href='main.css'>
<script src='main.js'></script>
</head>