Skip to content

Instantly share code, notes, and snippets.

View InFog's full-sized avatar
🤔
Thinking

Evaldo Bento InFog

🤔
Thinking
View GitHub Profile
@InFog
InFog / couchbase.sh
Last active August 29, 2015 13:56
Some Couchbase CLI
# Detele
couchbase-cli bucket-delete -c 127.0.0.1 -u Administrator -p mypassword --bucket=mybucket-to-delete
# Create
couchbase-cli bucket-create -c 127.0.0.1 -u Administrator -p mypassword --bucket=default --bucket-ram=300
# Restore
cbrestore default http://127.0.0.1:8091 -B default

Keybase proof

I hereby claim:

  • I am infog on github.
  • I am infog (https://keybase.io/infog) on keybase.
  • I have a public key whose fingerprint is A21D 5075 8E9C CCE9 D3B4 D767 B031 7CCF B522 0331

To claim this, I am signing this object:

@InFog
InFog / routes.py
Created May 7, 2014 11:21
Parameters for render_template in Flask
from flask import Flask
app = Flask(__name__)
@app.route("/"):
data = []
data["title"] = "My Page"
data["description"] = "Just a Page"
return render_template("index.html", **data)
@InFog
InFog / redirects.py
Created May 15, 2014 01:34
HTTP codes for redirects in Flask
from flask import Flask, redirect, url_for
app = Flask(__name__)
@app.route("/page_to_redirect")
def page_to_redirect():
"""Using a 307 (TEMPORARY REDIRECT)"""
return redirect(url_for("destination")), 307
@InFog
InFog / supers_init.py
Created August 21, 2014 11:18
Example of Python's parent __init__ with super (Python 2)
class Person(object):
def __init__(self, name):
self.name = name
class Customer(Person):
def __init__(self, name, credit):
super(Customer, self).__init__(name)
self.credit = credit
@InFog
InFog / example.conf
Created October 1, 2014 22:37
Nginx basic example with rewrite and PHP-FPM
server {
server_name example;
root /var/www/example;
index index.php index.html index.htm;
# error_log /var/log/nginx/example.error_log debug;
rewrite_log on;
location ~* ^/(assets|css|fonts|img|js|upload) { }
@InFog
InFog / looptests.sh
Created February 16, 2015 08:46
PHPUnit inside a while loop
while true; do phpunit; sleep 2; done
@InFog
InFog / showjson.py
Last active August 29, 2015 14:23
Format JSON in your clipboarb
#!/usr/bin/env python3
from tkinter import Tk
from json import dumps, loads
def show_json_from_clipboard():
t = Tk()
t.withdraw()
@InFog
InFog / sonicboom.php
Last active August 29, 2015 14:24
Sonic Boom
<?php
// Download medoo.php (http://medoo.in) and place it here:
require "/usr/local/lib/php/medoo.php";
function writeLog($message)
{
// If you don't want logs, use false
if (true) {
$message = date('Y-m-d H:i:s') . " " . $message . "\n";
@InFog
InFog / inputs.php
Last active August 29, 2015 14:27
inputs.php
<?php
echo "\n*** Inputs ***";
echo "\n\nGET:"; print_r($_GET);
echo "\n\nPOST:"; print_r($_POST);