Skip to content

Instantly share code, notes, and snippets.

@figgis
figgis / gist:d3cff69be815491eff1ac9338aa78add
Last active May 21, 2024 13:40
H264 extract SEI using FFMPEG
// It's actually quite simple to extract unregistered sei data using ffmpeg, but I couln't find any documentation about how it's done
AVFrameSideData *sd;
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_SEI_UNREGISTERED);
if (sd) {
// First 15 bytes is the uuid, unregistered payload start at index 16 and the
// total size is given by sd->size
printf("side-data size %ld first-byte %u\n", sd->size, sd->data[16]);
@DenTelezhkin
DenTelezhkin / MeasureAppStartupTime.swift
Last active May 21, 2024 13:40
Measure iOS app startup time, in seconds, from the time user tapped an icon on the home screen (using time, when app process was created). Swift 4.
// Returns number of seconds passed between time when process was created and function was called
func measureAppStartUpTime() -> Double {
var kinfo = kinfo_proc()
var size = MemoryLayout<kinfo_proc>.stride
var mib : [Int32] = [CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()]
sysctl(&mib, u_int(mib.count), &kinfo, &size, nil, 0)
let start_time = kinfo.kp_proc.p_starttime
var time : timeval = timeval(tv_sec: 0, tv_usec: 0)
gettimeofday(&time, nil)
let currentTimeMilliseconds = Double(Int64(time.tv_sec) * 1000) + Double(time.tv_usec) / 1000.0
@adrianhajdin
adrianhajdin / globals.css
Created May 5, 2023 13:13
Next.js 13 Full Course 2023 | Build and Deploy a Full Stack App Using the Official React Framework
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap");
@tailwind base;
@tailwind components;
@tailwind utilities;
/*
Note: The styles for this gradient grid background is heavily inspired by the creator of this amazing site (https://dub.sh) – all credits go to them!
*/
@vladwa
vladwa / SSH.py
Created December 31, 2017 07:30
Python code to execute command as a sudo user over ssh connection on a remote server using "paramiko" module. On The code snippet establishes connection and executes the command and return the status and output of the executed command.
import logging
import paramiko
class SSH:
def __init__(self):
pass
def get_ssh_connection(self, ssh_machine, ssh_username, ssh_password):
"""Establishes a ssh connection to execute command.
:param ssh_machine: IP of the machine to which SSH connection to be established.
@devomman
devomman / office-activation.md
Created May 30, 2023 11:01
Office Activation Command by Omman

Office 2021

Method 1: Using my command line

Step 1.1: Open cmd program with administrator rights.

  • First, you need to open cmd in the admin mode, then run all commands below one by one.

Step 1.2: Get into the Office directory in cmd.

  • For x86 and x64
cd /d %ProgramFiles(x86)%\Microsoft Office\Office16
cd /d %ProgramFiles%\Microsoft Office\Office16
@Siguza
Siguza / pallas.sh
Last active May 21, 2024 13:35
newstyle OTA
#!/usr/bin/env zsh
set -e;
set +m; # Job control would've been nice, but manual round robin it is, sigh.
if [ -z "${ZSH_VERSION+x}" ]; then
echo 'Try again with zsh.';
exit 1;
fi;
@sefacan
sefacan / 2019-all-turkey-banks-binlist.csv
Last active May 21, 2024 13:35
Güncel BKM Tüm Bankalar Bin Listesi - Ekim 2019
MemberNo MemberName PrefixNo CardType BusinessCard
10 T.C.ZİRAAT BANKASI A.Ş. 404591 CREDIT CARD false
10 T.C.ZİRAAT BANKASI A.Ş. 407814 DEBIT CARD false
10 T.C.ZİRAAT BANKASI A.Ş. 413226 CREDIT CARD false
10 T.C.ZİRAAT BANKASI A.Ş. 444676 CREDIT CARD false
10 T.C.ZİRAAT BANKASI A.Ş. 444677 CREDIT CARD false
10 T.C.ZİRAAT BANKASI A.Ş. 444678 CREDIT CARD false
10 T.C.ZİRAAT BANKASI A.Ş. 447504 DEBIT CARD false
10 T.C.ZİRAAT BANKASI A.Ş. 454671 CREDIT CARD false
10 T.C.ZİRAAT BANKASI A.Ş. 454672 CREDIT CARD false
@TALlama
TALlama / anonymizer.rb
Created May 17, 2024 16:03
This class will use your existing FactoryBot factories to rewrite the data already in the db, keeping the associations and structure but replacing the content.
class Anonymizer
include ActiveSupport::Benchmarkable
attr_reader :factory_names, :callbacks
def initialize(factory_names = nil, callbacks = {})
raise ArgumentError.new("You must be in development to use the anonymizer") unless Rails.env.development?
require Rails.root.join("spec/factories") unless FactoryBot.factories.count > 0
@factory_names = [*factory_names].compact.map(&:to_sym)
@justvanrossum
justvanrossum / rename_fea_glyphs.py
Last active May 21, 2024 13:32
Rename glyph names in OpenType feature files
from functools import singledispatch
from io import StringIO
from fontTools.feaLib import ast
from fontTools.feaLib.error import FeatureLibError
from fontTools.feaLib.parser import Parser
def renameGlyphs(feaSource, renameFunc, glyphNames=()):
features = Parser(StringIO(feaSource), glyphNames=glyphNames).parse()
@findneo
findneo / BT 磁力搜索引擎索引
Created November 16, 2020 13:46 — forked from huazhanshen/BT 磁力搜索引擎索引
BT 磁力搜索引擎索引
btkitty
知名的BT磁力搜索,资源很多
http://cnbtkitty.com/
备用域名:http://btkitty.fyi/
idope.se
资源丰富的BT磁力搜索,并且大多数速度下载速度很快
https://idope.se/