Skip to content

Instantly share code, notes, and snippets.

View jmorenoamor's full-sized avatar
🚀
Software craftsman, Master of nothing. I love space stuff.

Jesús Moreno Amor jmorenoamor

🚀
Software craftsman, Master of nothing. I love space stuff.
View GitHub Profile
@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
"""A yet-to-be-disproven-as-safe python expression shell
Blacklisted functionalities include:
1. Anything containing '__', because introspection allows many, many hacks.
2. open(), because it allows you to overwrite files
3. memoryview(), because it manipulates memory (?)
4. help(), because it drops you into a manpage-reader with !shell access
5. eval(), exec(), compile(), because they allow code execution via constructable strings, circumventing #1
6. vars(), getattr(), because they allow attribute access via constructable strings, circumventing #1
@max-mapper
max-mapper / blink-led.js
Last active April 13, 2022 20:30
raspberry pi scripts
@xcommerce-gists
xcommerce-gists / DoEC-parallel.curl
Created September 26, 2012 18:57
How to Make Parallel Payments Using Express Checkout.curl
curl -s --insecure https://api-3t.sandbox.paypal.com/nvp -d
"USER=<Caller_ID>
&PWD=<Caller_Pswd>
&SIGNATURE=<Caller_Sig>
&METHOD=DoExpressCheckoutPayment
&VERSION=93
&TOKEN=<Token> # TOKEN value returned from SetExpressCheckout
&PAYERID=<PayerID> # PAYERID value returned from GetExpressCheckoutDetails
&PAYMENTREQUEST_0_AMT=250 # first payment details
&PAYMENTREQUEST_0_CURRENCYCODE=USD
@cordoval
cordoval / gist:3473533
Created August 26, 2012 03:17 — forked from stof/gist:3473109
BoxFile to deploy a Symfony 2.1 app on Pagodabox
web1:
shared_writable_dirs:
- app/cache
- app/logs
- app/sessions
document_root: web
default_gateway: app.php
index_list: [app.php]
php_version: 5.3.10
php_extensions:
@andrenam
andrenam / Gemfile
Created July 29, 2012 03:02
gitlab Gemfile (working for raspberry pi with raspbian)
source "http://rubygems.org"
gem "rails", "3.2.5"
# Supported DBs
gem "sqlite3"
gem "mysql2"
# Auth
gem "devise", "~> 2.1.0"
@binweg
binweg / weatherlogger.py
Created July 28, 2012 13:03
Request current weather from Yahoo's public weather API and append to a log
#!/usr/bin/env python3
from urllib.request import urlopen
from xml.dom.minidom import parseString
import os
"""
Request current weather from Yahoo's public weather API and append to a log
"""
# Where to put the log file?
desired_path = os.getenv("HOME") + '/weather.log'
# Temperature unit: c for Celsius, f for Fahrenheit
import RPi.GPIO as GPIO, feedparser
USERNAME="[email protected]"
PASSWORD="password"
GPIO_PIN=12
GPIO.setmode(GPIO.BOARD)
GPIO.setup(GPIO_PIN, GPIO.OUT)
newmails = int(feedparser.parse("https://" + USERNAME + ":" + PASSWORD + "@mail.google.com/gmail/feed/atom")["feed"]["fullcount"])
if newmails > 0:
GPIO.output(GPIO_PIN, True)
else:
@miya0001
miya0001 / .vimrc
Created June 21, 2012 08:26
vimrc
syntax on
set expandtab
set shiftwidth=4
set tabstop=4
set nobackup
set number
set termencoding=utf-8
set encoding=utf-8
set fileencodings=utf-8,euc-jp,sjis
set fileformat=unix
@h3nrique
h3nrique / Timer.java
Last active October 5, 2015 22:38
Class used to measure method time execution
package com.package.utils;
/*
* This code is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This code is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR