Skip to content

Instantly share code, notes, and snippets.

Avatar

Jingsheng Wang skyred

View GitHub Profile
View gist:cd571ceae31160ac70b4c76d6366eb28
1. MIT Introduction to Deep Learning http://introtodeeplearning.com
2. Learn with Google AI https://ai.google/education
3. Machine Learning Crash Course https://developers.google.com/machine-learning/crash-course/
4. How to learn Deep Learning in 6 months https://towardsdatascience.com/how-to-learn-deep-learning-in-6-months-e45e40ef7d48
5. Microsoft makes training courses available to the public https://blogs.microsoft.com/ai/microsoft-professional-program-ai/
@skyred
skyred / gist:102288a4f1487fa4dd7851109e051d3b
Last active Nov 24, 2016
Programmatically creates CommerceOrder on D8
View gist:102288a4f1487fa4dd7851109e051d3b
// {
// "mail": "testrest@test.com",
// "uid": 1,
// "store_id": 1,
// "order_items": [
// {"title": "restTitle1", "quantity": 2, "unit_price": {"number": "23.45", "currency_code": "CNY"}, "total_price": {"number": "46.9", "currency_code": "CNY"}},
// {"title": "restTitle2", "quantity": 3, "unit_price": {"number": "10.01", "currency_code": "CNY"}, "total_price": {"number": "30.03", "currency_code": "CNY"}},
// {"title": "restTitle3", "quantity": 4, "unit_price": {"number": "0.2", "currency_code": "CNY"}, "total_price": {"number": "0.8", "currency_code": "CNY"}}
// ]
// }
@skyred
skyred / backup.sh
Last active May 25, 2016
Drupal backup script, using Drush
View backup.sh
#!/bin/sh
#Set information specific to your site
webroot="/var/www/html/"
#Set the date and name for the backup files
date=`date '+%A'`
#Dump the mysql database
cd $webroot/public_html
#Drush needs addtional path in the cron
View Reset weight according to alphabetical order of the names
SET @rank:=0;
UPDATE commerce_product_attribute_value_field_data
SET weight=@rank:=@rank+1
WHERE attribute = 'style'
ORDER BY name
View keybase.md

Keybase proof

I hereby claim:

  • I am skyred on github.
  • I am skyred (https://keybase.io/skyred) on keybase.
  • I have a public key whose fingerprint is E709 C145 80C7 776E 82EC 1B2B 09FD C40B 1D48 FB9A

To claim this, I am signing this object:

@skyred
skyred / microcache
Last active Aug 29, 2015
Microcache config
View microcache
fastcgi_cache_path /dev/shm/microcache levels=1:2 keys_zone=microcache:50M max_size=1G inactive=2h;
map $http_cookie $cache_uid { default nil; # hommage to Lisp :)
~SESS[[:alnum:]]+=(?<session_id>[[:alnum:]]+) $session_id;
}
map $request_method $no_cache {
default 1;
HEAD 0;
GET 0;
@skyred
skyred / gist:5488714
Last active Dec 16, 2015
Drupal.org Chinese user statistics
View gist:5488714
// The number of users from China by the end of 2010
SELECT count(users.uid) AS uid
FROM users users
LEFT JOIN profile_values profile_values_profile_country ON users.uid = profile_values_profile_country.uid AND profile_values_profile_country.fid = '1'
WHERE (profile_values_profile_country.value in ('China')) AND (users.created <= 1293836399)
// The number of users from China by the end of 2011
SELECT count(users.uid) AS uid
FROM users users
LEFT JOIN profile_values profile_values_profile_country ON users.uid = profile_values_profile_country.uid AND profile_values_profile_country.fid = '1'
@skyred
skyred / backup.sh
Last active Dec 10, 2015
Drupal files and database backup script
View backup.sh
#!/bin/sh
#Set information specific to your site
webroot="/srv/www/example.com"
db_user="example.com"
db_password="XXXXXXXXXXXXXXXX"
db_name="example.com"
#Set the date and name for the backup files
date=`date '+%A'`
@skyred
skyred / insready.com
Last active Dec 27, 2018
Nginx config for Drupal 7 and Drupal 8
View insready.com
server {
server_name www.insready.com;
root /srv/www/insready.com/public_html; ## <-- Your only path reference.
access_log /srv/www/insready.com/logs/access.log;
error_log /srv/www/insready.com/logs/error.log;
location = /favicon.ico {
log_not_found off;
access_log off;
}
You can’t perform that action at this time.