Skip to content

Instantly share code, notes, and snippets.

View mishazawa's full-sized avatar
🎩
because white is boring

mishazawa

🎩
because white is boring
View GitHub Profile
@mishazawa
mishazawa / VPS: iptables+node+pm2.md
Created February 24, 2017 15:26 — forked from pilotak/VPS: iptables+node+pm2.md
Basic VPS setting + node.js + pm2

If you have an access as a root to your Ubuntu 16.04 VPS you should setup another user giving him sudo access

Create user

adduser pavel # my user is called "pavel"; enter password and leave all the rest
usermod -aG sudo pavel
nano /etc/ssh/sshd_config # disable root access
# find 
    PermitRootLogin # change value to: no
# add
    AllowUsers pavel
@mishazawa
mishazawa / webm.sh
Created June 3, 2017 07:04
mp4 -> webm
ffmpeg -i input-file.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output-file.webm
@mishazawa
mishazawa / settings.json
Last active October 24, 2022 22:43
sublime settings
{
"vintage_start_in_command_mode": true,
"rulers": [120, 100, 80],
"tab_size": 2,
"translate_tabs_to_spaces": true,
"highlight_line": true,
"caret_style": "blink",
"caret_extra_width": 0,
"match_brackets_angle": true,
"draw_white_space": "all",
@mishazawa
mishazawa / redux-fetch-interceptors.js
Created March 26, 2018 12:35 — forked from jaysoo/redux-fetch-interceptors.js
Redux + fetch interceptors
/*
* WARNING: Mutates the fetchContext argument (by default the window or global context).
*
* A crude way to intercept fetch responses, and dispatch actions as needed. Using this
* for more global app concerns, where I may want to dispatch actions depending on the response
* status or body. e.g. When seeing a 401, dispatch a logout action.
*
* In most cases, I'd recommend using a middlware as shown in redux's real-world example.
* (https://github.com/reactjs/redux/blob/master/examples/real-world/middleware/api.js)
*

Convert bandcamp-friendly wav

ffmpeg -i $track -ar 48000 -ac 2 -acodec pcm_s32le output.wav

Convert bandcamp-friendly cover

convert $cover -resize 1400x1400\! cover.jpg
mx=320;
my=$2;
head -c "$((3*mx*my))" /dev/urandom | convert -depth 8 -size "${mx}x${my}" RGB:- $1
# dd if=/dev/zero of=output.dat bs=1M count=24
echo "$(gzip -c "$1" | wc -c) bytes"
@mishazawa
mishazawa / long-polling.html
Created September 21, 2018 07:08 — forked from kixxauth/long-polling.html
A Node.js http long polling server for HTTP streaming.
<!DOCTYPE html>
<html>
<style type="text/css">
body {
font-size: 18px;
background: #000;
color: #fff;
}
#container {
width: 600px;
@mishazawa
mishazawa / alac -> flac
Created October 19, 2018 08:19
alac -> flac
for f in *.m4a; do ffmpeg -i "$f" "${f%.m4a}.flac"; done
@mishazawa
mishazawa / menurc
Created October 20, 2018 16:57
ps -> gimp keybindings
; This file installs keyboard shortcuts from Photoshop 6 in GIMP 2.8.
;
; Rename it to 'menurc' and place it into your personal GIMP directory:
; ~/.gimp-2.8 folder (Linux) or C:\Documents and Settings\<user>\.gimp-2.8
; folder (Windows).
;
; There is a web-page describing these keybindings at
; http://epierce.freeshell.org/gimp/gimp_ps.php
;
(gtk_accel_path "<Actions>/view/view-shrink-wrap" "")
@mishazawa
mishazawa / hls.sh
Created October 31, 2018 10:04
mp4 -> hls
ffmpeg -i input.mp4 -profile:v baseline -level 3.0 -s 640x360 -start_number 0 -hls_time 10 -hls_list_size 0 -f hls index.m3u8