Skip to content

Instantly share code, notes, and snippets.

@alongthecloud
alongthecloud / simple_video_player.dart
Created July 8, 2023 13:27
Simple video player with subtitle support (Flutter)
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:path/path.dart' as Path;
import 'package:desktop_drop/desktop_drop.dart';
import 'package:video_player_win/video_player_win.dart';
// Simple video player with subtitle support (Flutter)
/* Using package
@alongthecloud
alongthecloud / getting_tweets_with_python.py
Last active August 30, 2023 02:32
example : getting tweets with Python3 (python-twitter-v2)
# Example of getting a Tweets with Python.
# require 'python-twitter-v2'
# This hasn't worked since the Twitter API policy changed. Since roughly July 2023
from pytwitter import Api
import sqlite3
def createTableIfNotExist(con):
try:
sqlcmd = "CREATE TABLE IF NOT EXISTS data (id BIGINT UNSIGNED NOT NULL PRIMARY KEY UNIQUE, text TEXT)"
@alongthecloud
alongthecloud / puzzled_image.py
Last active December 25, 2021 05:24
code for divides a picture into pieces and shuffle it (그림을 조각내어 섞는 코드)
# puzzled_image.py
# pip install pillow
import os
import sys
import random
from PIL import Image
from PIL import ImageOps
def puzzled_image(filepath, count_x, count_y,shuffle_count, invert=False):
filename = os.path.splitext(filepath)[0]
@alongthecloud
alongthecloud / runsshcommand.py
Created September 22, 2021 02:47
to connect ssh by paramiko library
import paramiko
import re
import time
# reference sites
# * https://stackoverflow.com/questions/1911690/nested-ssh-session-with-paramiko
# * https://stackoverflow.com/questions/53707630/paramiko-how-to-detect-if-command-executed-using-invoke-shell-has-finished
# use paramiko library
class SSHConnect:
@alongthecloud
alongthecloud / get_youtubestatics.py
Created July 25, 2021 11:24
Get statistics from the videoID
import json
import sys
import urllib3
YOUTUBE_API_KEY = ""
http = urllib3.PoolManager()
def main(videoId):
api_url = "https://www.googleapis.com/youtube/v3/videos?part=statistics&id=%s&key=%s" % (videoId, YOUTUBE_API_KEY);
@alongthecloud
alongthecloud / get_youtubelist_from_playlist.py
Created July 25, 2021 11:16
Get a list of YouTube video IDs from the playlist.
import urllib3
import json
import sys
YOUTUBE_API_KEY = ""
http = urllib3.PoolManager()
# reference (참고사이트)
# https://stackoverflow.com/questions/18953499/youtube-api-to-fetch-all-videos-on-a-channel