Skip to content

Instantly share code, notes, and snippets.

View drefined's full-sized avatar

David Phruksukarn drefined

  • San Diego, CA
View GitHub Profile
@drefined
drefined / mock_websocket_server.ex
Created July 21, 2022 04:35 — forked from pulkit110/mock_websocket_server.ex
Supplementary Code for Testing WebSocket Clients in Elixir with a Mock Server
defmodule Commerce.Orders.MockWebsocketServer do
use Plug.Router
plug(:match)
plug(:dispatch)
match _ do
send_resp(conn, 200, "Hello from plug")
end
@drefined
drefined / split_wav.py
Created April 20, 2018 03:09 — forked from rudolfbyker/split_wav.py
Split WAV files at silence
#!/usr/bin/env python
from scipy.io import wavfile
import os
import numpy as np
import argparse
from tqdm import tqdm
# Utility functions
@drefined
drefined / ffmpeg.md
Created March 30, 2018 05:51 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@drefined
drefined / vhost.conf
Created September 9, 2016 06:37 — forked from ryzy/vhost.conf
Nginx with HTTP/2 support (and behind HAProxy with HTTP/2)
server {
listen 80 default_server;
listen 81 default_server http2 proxy_protocol; ## Needed when behind HAProxy with SSL termination + HTTP/2 support
listen 443 default_server ssl http2;
ssl_certificate /etc/ssl/dummy.crt;
ssl_certificate_key /etc/ssl/dummy.key;
root /data/www/default;
index index.html;
@drefined
drefined / haproxy.cfg
Created September 9, 2016 06:37 — forked from ryzy/haproxy.cfg
HAProxy conf with SSL termination and HTTP/2 support
global
#debug
chroot /var/lib/haproxy
user haproxy
group haproxy
pidfile /var/run/haproxy.pid
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
@drefined
drefined / appserver.nginx.conf
Created September 9, 2016 05:38
Basic Nginx Gateway / App setup. DO NOT SIMPLY COPY PASTE WITHOUT UNDERSTANDING THE CONTENTS.
server {
# Listen on internal ports only. Do not expose this server directly.
listen 127.0.0.1:80;
listen 10.0.0.1:80; # Secure internal IP
# Hosts
server_name www.wieni.be;
# Root
@drefined
drefined / content-length-size.md
Created July 19, 2016 17:37 — forked from voronianski/content-length-size.md
What happens if you serve content with a different length than the Content-Length header?

@jakearchibald done a bit of research around this:

###Loading a page with Content-Length < actual content length

  • Chrome: Truncated content - no indication of error
  • Firefox: Truncated content - no indication of error
  • Safari: Truncated content - no indication of error
  • IE: Truncated content - no indication of error

###Loading a page with Content-Length > actual content length

var Col = require('react-bootstrap/lib/Col')
var PageHeader = require('react-bootstrap/lib/PageHeader')
var React = require('react')
var Row = require('react-bootstrap/lib/Row')
var {connect} = require('react-redux')
var {reduxForm} = require('redux-form')
var DateInput = require('./DateInput')
var FormField = require('./FormField')
var LoadingButton = require('./LoadingButton')
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Theme - Cobalt2/cobalt2.tmTheme",
"detect_slow_plugins": false,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
".DS_Store",
#!/usr/bin/env bash
brew install php55 --with-thread-safety --without-snmp
brew install php55-mcrypt
brew install php55-xdebug
brew info php55
chmod -R ug+w /usr/local/Cellar/php55/5.5.19/lib/php
pear config-set php_ini /usr/local/etc/php/5.5/php.ini