Skip to content

Instantly share code, notes, and snippets.

View leomelzer's full-sized avatar

Leonhard Melzer leomelzer

View GitHub Profile
@dbainbridge
dbainbridge / app.js
Created April 19, 2012 20:48
How to use socket.io with Express 3
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http');
var app = express();
var server = app.listen(3000);
@rduplain
rduplain / app.py
Created January 19, 2012 17:28
Plot a PNG using matplotlib in a web request, using Flask.
"Plot a PNG using matplotlib in a web request, using Flask."
# Install dependencies, preferably in a virtualenv:
#
# pip install flask matplotlib
#
# Run the development server:
#
# python app.py
#
# bash <(curl -s https://gist.github.com/drye/5387341/raw/ec72cddfe43ec3d39c91a3c118cb68ab14a049f8/enable_dnsmasq_on_osx.sh)
# ----------------------
# installing dnsmasq and enable daemon
# ----------------------
brew install dnsmasq
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
# ----------------------
# adding resolver for vbox domain
# ----------------------
@panicsteve
panicsteve / gist:1641705
Created January 19, 2012 18:26
Form letter template for acquired startups
Dear soon-to-be-former user,
We've got some fantastic news! Well, it's great news for us anyway. You, on
the other hand, are fucked.
We've just been acquired by:
[ ] Facebook
[ ] Google
[ ] Twitter
@herr-vogel
herr-vogel / material-ui-next-js-button.js
Last active November 16, 2021 10:14
Using Material-UI Button with Next.js Link
import React from 'react'
import Link from 'next/link'
import Button from '@material-ui/core/Button'
const ButtonLink = ({ className, href, hrefAs, children, prefetch }) => (
<Link href={href} as={hrefAs} prefetch>
<a className={className}>
{children}
</a>
</Link>
@josegonzalez
josegonzalez / .gitconfig
Created September 5, 2010 07:45
My ~/.gitconfig
[user]
name = MY_NAME
email = MY_EMAIL_ADDRESS
[git-tmbundle]
gitnub-path = /Applications/GitNub.app
gitx-path = /Applications/GitX.app
show-diff-check = yes
[github]
user = GITUB_USER
token = GITHUB_TOKEN
@jboesch
jboesch / pg_import_csv_to_heroku.sh
Last active April 5, 2022 22:11
Importing a CSV dump of Postgres data into Heroku
# You have your csv data and it looks like so... It's in a file named "my_data.csv" and we want to import it into a table named "my_things".
"1", "Something", "0.50", "2013-05-05 10:00:00"
"2", "Another thing", "1.50", "2013-06-05 10:30:00"
# Now you want to import it, go to the command line and type:
$ PGPASSWORD=PWHERE psql -h HOSTHERE -U USERHERE DBNAMEHERE -c "\copy my_things FROM 'my_data.csv' WITH CSV;"
# Voila! It's impoted. Now if you want to wipe it out and import a fresh one, you would do this:
@mnsami
mnsami / download_egghead_videos.sh
Last active August 4, 2022 06:27
this script is to download egghead videos using youtube-dl
#!/bin/bash
usage() { echo "usage: --coursename [--coursename \"build-a-react-app-with-redux\"] --type [--type \"courses|lessons\"]" 1>&2; exit 1; }
OPTS=$(getopt -o c:t: --long coursename:,type: -n 'download_egghead_videos.sh' -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$OPTS"
@kennethreitz
kennethreitz / flaskapp.py
Created June 9, 2012 15:38
My typical flask app base
# -*- coding: utf-8 -*-
import os
from flask import Flask
from flask_heroku import Heroku
from flask_sslify import SSLify
from raven.contrib.flask import Sentry
from flask.ext.celery import Celery
@cgmartin
cgmartin / logging-middleware.js
Created May 24, 2015 01:43
Morgan JSON log format example
'use strict';
var morgan = require('morgan');
var os = require('os');
morgan.token('conversation-id', function getConversationId(req) {
return req.conversationId;
});
morgan.token('session-id', function getSessionId(req) {
return req.sessionId;