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
INSTALLED_APPS = [ | |
'wpadmin', | |
'core.apps.CoreConfig', | |
'news.apps.NewsConfig', | |
'django.contrib.admin', | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.messages', | |
'django.contrib.staticfiles', |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 SupplierListView(TemplateView): | |
template_name = 'supplier/list.html' | |
def get(self, request, *args, **kwargs): | |
suppliers = Supplier.objects.all() | |
return self.render_to_response({ | |
'suppliers':suppliers | |
}) |
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
# 1. Install CUDA | |
# Preparation | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install tmux build-essential gcc g++ make binutils | |
sudo apt-get install software-properties-common | |
# Download Cuda toolkit (Nvidia driver included) | |
cd ~/Downloads | |
# Download CUDA 8.0 from this https://developer.nvidia.com/cuda-80-ga2-download-archive, not 9.0 |
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
$.ajaxSetup({ | |
headers: { 'X-CSRFToken': "{{ csrf_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
from bs4 import BeautifulSoup as BS | |
import requests | |
class BaseCrawler(object): | |
api_url = None | |
default_headers = { | |
'Accept-Language' :'en-US,en,q=0.9,vi;q=0.8', |
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
from bs4 import BeautifulSoup as BS | |
import requests | |
class BaseCrawler(object): | |
api_url = None | |
default_headers = { | |
'Accept-Language' :'en-US,en,q=0.9,vi;q=0.8', |
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
$.ajax({ | |
method: "POST", | |
url: '{% url 'aj_location' %}', | |
dataType:'json', | |
data: {'data':this.dataset.gmap}, | |
success: function(data){ | |
if(data.is_saved){ | |
alert('Added '+data.data.name); | |
}else{ |
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
# sudo add-apt-repository ppa:certbot/certbot && sudo apt-get update && sudo apt-get install -y python-certbot-nginx | |
# sudo certbot --nginx -d {domain}.com -d www.{domain}.com | |
# django app | |
# ... | |
# Check cronjobs | |
# cat /etc/cron.d/certbot | |
# Expires map cache | |
map $sent_http_content_type $expires { | |
default off; |
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
// https://docs.google.com/presentation/d/1rrYLHVR3_Fc7mmvc8I8zGOhtoBDN02RjF_-aecimZdg/edit?usp=sharing | |
#include <NewPing.h> | |
#define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor. | |
#define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor. | |
#define MAX_DISTANCE 100 // Maximum distance we want to ping for (in centimeters). Maximum sensor | |
#define US_ROUNDTRIP_CM 58 | |
void setup() { | |
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance. | |
pinMode(ECHO_PIN, OUTPUT);// Open serial monitor at 115200 baud to see ping results. |
OlderNewer