Skip to content

Instantly share code, notes, and snippets.

View mahi008's full-sized avatar
👑
Busy fixing stuff !

Mahinthan Kengatharan mahi008

👑
Busy fixing stuff !
View GitHub Profile
@jrosebr1
jrosebr1 / validators.py
Created March 20, 2012 20:04 — forked from dokterbob/validators.py
Validator for files, checking the size, extension and mimetype for Django.
# @brief
# Performs file upload validation for django. The original version implemented
# by dokterbob had some problems with determining the correct mimetype and
# determining the size of the file uploaded (at least within my Django application
# that is).
# @author dokterbob
# @author jrosebr1
import mimetypes
@IlianIliev
IlianIliev / fabfile.py
Created May 28, 2012 11:04
Fabric script that eases the creation of new Django Project
"""
This fabric script automates the creation of a virtual environment and a Django
project. The result will be virtual environtment with the name of the project.
The folder namer where the project code will be placed is specified in
SOURCE_DIRECTORY_NAME, a static root folder will be created and settings.py
will be updated.
"""
try:
from fabric.api import env, run, local
from fabric.context_managers import lcd, prefix
@nielsbot
nielsbot / gist:4678311
Last active December 11, 2015 23:39
Create CGColor from HTML/CSS/Hex color string
static CGColorRef CGColorCreateWithCSSColor( NSString * string )
{
union {
struct {
#if LITTLE_ENDIAN
uint8 alpha ;
uint8 blue ;
uint8 green ;
uint8 red ;
#else
@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
@guifromrio
guifromrio / compress-pdf-with-gs.md
Created August 30, 2013 14:39
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
@ethaizone
ethaizone / git_autocommit_all.bat
Created October 18, 2013 06:58
Commit git with bat file
@echo off
echo type "commit" or "update"
cd "curl"
set GIT_PATH="C:\Program Files (x86)\Git\bin\git.exe"
set BRANCH = "origin"
:P
set ACTION=
set /P ACTION=Action: %=%
@umidjons
umidjons / animate-elements-one-after-another.md
Created March 25, 2014 05:37
jQuery: animate elements one after another

Animate elements one by one

We have these divs with .a class.

<div class="a b">d</div>    
<div class="a c">d</div>    
<div class="a d">d</div>    
<div class="a e">d</div>    
<div class="a f">d</div>    
<div class="a g">d</div>    
d 
//
// NSAttributedString+Extension.swift
// Contacts
//
// Created by Michael Rose on 8/9/17.
// Copyright © 2017 Mike Rose. All rights reserved.
//
import UIKit
@ahmed-musallam
ahmed-musallam / compress_pdf.md
Last active July 2, 2024 09:52
How to compress PDF with ghostscript

How to compress PDF using ghostscript

As a developer, it bothers me when someone sends me a large pdf file compared to the number of pages. Recently, I recieved a 12MB scanned document for just one letter-sized page... so I got to googlin, like I usually do, and found ghostscript!

to learn more abot ghostscript (gs): https://www.ghostscript.com/

What we are interested in, is the gs command line tool, which provides many options for manipulating PDF, but we are interested in compressign those large PDF's into small yet legible documents.

credit goes to this answer on askubuntu forum: https://askubuntu.com/questions/3382/reduce-filesize-of-a-scanned-pdf/3387#3387?newreg=bceddef8bc334e5b88bbfd17a6e7c4f9

@RitwikGA
RitwikGA / typform-googleanalytics
Created March 11, 2018 13:32
TypeForm Tracking in Google Analytics
/* Typform Tracking in Google Analytics. (Free Account)
* @Ritwikga
* Digishuffle
*/
//// Create Webhook For Every New Form//////
var formId = '' // Form ID is available in the URL (typeform.com/form/{formID}/create)
var formTag = '' // Enter name for the webhook