This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the active virtualenv | |
# * the branch/status of the current git repository | |
# * the return value of the previous command | |
# * the fact you just came from Windows and are used to having newlines in | |
# your prompts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @kholidfu - https://kholidfu.blogspot.com | |
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests # or urllib | |
import csv | |
# get Youtube Data API Key | |
API_KEY = "" # insert your API key | |
# youtube channel ID | |
channel_id = "" # insert Youtube channel ID | |
page_token = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from app.models import Collection | |
c = Collection.objects.filter(done=True).values('id') | |
rid = [i['id'] for i in c] | |
random.choice(rid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NumberOfImagesFilter(admin.SimpleListFilter): | |
"""Filter based on numbers of images. | |
== 7 | |
> 6 | |
< 7 | |
""" | |
title = _('Number of Images') | |
parameter_name = 'imgcount' | |
def lookups(self, request, model_admin): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import glob | |
import subprocess | |
from sys import stdout, stdin, stderr | |
from django.core.management.base import BaseCommand, CommandError | |
from django.conf import settings | |
class Command(BaseCommand): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the active virtualenv | |
# * the branch/status of the current git repository | |
# * the return value of the previous command | |
# * the fact you just came from Windows and are used to having newlines in | |
# your prompts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location /images/ { | |
autoindex on; | |
alias /home/banteng/git/blooms/app/assets/; | |
} | |
# maka jika kita punya URL /images/11/03/blabla.jpg akan otomatis ter-map ke dir app/assets/11/03/blabla.jpg | |
# nice! tidak perlu ubah folder name!!! | |
reference: http://stackoverflow.com/questions/1474374/nginx-doesnt-serve-static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure(2) do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install grpcio | |
# ===== | |
sudo apt-get install python-dev protobuf-compiler python-pip unzip dh-autoreconf | |
sudo pip install virtualenv | |
git clone https://github.com/grpc/grpc | |
cd grpc && git submodule update --init | |
# cd third_party/protobuf && ./autogen.sh | |
cd ~/grpc && make |