Skip to content

Instantly share code, notes, and snippets.

@sagivo
sagivo / gist:3a4b2f2c7ac6e1b5267c2f1f59ac6c6b
Last active June 27, 2024 19:32
webRTC stun / turn server list
to check if the server works - https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice
stun:
stun.l.google.com:19302,
stun1.l.google.com:19302,
stun2.l.google.com:19302,
stun3.l.google.com:19302,
stun4.l.google.com:19302,
stun.ekiga.net,
stun.ideasip.com,
@gaearon
gaearon / connect.js
Last active June 24, 2024 09:43
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@manugarri
manugarri / README.rst
Created May 11, 2016 12:25 — forked from livibetter/README.rst
Frequency spectrum of sound using PyAudio, NumPy, and Matplotlib

This Gist is about how I use PyAudio, NumPy, and Matplotlib to plot freqency spectrum of system sound or microphone.

You can read this blog post for more detail or watch this video:

https://i.ytimg.com/vi/hiGB_AP6iTo/maxresdefault.jpg
@jnozzi
jnozzi / NSURL+FavoritesList.h
Last active July 11, 2016 04:09
NSURL category that provides a simple way to append a fileURL to the end of favorite items or favorite volumes list used in the side bars seen in Finder and the open and save dialog boxes.
//
// NSURL+FavoritesList.h
// FavoritesListTester
//
// Appends the URL to the end of the Favorite Items or Favorite Volumes list
// (found in the side bar of Finder windows and open/save dialogs, etc.)
//
// Notes:
//
// 1. Must be a file URL.
<!DOCTYPE html>
<html>
<body>
<section>
<video> controls autoplay width="1920"></video>
</section>
<script type="text/javascript">
var buffer;
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@jordaaash
jordaaash / count.js
Last active June 19, 2021 13:03
Bookshelf.js/Knex.js innerJoin withRelated
var Promise = require('bluebird'),
User = require('./user'),
knex, query;
knex = User.prototype._builder(User.prototype.tableName);
query = function (q) {
q.distinct()
.innerJoin('orders', function () {
this.on('users.id', '=', 'orders.user_id')
@kimus
kimus / ufw.md
Created March 2, 2014 22:46
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

@weotch
weotch / main.js
Last active March 13, 2016 12:23
Backbone routing example using require.js
// This our standard require js bootstrap file. It assumes you are using the
// require-jquery.js file that require.js provides
// Set the require.js configuration for the application
require.config({
// Base path used to load scripts
baseUrl: 'js/',
// Prevent caching during dev
urlArgs: "bust=" + (new Date()).getTime(),
@postrational
postrational / gunicorn_start.bash
Last active April 4, 2024 12:48
Example of how to set up Django on Nginx with Gunicorn and supervisordhttp://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name