Skip to content

Instantly share code, notes, and snippets.

Maxime EpocDotFr

Block or report user

Report or block EpocDotFr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chaoflow
chaoflow / model.py
Created Apr 20, 2017
sqlite WITHOUT ROWID with (flask-)sqlalchemy
View model.py
import flask_sqlalchemy
from sqlalchemy import schema
from sqlalchemy.ext.compiler import compiles
db = flask_sqlalchemy.SQLAlchemy()
class Tag(db.Model):
__table_args__ = {'info': {'without_rowid': True}}
text = db.Column(db.String, primary_key=True)
View remove-all-from-docker.sh
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@BaptisteDixneuf
BaptisteDixneuf / OVH_Public_Cloud_Storage_API_OpenStack_Swift.md
Created Jun 25, 2015
OVH Public Cloud Object Storage et API OpenStack Swift
View OVH_Public_Cloud_Storage_API_OpenStack_Swift.md
@pyguerder
pyguerder / Django-on-OVH-tutorial.md
Last active Aug 6, 2019
Installation de Django sur un hébergement mutualisé OVH
View Django-on-OVH-tutorial.md

La méthode présentée ici permet d'installer un site Django sur un hébergement mutualisé OVH.

Lisez d'abord le fichier README puis copiez les fichiers .htaccess et django.cgi vers votre hébergement, ainsi que le code source de Django et le code source de votre site web.

@lttlrck
lttlrck / gist:9628955
Created Mar 18, 2014
rename git branch locally and remotely
View gist:9628955
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@simonw
simonw / gist:7000493
Created Oct 15, 2013
How to use custom Python JSON serializers and deserializers to automatically roundtrip complex types.
View gist:7000493
import json, datetime
class RoundTripEncoder(json.JSONEncoder):
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M:%S"
def default(self, obj):
if isinstance(obj, datetime.datetime):
return {
"_type": "datetime",
"value": obj.strftime("%s %s" % (
@jazzsequence
jazzsequence / bootstrap_link_pages.php
Created Oct 3, 2013
Bootstrapping wp_link_pages - a wp_link_pages alternative for Twitter Bootstrap support. Based on code found here: http://wordpress.stackexchange.com/questions/14406/how-to-style-current-page-number-wp-link-pages
View bootstrap_link_pages.php
@plentz
plentz / nginx.conf
Last active Oct 18, 2019
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@philsturgeon
philsturgeon / gist:5465246
Last active Oct 19, 2019
API Golden Rules
View gist:5465246

Never Expose DB Results Directly

  1. If you rename a field, then your users are fucked. Convert with a hardcoded array structure.
  2. Most DB drivers [for PHP] will show integers as numeric strings and false as "0", so you want to typecast them.
  3. Unless you're using an ORM with "hidden" functionality, people will see passwords, salts and all sorts of fancy codes. If you add one and forget to put it in your $hidden array then OOPS!

Use the URI sparingly, and correctly

  1. Use the query string for paired params instead of /users/id/5/active/true. Your API does not need to be SEO optimised.
  2. ?format=xml is stupid, use an Accept: application/xml header. I added this to the CodeIgniter Rest Server once for lazy people, and now people think it's a thing. It's not.
@barryvdh
barryvdh / _ide_helper.php
Last active Oct 16, 2019
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
View _ide_helper.php
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
You can’t perform that action at this time.