Skip to content

Instantly share code, notes, and snippets.

View JiangXL's full-sized avatar
👀
?

H.F. JiangXL

👀
?
View GitHub Profile
@protrolium
protrolium / ffmpeg.md
Last active April 27, 2025 21:52
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@auscompgeek
auscompgeek / 70-keyboard.hwdb
Last active March 25, 2022 12:44
HP Spectre x360 - 13-4007tu | Arch Linux | dmidecode, lscpu, lspci, lsusb
# systemd's udev hwdb breaks our keyboard tablet mode switcheroo thing. Fix it.
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pnHPSpectrex360Convertible*:pvr*
KEYBOARD_KEY_ab=unknown # emitted by brightness keys
KEYBOARD_KEY_d7=f22 # normal mode - turn touchpad on
KEYBOARD_KEY_d8=f23 # tablet mode - turn touchpad off
@sillage
sillage / flactags.sh
Last active December 23, 2023 18:44
flac tags with metaflac
#!/bin/bash
# file format: ARTIST/ALBUM/01-TITLE.flac
read -p "YEAR? " -n 4 YEAR
ALBUM="${PWD##*/}" # ALBUM=$(basename "${PWD}")
ARTIST=$(echo $(cd .. && echo "${PWD##*/}"))
# delete all
metaflac --preserve-modtime --remove-all-tags *.flac
# artist, album, year and cover
metaflac --preserve-modtime --set-tag=ARTIST="${ARTIST}" --set-tag=ALBUM="${ALBUM}" --set-tag=DATE=${YEAR} --import-picture-from=Folder.jpg *.flac
@kevinkindom
kevinkindom / Python Socket 编程详细介绍.md
Last active April 18, 2025 06:52
Python Socket 编程详细介绍

Python Socket 编程详细介绍

Python 提供了两个基本的 socket 模块:

  • Socket 它提供了标准的BSD Socket API。
  • SocketServer 它提供了服务器重心,可以简化网络服务器的开发。

下面讲解下 Socket模块功能。

Socket 类型

@SapioBeasley
SapioBeasley / rss2pdf.md
Last active April 1, 2025 06:02
RSS feed to PDF

rss2pdf

Simple php page where after submitting an rss feed from news.google.com it will grab the contents of the RSS and gernerate a PDF output with one article from the XML per page.

Functionality is specifically made to parse news.google.com rss, but other rss feeds may be input as well. Other inputs will only display the description and no other data without further edits.

Demo

Input rss/xml feed you would like to have parsed submit it. You will see a notice to view your pdf submission. Click to view. An example url that you can use is http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss.

Run a live demo: http://sapioweb.com/rss2pdf

@joestrong
joestrong / Instructions.md
Last active April 6, 2023 13:30
Boot to application on Raspberry Pi

How to boot straight to application, with auto-login, and fluxbox as a window manager

  1. Write the raspbian-jessie-lite image to an SD card
  2. Run apt-get install xorg-server xinit fluxbox
  3. Edit /etc/systemd/system/getty.target.wants/[email protected] and add your username to ExecStart like ExecStart=-/sbin/agetty -a <user name> %I $TERM
  4. Add to bottom of .profile: [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
  5. Add ~/.xinitrc with:
exec /usr/bin/startfluxbox
@whophil
whophil / jupyter.service
Last active October 8, 2024 00:42 — forked from doowon/jupyter_systemd
A systemd script for running a Jupyter notebook server.
# After Ubuntu 16.04, Systemd becomes the default.
# It is simpler than https://gist.github.com/Doowon/38910829898a6624ce4ed554f082c4dd
[Unit]
Description=Jupyter Notebook
[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=/home/phil/Enthought/Canopy_64bit/User/bin/jupyter-notebook --config=/home/phil/.jupyter/jupyter_notebook_config.py
@silgon
silgon / write_read_json.jl
Last active March 16, 2025 15:33
How to Read and Write JSON files in julia
import JSON
###################
### Write data ####
###################
# dictionary to write
dict1 = Dict("param1" => 1, "param2" => 2,
"dict" => Dict("d1"=>1.,"d2"=>1.,"d3"=>1.))
# pass data as a json string (how it shall be displayed in a file)
stringdata = JSON.json(dict1)
@petebankhead
petebankhead / DoG_filter.ijm
Created December 27, 2016 19:05
An example ImageJ macro implementing a Difference of Gaussians filter
// Prompt to get sigma values for the Difference of Gaussians filtering
Dialog.create("Choose filter sizes for DoG filtering");
Dialog.addNumber("Gaussian sigma 1", 1);
Dialog.addNumber("Gaussian sigma 2", 2);
Dialog.show();
sigma1 = Dialog.getNumber();
sigma2 = Dialog.getNumber();
// Get the current image
idOrig = getImageID();
@alexellis
alexellis / timelapse.md
Created March 9, 2017 08:48 — forked from porjo/timelapse.md
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

ffmpeg -r 24 -pattern_type glob -i '*.JPG' -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4

  • -r 24 - output frame rate
  • -pattern_type glob -i '*.JPG' - all JPG files in the current directory
  • -i DSC_%04d.JPG - e.g. DSC_0397.JPG
  • -s hd1080 - 1920x1080 resolution

Slower, better quality