Skip to content

Instantly share code, notes, and snippets.

View fduch2k's full-sized avatar

Alexander Hramov fduch2k

View GitHub Profile
@fduch2k
fduch2k / test-for-this-in-getter.js
Last active August 25, 2022 12:41
Test for understand how to works getters and this in js objects
class Test {
_name = 'test1'
get name() {
return this._name
}
getName() {
return this._name
}
@fduch2k
fduch2k / m3u8download.sh
Created May 5, 2018 16:09 — forked from patrickgill/m3u8download.sh
download m3u8 ts segments, then decode, join, and remux them! (HTTP Live Streaming TS files)
# download
aria2c -x 5 -i file.m3u8
# decode (example)
openssl aes-128-cbc -d -K 15D0F46608409DA364E3F5D92BDE9F61 -iv 00000000000000000000000000000000 -nosalt -in G00000000.ts -out G00000000.d.ts
# join all ts files
cat *.ts > out.ts
# convert ts output file
@fduch2k
fduch2k / background.js
Created March 9, 2018 08:04 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@fduch2k
fduch2k / gist:204f51f2abcdb88a3fd6
Created March 23, 2016 09:34 — forked from rootscity/gist:fcf909f5820407a67c8e
angular-material modal drag directive
// Usage
//
//<md-dialog rc-drag="md-toolbar" ng-cloak>
// <form>
// <md-toolbar>
// ...
// </md-toolbar>
// <md-dialog-content>
// ...
// </md-dialog-content>
@fduch2k
fduch2k / nginx.conf
Created December 1, 2015 12:37 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
var mongoose = require('mongoose');
mongoose.connect('localhost', 'testing_multiTenant');
/**
* User schema.
*/
var UserSchema = new mongoose.Schema({
name: String
, prefix: { type: String, required: true }
@fduch2k
fduch2k / hack.sh
Last active August 29, 2015 14:09 — forked from erikh/hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
defaults write -g ApplePressAndHoldEnabled -bool false
defaults write com.apple.Dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0.5
defaults write com.apple.LaunchServices LSQuarantine -bool NO
defaults write NSGlobalDomain KeyRepeat -int 0
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
@fduch2k
fduch2k / config.rb
Created October 16, 2013 06:13 — forked from rinatio/config.rb
# for more information look at help.github.com/capistrano/
set :application, "yii2-app-basic"
server "example.com", :web # your server address or IP
set :user, "username" # your username for ssh
set :use_sudo, false
# set the remote directory you're going to deploy to
set :deploy_to, "/home/#{user}/www/#{application}"
# disable rails specific normalize_assets property
#!/bin/sh
#
# For each ref, validate the commit.
#
# - It disallows deleting branches without a /.
# - It disallows non fast-forward on branches without a /.
# - It disallows deleting tags without a /.
# - It disallows unannotated tags to be pushed.