Skip to content

Instantly share code, notes, and snippets.

View spartazhc's full-sized avatar

spartazhc spartazhc

  • Shanghai Jiaotong University
  • Shanghai
View GitHub Profile
@EnriqueSoria
EnriqueSoria / validate_dataclass.py
Last active July 18, 2024 13:25 — forked from rochacbruno/validate_dataclass.py
Validate Dataclass Python
import logging
from dataclasses import dataclass
from typing import Union, List
logger = logging.getLogger(__name__)
class Validations:
@ivanstepanovftw
ivanstepanovftw / vtune-amplifier-install.md
Last active March 1, 2023 12:11
Patch if Intel's shitty installer cant find libraries, but they are presents

If you cannot install Intel VTune Amplifier on Manjaro/Arch Linux (or other non-supported OS), because this shit cannot find installed libraries via ldconfig -p, you can use this script.
Unpack vtune_amplifier_2019_update3.tar.gz, then go to vtune_amplifier_2019_update3, then copy and paste following:

shopt -s globstar

for i in **/sysreq.cab; do
    echo "processing ${i}"
    perl -pi -e 's/(\W*)RESULT=255(.*)/\1RESULT=1  \2/' "${i}"  # COMPARE_VERSIONS() never returns 255
    perl -pi -e 's/(\W*)LI_(.+)=unsupp(.*)/\1LI_\2=ok    \3/' "${i}"
@yuq-1s
yuq-1s / setup-sjtu-vpn.sh
Last active February 15, 2022 08:06
Setup SJTU VPN connection from Ubuntu 16.04 desktop
# Install dependencies
sudo apt install libcurl4-openssl-dev iptables-dev autoconf libgmp3-dev libssl-dev pkg-config
# Install StrongSwan
wget http://download.strongswan.org/strongswan-5.6.1.tar.bz2
tar xjvf strongswan-5.6.1.tar.bz2 && cd strongswan-5.6.1
# FIXME: Some of these options may be redundant, but they work on my laptop.
autoconf && ./configure \
--prefix=/usr/local \
@alastairmccormack
alastairmccormack / iframe-probe.py
Last active January 19, 2026 14:07
Shows GOP structure for video file using ffmpeg --show-frames output
#!/usr/bin/env python
#
# Shows GOP structure of video file. Useful for checking suitability for HLS and DASH packaging.
# Example:
#
# $ iframe-probe.py myvideo.mp4
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
@sytsereitsma
sytsereitsma / gist:1b370c558a4a34dfe014
Last active October 3, 2024 07:58
[Jenkins] Clear build queue and cancel all builds
def q = Jenkins.instance.queue
q.items.findAll { q.cancel(it.task) }
//q.items.findAll { it.task.name.startsWith('my') }.each { q.cancel(it.task) }
def items = Jenkins.instance.items
items.each { job ->
job.builds.findAll { build -> build.building }.each { run ->
println("Aborting: " + job.name)
run.doStop();
}

CLang optimizations on Mac OSX

Version:

Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

This was made with commands: