Skip to content

Instantly share code, notes, and snippets.

@STrRedWolf
STrRedWolf / rmthumbnail.sh
Created October 4, 2020 13:07
XFCE Small Utlities
#!/bin/sh
# Remove a XFCE generated thumbnail
#
# Put this file in a safe place (I use ~/bin)
# Open Thunar, then navigate to Edit >> Create custom actions.
# Create a new action ("Remove Thumbnail")
# Command is: /path/to/this-file %f
#
# Doesn't handle groups.
@bluekvirus
bluekvirus / flask-uWSGI-nginx.md
Last active July 19, 2022 20:26
How To Serve Flask Applications with uWSGI and Nginx on Ubuntu 14.04+

How To Serve Flask Applications with uWSGI and Nginx on Ubuntu 14.04

@credit Yan Zhu (https://github.com/nina-zhu)

Introduction

Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions, it can help you get your Python application or website off the ground. Flask includes a simplified development server for testing your code locally, but for anything even slightly production related, a more secure and powerful web server is required.

In this guide, we will demonstrate how to install and configure some components on Ubuntu 14.04 to support and serve Flask applications. We will configure the uWSGI application container server to interface with our applications. We will then set up Nginx to reverse proxy to uWSGI, giving us access to its security and performance features to serve our apps.

Prerequisites and Goals

@avel
avel / Cheatsheet.md
Last active August 29, 2015 14:04
Cheatsheet for front-end development

jQuery

  • each (index, Element) { this = Element }
  • toggleClass (className , [switch])

Ajax:

  • .done (data, textStatus, xhr)
  • .fail (xhr, textStatus, errorThrown)
  • .always ( either one of the above)
@Fenkiou
Fenkiou / install_bigbluebutton_ubuntu_14_04
Last active August 29, 2015 14:03
A procedure to install BigBlueButton on Ubuntu 14.04
sudo apt-get install language-pack-en
sudo update-locale LANG=en_US.UTF-8
wget http://ubuntu.bigbluebutton.org/bigbluebutton.asc -O- | sudo apt-key add -
echo "deb http://ubuntu.bigbluebutton.org/lucid_dev_081/ bigbluebutton-lucid main" | sudo tee /etc/apt/sources.list.d/bigbluebutton.list
echo "deb http://us.archive.ubuntu.com/ubuntu/ lucid multiverse" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get upgrade
@stefanlasiewski
stefanlasiewski / hieravalidate.sh
Last active April 23, 2017 10:54
Puppet validate hiera #1
#!/bin/sh
# Search the module path for all key values used in a hiera_array lookup, and then perform the equivalent of a hiera_array() from puppet.
# Borrowed from https://ask.puppetlabs.com/question/10999/hiera-how-can-i-tell-which-class-triggered-expected-array-and-got-nilclass/?answer=11006#post-id-11006
# The original:
# ```
# for y in $(for x in $(puppet config print modulepath | sed -e "s/:/ /g"); do grep -PIRho "(?<=hiera_array\(['|\"|$])([^'|^\"|^,|^\)]+)" $x; done); do echo hiera -d -a -c $(puppet config print confdir)/hiera.yaml $y <key=value pairs as needed for your hiera.yaml>; done
# ```
@umidjons
umidjons / vim-tips.md
Last active April 26, 2020 07:15
Vim Tips

Set vim as default editor

Add vim into alternatives list

# /usr/bin/vim is a link, /usr/bin/vim73 is a executable, 100 priority
update-alternatives --install /usr/bin/vim editor /usr/bin/vim73 100

# change default editor
update-alternatives --config editor
@szinck
szinck / database.py
Created May 23, 2012 04:56
sqlalchemy reflection
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
engine = create_engine("postgresql://user:@host/schema")
Base = declarative_base()
Base.metadata.reflect(engine)
@lrvick
lrvick / flask_geventwebsocket_example.py
Created September 1, 2011 07:17
Simple Websocket echo client/server with Flask and gevent / gevent-websocket
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')