Skip to content

Instantly share code, notes, and snippets.

@Meettya
Meettya / extend.ts
Created August 5, 2024 08:19
extend TS
export const extend = (deep: boolean, target: any, ...args: any[]): any => {
if (!_isClass(deep, 'Boolean')) {
args.unshift(target);
[target, deep] = [deep || {}, false];
}
// Handle case when target is a string or something (possible in deep copy)
target = _isPrimitiveType(target) ? {} : target;
for (const options of args) {
@Meettya
Meettya / cookieval.js
Created July 1, 2024 10:07
valid cookie value
// %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
const res = []
res.push(String.fromCharCode(0x21))
for (let i = 0x23; i <= 0x2b; i++) {
res.push(String.fromCharCode(i));
}
@Meettya
Meettya / cookiere.js
Created July 1, 2024 09:09
valid cookie name Re
/**
*
* token = 1*<any CHAR except CTLs or separators>
separators = "(" | ")" | "<" | ">" | "@"
| "," | ";" | ":" | "\" | <">
| "/" | "[" | "]" | "?" | "="
| "{" | "}" | SP | HT
*
*/
@Meettya
Meettya / repack.sh
Created April 26, 2024 00:03
MKV repacker for ffmpeg docker
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 [--extension <file_extension>] --audio <audio_directory> --subtitle <subtitle_directory> <source_directory> <destination_root_directory>"
exit 1
}
# Function to check write permission
check_write_permission() {
@Meettya
Meettya / image_loader.jade
Created May 16, 2013 18:22
Just naive cached image loader in coffee with jade
extends includes/layout
block content
:coffeescript
images_srcs = [
'http://st.gdefon.ru/wallpapers_original/wallpapers/241906_kotenok_mordochka_trava_pushistyj_1920x1200_(www.GdeFon.ru).jpg'
'http://www.allfons.ru/pic/201112/1920x1080/allfons.ru-967.jpg'
'http://st.gdefon.ru/wallpapers_original/wallpapers/155879_kotyonok_vzglyad_kotye_1920x1200_(www.GdeFon.ru).jpg'
'http://st.gdefon.ru/wallpapers_original/wallpapers/17769_kotenok_ryzhij_pushistyj_fortepiano_1280x1024.jpg'
'http://catfoto.com/uploads/images/00/00/18/2011/02/12/7999cc.jpg'
@Meettya
Meettya / gist:5416608
Created April 18, 2013 22:03
Raphael moveable&resizable rectangle with active cocners, proto
doctype html
html
head
meta(charset='utf-8', http-equiv='X-UA-Compatible', content='IE=edge,chrome=1')
title Project name
link(rel='stylesheet', href = 'css/style.css')
script(src='vendor/mock.js')
[user]
name =
email =
[core]
autocrlf = input
safecrlf = true
whitespace = fix, -indent-with-non-tab, trailing-space, cr-at-eol
pager = less -R
@Meettya
Meettya / gist:3368422
Created August 16, 2012 08:32
ffmpeg command to save still images from video
# 1) to save all frames from (-i INPUT_VIDEO) input video file,
# (-ss 00:10:00) started at 10 minute and (-t 10) stop after 10 seconds,
# (-same_quant) use same quantizer as source (-f image2) with image2 muxer and
# (img-%04d.jpg) img-0001.jpg pattern
#
# - you get bunch of files
ffmpeg -i INPUT_VIDEO -ss 00:10:00 -t 10 -same_quant -f image2 img-%04d.jpg
# 2) to save (-r 6) 6 frames in second
TravelMate:bin meettya$ ./ab -n 10000 -c 480 -k http://192.168.1.2:3000/?url=$RANDOM
This is ApacheBench, Version 2.3 <$Revision: 1178079 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.1.2 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
@Meettya
Meettya / gist:3082964
Created July 10, 2012 12:22 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt