Skip to content

Instantly share code, notes, and snippets.

View QiangZiBro's full-sized avatar
😎
Focusing

qiangzibro QiangZiBro

😎
Focusing
  • Iluvatar CoreX
  • China
View GitHub Profile
# __*__ conding:utf-8 __*__
# author: dust
# python -V : 3.7
import time
import logging
import traceback
import pymysql
import pymysql.cursors
@pplux
pplux / watermark.sh
Created August 28, 2020 14:14
Script to use ffmpeg to watermark a video
#!/bin/bash
VIDEO="video.mp4"
IMAGE="logo.png"
SIZE=200
OUTPUT="output.mp4"
OFFSET_X=50
OFFSET_Y=50
while getopts v:i:o:s:x:y: option
do case "${option}"
@ckandoth
ckandoth / single_machine_slurm_on_ubuntu.md
Last active May 19, 2024 07:49
Install Slurm 19.05 on a standalone machine running Ubuntu 20.04

Use apt to install the necessary packages:

sudo apt install -y slurm-wlm slurm-wlm-doc

Load file:///usr/share/doc/slurm-wlm/html/configurator.html in a browser (or file://wsl%24/Ubuntu/usr/share/doc/slurm-wlm/html/configurator.html on WSL2), and:

  1. Set your machine's hostname in SlurmctldHost and NodeName.
  2. Set CPUs as appropriate, and optionally Sockets, CoresPerSocket, and ThreadsPerCore. Use command lscpu to find what you have.
  3. Set RealMemory to the number of megabytes you want to allocate to Slurm jobs,
  4. Set StateSaveLocation to /var/spool/slurm-llnl.
  5. Set ProctrackType to linuxproc because processes are less likely to escape Slurm control on a single machine config.
@zxf8665905
zxf8665905 / image2video.py
Created May 11, 2018 04:11
image to video
video_name = 'out.mp4'
frame = cv2.imread(images[0])
height, width, layers = frame.shape
fourcc = cv2.VideoWriter_fourcc(*'H264’) # may try x264
video = cv2.VideoWriter(video_name, fourcc, 6, (width,height))
for image in images:
video.write(cv2.imread(image))
@kittinan
kittinan / client.py
Last active June 6, 2024 10:29
Python OpenCV webcam send image frame over socket
import cv2
import io
import socket
import struct
import time
import pickle
import zlib
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(('192.168.1.124', 8485))
@eguven
eguven / brew-list.sh
Last active June 12, 2024 13:30
List all packages installed using Homebrew and their sizes
# this original one uses values returned from 'brew info'
brew list --formula | xargs -n1 -P8 -I {} \
sh -c "brew info {} | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | \
sort -h -r -k2 - | column -t
# faster alternative using 'du'
du -sch $(brew --cellar)/*/* | sed "s|$(brew --cellar)/\([^/]*\)/.*|\1|" | sort -k1h