Skip to content

Instantly share code, notes, and snippets.

View tingplenting's full-sized avatar

Kar tingplenting

  • tingplenting.github.io
  • Yogyakarta, Indonesia
View GitHub Profile
@tingplenting
tingplenting / ffmpeg_convert.py
Created September 18, 2018 07:28
bulk convert with ffmpeg and python
import os
DIRECTORY = "videos2"
for f in os.listdir(DIRECTORY):
if f.endswith(".mp4"):
in_file = DIRECTORY + '/' + f
out_file = DIRECTORY + '/ytout-- ' + f
ex = 'ffmpeg -i "{in_file}" -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a aac -b:a 384k -profile:a aac_low "{out_file}"'.format(in_file=in_file, out_file=out_file)
os.system(ex)
@tingplenting
tingplenting / ffmpeg_tuts.md
Last active May 23, 2025 02:30
ffmpeg cli for youtube

Extract audio from a YouTube video file

ffmpeg -i INPUT.mp4 -ab 256k OUTPUT.mp3

Cut 3s length

ffmpeg -y -ss 00:00:03 -i INPUT.mp4 -codec copy OUTPUT.mp4
@tingplenting
tingplenting / tatar1000pi.py
Last active October 16, 2018 04:18
menghitung pi seirbu digit setelah koma. taruh jumlah digit di main(1000)
def calcPi(limit): # Generator function
"""
Prints out the digits of PI
until it reaches the given limit
"""
q, r, t, k, n, l = 1, 0, 1, 1, 3, 3
decimal = limit
counter = 0
import statistics as _s
# diketahui
A = list(range(1000000))
# 4a
def mean_odd_number(n):
odds = filter(lambda x: x % 2, n)
return _s.mean(odds)
<input class="checkit" type="checkbox" name="daftar" value="Bike"> I have a bike<br>
<input class="checkit" type="checkbox" name="daftar" value="Car" checked> I have a car<br>
<input class="checkit" type="checkbox" name="daftar" value="Pen" checked> I have a Pen<br>
<input type="button" onclick="alert(getCheckedCheckboxesFor('daftar'));" value="Get Values" />
<button id="create">Create file</button>
<a download="info.txt" id="downloadlink" style="display: none">Download</a>
<script>
function getCheckedCheckboxesFor(checkboxName) {