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 /resize { | |
alias /tmp/nginx/resize; | |
set $width 150; | |
set $height 100; | |
set $dimens ""; | |
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) { | |
set $width $1; | |
set $height $2; | |
set $image_path $3; |
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
# Implementation of a chinese restaurant process function for a given list of word vectors. | |
def crp(vecs): | |
clusterVec = [[0.0] * 25] # tracks sum of vectors in a cluster | |
clusterIdx = [[]] # array of index arrays. e.g. [[1, 3, 5], [2, 4, 6]] | |
ncluster = 0 | |
# probablity to create a new table if new customer | |
# is not strongly "similar" to any existing table | |
pnew = 1.0/ (1 + ncluster) | |
N = len(vecs) | |
rands = [random.random() for x in range(N)] # N rand variables sampled from U(0, 1) |
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
# Steps to install phantomjs on ubuntu16.04 | |
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
sudo apt-get install build-essential chrpath libssl-dev libxft-dev libfreetype6-dev libfreetype6 libfontconfig1-dev libfontconfig1 -y | |
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 | |
sudo tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local/share/ |
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 toolz import partition | |
from joblib import Parallel, delayed | |
def parallelize(func, iterator, n_jobs, extra): | |
extra = tuple(extra) | |
return Parallel(n_jobs=n_jobs)(delayed(func)(*(item + extra)) for item in iterator) | |
def iter_documents(file): | |
with open(file) as file_: | |
for line in file_: |
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 | |
apt update | |
apt install git build-essential dkms | |
git clone -b extended https://github.com/lwfinger/rtlwifi_new.git | |
dkms add ./rtlwifi_new | |
dkms install rtlwifi-new/0.6 | |
modprobe -r rtl8723de | |
modprobe rtl8723de | |
echo "options rtl8723de ant_sel=3" | sudo tee /etc/modprobe.d/rtl8723de.conf |
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 Docker | |
sudo apt update | |
sudo apt install apt-transport-https ca-certificates curl software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt update | |
apt-cache policy docker-ce | |
sudo apt install docker-ce -y | |
sudo systemctl status docker | |
sudo usermod -aG docker ${USER} |
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
# Check system usage for docker universe | |
docker system df | |
# Remove unsed containers | |
$ docker ps --filter “status=exited” -q | xargs -r docker rm --force | |
# or through a simpler built-in command | |
$ docker container prune --force | |
# Remove all containers |
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
// Paste this in functions.php above add_action('wp_footer', 'add_scripts'); | |
//make other links relative | |
add_filter ('site_url', 'wp_make_theme_links_protocols_relative'); | |
add_filter ('get_option_siteurl', 'wp_make_theme_links_protocols_relative'); | |
add_filter ('stylesheet_directory_uri', 'wp_make_theme_links_protocols_relative'); | |
add_filter ('template_directory_uri', 'wp_make_theme_links_protocols_relative'); | |
add_filter ('wp_get_attachment_url', 'wp_make_theme_links_protocols_relative'); | |
add_filter ('wp_get_attachment_thumb_url', 'wp_make_theme_links_protocols_relative'); | |
add_filter ('the_permalink', 'wp_make_theme_links_protocols_relative'); |
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. COT_PROMPT | |
""" | |
{system_prompt} | |
You are an AI assistant that uses a Chain of Thought (CoT) approach with reflection to answer queries. Follow these steps: | |
1. Think through the problem step by step within the <thinking> tags. | |
2. Reflect on your thinking to check for any errors or improvements within the <reflection> tags. | |
3. Make any necessary adjustments based on your reflection. | |
4. Provide your final, concise answer within the <output> tags. |