Skip to content

Instantly share code, notes, and snippets.

View jennyq's full-sized avatar

Jenny Qian jennyq

  • Tendenci
  • Houston TX
View GitHub Profile
@jennyq
jennyq / collapsible_markdown_example.md
Last active August 14, 2018 16:51
collapsible markdown
Click to View Details
print("hello world!")
Some html tags <pre>, <table>, <h1>, <hr>, <a name>, <sub> also work within the `details` block.
""" url_converter.py
Convert url tags to have "'" included.
Usage: Copy the script to your project root,
specify your theme name, then run
python url_converter.py
"""
import os
#!/bin/bash
cd /opt/webapps/orgs/tendenci_site
pip install -r requirements.txt
python deploy.py
sv stop tendenci_site
sleep 2
sv kill tendenci_site
#30 1 * * * /usr/bin/python /opt/webapps/orgs/tendenci_site/manage.py run_nightly_commands
#*/60 * * * * /usr/bin/python /opt/webapps/orgs/tendenci_site/manage.py process_unindexed
#!/bin/bash
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# linux
sed -i "s|SECRET_KEY='.*'$|SECRET_KEY='$(mcookie)'|" conf/local_settings.py
sed -i "s|SITE_SETTINGS_KEY='.*'$|SITE_SETTINGS_KEY='$(mcookie)'|" conf/local_settings.py
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
sed -i bak "s|SECRET_KEY='.*'$|SECRET_KEY='$(date | md5)'|" conf/local_settings.py
sed -i bak "s|SITE_SETTINGS_KEY='.*'$|SITE_SETTINGS_KEY='$(date | md5)'|" conf/local_settings.py
#!/bin/bash
# disable users with @schipul.com or @theassociaton.com or @theassociation.com in email
sql="update auth_user set is_superuser=false, is_staff=false, is_active=false where (email like '%@schipul.com' or email like '%@theassocation.com' or email like '%@theassociaton.com' or email like '%@theassociation.com');"
sudo -u postgres psql -d tendenci_site -c "$sql"
sql="update profiles_profile set status_detail='inactive' where user_id in (select id from auth_user where (email like '%@schipul.com' or email like '%@theassocation.com' or email like '%@theassociaton.com' or email like '%@theassociation.com'));"
#!/bin/bash
sql="update articles_article set timezone='US/Hawaii' where timezone='US/Hawaii: HST';"
sudo -u postgres psql -d tendenci_site -c "$sql"
sql="update news_news set timezone='US/Hawaii' where timezone='US/Hawaii: HST';"
sudo -u postgres psql -d tendenci_site -c "$sql"
sql="update directories_directory set timezone='US/Hawaii' where timezone='US/Hawaii: HST';"
sudo -u postgres psql -d tendenci_site -c "$sql"
#!/bin/bash
# update staffs to superusers for t6dev
sql="update auth_user set is_superuser=true where is_staff=true and is_superuser=false and (email not like '%@theassociaton.com' and email not like '%@theassociation.com');"
sudo -u postgres psql -d tendenci_site -c "$sql"
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
server {
listen 80;
server_name localhost;
charset utf-8;
keepalive_timeout 65;
client_max_body_size 30M;
root /var/www/tendenci/;
location /static/ {