Skip to content

Instantly share code, notes, and snippets.

View bkawan's full-sized avatar
🎯
Focusing

Bikesh Kawan bkawan

🎯
Focusing
View GitHub Profile
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@floer32
floer32 / tupperware.py
Last active September 26, 2022 12:13
recursively convert nested dicts to nested namedtuples, giving you something like immutable object literals
from UserDict import IterableUserDict
import collections
__author__ = 'github.com/hangtwenty'
def tupperware(mapping):
""" Convert mappings to 'tupperwares' recursively.
@yprez
yprez / fields.py
Last active February 19, 2023 12:08
Django rest framework - Base64 image field
import base64
from django.core.files.base import ContentFile
from rest_framework import serializers
class Base64ImageField(serializers.ImageField):
def from_native(self, data):
if isinstance(data, basestring) and data.startswith('data:image'):
# base64 encoded image - decode
@elliottb
elliottb / fabfile.py
Created December 2, 2013 02:26
Example Python Fabric deployment script. Deploys code from a deployment box to a remote host. Usage from command line on the deployment box: fab deploy.
from fabric.api import local, run, env, put
import os, time
# remote ssh credentials
env.hosts = ['10.1.1.25']
env.user = 'deploy'
env.password = 'XXXXXXXX' #ssh password for user
# or, specify path to server public key here:
# env.key_filename = ''
@tanuka72
tanuka72 / Host_Django_on_AWS
Last active February 18, 2023 20:02
Hosting a Django application on AWS EC2 (running AMI Linux) - steps involved
As a newbie, I recently went through the process of migrating my Django application that was developed and tested on a Windows environment onto AWS (AMI Linux) to host it using Apache and mod_wsgi. The source code for the application was on GitHub.
My sincere thanks to the people who have contributed the References that I've listed in my notes below. They were immensely helpful for me to get through this process.
I'm posting my notes compiling all the steps involved, in case it helps others.
This is NOT production level hosting.
I Creating AWS account and instances
=====================================
Reference : http://docs.aws.amazon.com/gettingstarted/latest/wah-linux/web-app-hosting-intro.html
@kmonsoor
kmonsoor / get_yt_video_id.py
Last active February 15, 2024 17:15
Extract Video-ID from a Youtube url
# initial version: http://stackoverflow.com/a/7936523/617185 \
# by Mikhail Kashkin(http://stackoverflow.com/users/85739/mikhail-kashkin)
def get_yt_video_id(url):
"""Returns Video_ID extracting from the given url of Youtube
Examples of URLs:
Valid:
'http://youtu.be/_lOT2p_FCvA',
'www.youtube.com/watch?v=_lOT2p_FCvA&feature=feedu',
@nrollr
nrollr / MySQL_macOS_Sierra.md
Last active June 7, 2024 20:53
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@languanghao
languanghao / left-bar.vue
Created December 22, 2016 06:56
element ui menu with vue-router
<template>
<el-menu :router="true" :default-active="activeLink">
<template v-for="rule in $router.options.routes">
<el-submenu v-if="rule.children && rule.children.length > 0"
:index="rule.path"
>
<template slot="title"><i :class="rule.icon"></i>{{ rule.title }}</template>
<el-menu-item v-for="child in rule.children" :index="rule.path + '/' + child.path">{{ child.title }}</el-menu-item>
</el-submenu>
<el-menu-item v-else
@mguezuraga
mguezuraga / AESCipher.py
Last active February 24, 2020 23:16 — forked from swinton/AESCipher.py
Encrypt & Decrypt using PyCrypto AES 256From http://stackoverflow.com/a/12525165/119849
#!/usr/bin/env python
import base64
from Crypto import Random
from Crypto.Cipher import AES
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-s[-1]]
sudo apt-get update
sudo apt-get install python3-pip python3-dev libpq-dev postgresql postgresql-contrib nginx
sudo -u postgres psql
- paste this code in postgres console:
CREATE DATABASE django_project;
CREATE USER username WITH PASSWORD 'pass1234';
ALTER ROLE username SET client_encoding TO 'utf8';
ALTER ROLE username SET default_transaction_isolation TO 'read committed';