Skip to content

Instantly share code, notes, and snippets.

View ramaseshan's full-sized avatar

Ramaseshan ramaseshan

View GitHub Profile
Vignesh Krishnan, [16.10.15 19:17]
Oh, I've always wanted to ask you guys. How do you look at free and open source gaming? The concept doesn't appeal well to me IMO
Venkatesh T Vinaitheerthan, [16.10.15 19:18]
[In reply to Vignesh Krishnan]
What's IMO..I've played some games..weren't as good as CS
Vignesh Krishnan, [16.10.15 19:20]
No no.. What I am saying is, how can the concept of Free and open source software be applied to developing games? I get the knowledge sharing thing, but releasing your assets would easily give way to people ripping off what you've done right? @hacktivist
Sample Code Used in repo here : https://github.com/ramaseshan/salt-stack-examples
The Plan
1. Basic Introduction to Salt - 10 min (Installation and basic usage)
2. Introduction to software installation using salt -10 min (How to install or update a software)
3. How to create and manage an infrastructure with saltstack - 20 min (Installing multiple packages, various ways of installation)
-> We will be installing a few packages like python-pip, python-virtualenv,
-> Create a virtualenv and install django inside it
-> Create a default django project and start the dev server
-> Well you really need to edit the code ?? So lets go god mode (vim + tmux + the good old terminal)
@ramaseshan
ramaseshan / gist:0e2ed776da81355aff40
Created July 9, 2015 06:45
Nfs file upload django
from django.core.files.storage import FileSystemStorage
fs = FileSystemStorage(location=settings.MEDIA_ROOT)
def upload_media_handler(instance, filename):
import unicodedata
filename = unicodedata.normalize('NFKD', filename).encode('ascii','ignore')
filename = filename.translate(None,"!,;()[]'")
return "{id}/media/{file}".format(id=instance.reference_number, file=(filename.replace(" ","_")))
class Media(Models):
// Do only a request.POST
@login_required
def advanced(request):
return_dict = {}
if request.method == "POST":
name = request.POST.get("name")
desc = request.POST.get("desc")
results = Media.objects.filter(*(args,)).distinct()
paginator = Paginator(results, 25) # Show 25 contacts per page
@ramaseshan
ramaseshan / generate_sublists.py
Created May 19, 2015 10:49
Generate all the possible sublists of a list
def sublists(symps):
# sample input [1,2,3] Ex Output [[1],[2],[3],[1,2],[2,3],[1,3],[1,2,3]]
length = len(symps)
i = 0
poss = []
while i < length:
temp = []
size = length - i
temp = [sublist for sublist in (symps[x:x+size] for x in range(len(symps) - size + 1))]
i = i +1
class Symptoms(models.Model):
symid = models.AutoField(primary_key=True)
sym_name = models.CharField(max_length=100,blank=False,null=False)
def __unicode__(self):
return self.sym_name
class Disease(models.Model):
did = models.AutoField(primary_key=True)
d_name = models.CharField(max_length=100,blank=False,null=False)
@ramaseshan
ramaseshan / settings.py
Created January 28, 2015 07:44
Django Compressor settings
# STATIC FILE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
STATIC_ROOT = join(os.path.dirname(BASE_DIR), 'staticfiles')
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
STATIC_URL = '/static/'
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
STATICFILES_DIRS = (
join(BASE_DIR, 'static'),