Skip to content

Instantly share code, notes, and snippets.

View oboje's full-sized avatar
🎯
Focusing

Igor Popov oboje

🎯
Focusing
  • New York
View GitHub Profile
@kirillshevch
kirillshevch / telegram_animated_sticker_ffmpeg.md
Last active April 21, 2024 15:13
How to convert video into Telegram Animated Sticker with FFmpeg (WEBM)

How to convert video into Telegram Animated Sticker with FFmpeg (WEBM)

ffmpeg -y -i input.mov -r 30 -t 2.99 -an -c:v libvpx-vp9 -pix_fmt yuva420p -vf 'scale=512:512:force_original_aspect_ratio=decrease' output.webm

Here is a breakdown of the options:

-y - Overwrite the output file if it already exists.

extension Task where Failure == Error {
// Start a new Task with a timeout. If the timeout expires before the operation is
// completed then the task is cancelled and an error is thrown.
init(priority: TaskPriority? = nil, timeout: TimeInterval, operation: @escaping @Sendable () async throws -> Success) {
self = Task(priority: priority) {
try await withThrowingTaskGroup(of: Success.self) { group -> Success in
group.addTask(operation: operation)
group.addTask {
try await _Concurrency.Task.sleep(nanoseconds: UInt64(timeout * 1_000_000_000))
@wallentx
wallentx / chiastat
Created May 11, 2021 01:38
Dumping chia info to individual items to query via webserver endpoint
#!/usr/bin/env bash
source /home/your/path/to/chia-blockchain/activate
STR=$(chia farm summary | head -8)
FARM=$(chia farm summary | head -8 | sed 's/ /_/g; s/:_/=/g') #jq -Rs '{chia:split("\n")|map(split(": ")|{(.[0]):.[1]}?)}'
ACTIVE=$(pgrep -fa 'chia plots create' | wc -l)
printem() {
echo "Active_Plots=$ACTIVE"
public func with<T>(_ item: inout T, action: (inout T) -> Void) {
action(&item)
}
public func with<T>(_ item: T, action: (T) -> Void) {
action(item)
}
public func with<T: AnyObject>(_ item: T, action: (T) -> Void) {
action(item)
@jverkoey
jverkoey / stream.swift
Last active December 16, 2017 07:52
Stream prototype in swift
/**
An Observable emits values to its subscribed observers.
A minimal implementation based upon the reactivex specification:
http://reactivex.io/documentation/observable.html
*/
public class Observable<Value> {
/** Add a new observer. The provided instance will receive all values provided to onNext. */
public func subscribe(_ observer: @escaping (Value) -> Void) -> Observable<Value> {
observers.append(observer)
@paulll
paulll / webp2gif
Last active March 7, 2020 17:21
Convert webp animation to gif
#!/usr/bin/env zsh
# example usage:
# $ webp2gif input.webp output.gif
dir0=`pwd`
dir=`mktemp -d`
cd $dir
for i in $(seq -f "$04g" 0 1000); do; webpmux -get frame $i $dir0/$1 -o "$i.webp"; done;
mkdir png
for i in {0..1000}; do; dwebp "$i.webp" -o "png/$i.png"; done;
@hsavit1
hsavit1 / RAC_Gesture.m
Created July 25, 2015 04:14
RAC demonstration of a pan gesture
@interface RACGestureViewController ()
@property(weak, nonatomic) IBOutlet UILabel *translationLabel;
@property(weak, nonatomic) IBOutlet UILabel *stateLabel;
@property(strong, nonatomic) RACSubject *animationDelegate;
@property(weak, nonatomic) IBOutlet UILabel *pinchLabel;
@end
@implementation RACGestureViewController
@hsavit1
hsavit1 / RAC_Samples.m
Created July 21, 2015 00:53
101 RAC Sample
//
// main.m
// 101RACSamples
//
// Created by Matthew Doig on 1/26/14.
// Copyright (c) 2014 DWI. All rights reserved.
//
#pragma mark Asynchronous operators
@phrawzty
phrawzty / 2serv.py
Last active July 22, 2024 13:51
simple python http server to dump request headers
#!/usr/bin/env python2
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active June 17, 2024 06:08
The best FRP iOS resources.

Videos