Skip to content

Instantly share code, notes, and snippets.

View omgbbqhaxx's full-sized avatar
🪐
Universal

Yasin Aktimur omgbbqhaxx

🪐
Universal
View GitHub Profile
@omgbbqhaxx
omgbbqhaxx / csrf
Created July 8, 2015 22:56
How to get csrf token .
$(document).ready(function(){
// using jQuery get CSRF TOKEN
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Simple markers</title>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0;
@omgbbqhaxx
omgbbqhaxx / gist:c6b4cf0d7ea134a9ed45
Last active August 29, 2015 14:27 — forked from mikeyk/gist:1329319
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
#mehmetkose.org/linode-uzerinde-nginx-supervisord-tornado-yapilandirmasi.html
import tornado.ioloop
from tornado.options import define, options, logging
import tornado.web
define("port", default=8888, help="run on the given port", type=int)
settings = {
"debug": True,
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/opt/venv/retwiends # Django project directory
SOCKFILE=/opt/venv/run/gunicorn.sock # we will communicte using this unix socket
USER=root # the user to run as
GROUP=root # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=retwiends.settings # which settings file should Django use
DJANGO_WSGI_MODULE=retwiends.wsgi # WSGI module name
@omgbbqhaxx
omgbbqhaxx / vsftpd.conf
Created November 2, 2013 16:20
vsftpd örnek configirasyonu.
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
@omgbbqhaxx
omgbbqhaxx / ajax.js
Created November 3, 2013 21:06
Django AJAX POST Example
$(document).ready(function(){
// using jQuery
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {