This file contains hidden or 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 debian:jessie-slim | |
RUN mkdir /node_source | |
WORKDIR /node_source | |
RUN apt-get update && apt-get --yes install wget | |
RUN wget https://nodejs.org/dist/v5.7.0/node-v5.7.0-linux-x64.tar.gz | |
RUN mkdir -p /opt/nodejs | |
RUN tar -xvzf node-v5.7.0-linux-x64.tar.gz -C /opt/nodejs/ |
This file contains hidden or 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 redis | |
import threading | |
class Listener(threading.Thread): | |
def __init__(self, r, channels): | |
threading.Thread.__init__(self) | |
self.redis = r | |
self.pubsub = self.redis.pubsub() | |
self.pubsub.subscribe(channels) | |
This file contains hidden or 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 click | |
import requests | |
# TODO change api key to your own api key, this is a sample key | |
SAMPLE_API_KEY = 'b1b15e88fa797225412429c1c50c122a1' | |
def current_weather(location, api_key=SAMPLE_API_KEY): | |
url = 'https://api.openweathermap.org/data/2.5/weather' |
This file contains hidden or 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 signal | |
import time | |
class GracefulKiller: | |
kill_now = False | |
def __init__(self): | |
signal.signal(signal.SIGINT, self.exit_gracefully) | |
signal.signal(signal.SIGTERM, self.exit_gracefully) | |
def exit_gracefully(self,signum, frame): |
This file contains hidden or 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 | |
# Generate self signed root CA cert | |
openssl req -nodes -x509 -days 3650 -newkey rsa:2048 -keyout ca.key -out ca.crt -subj "/C=IR/ST=TEH/L=Tehran/O=MongoDB/ OU=root/CN=mongo.your_domain.com/emailAddress=info@your_domain.com" | |
# Generate server cert to be signed | |
openssl req -nodes -newkey rsa:2048 -days 3650 -keyout server.key -out server.csr -subj "/C=IR/ST=TEH/L=Tehran/ O=MongoDB/OU=server/CN=mongo.your_domain.com/emailAddress=info@your_domain.com" | |
# Sign the server cert | |
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt |
This file contains hidden or 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 | |
# | |
## redis backup script | |
## usage | |
## redis-backup.sh port backup.dir | |
## Redis is very data backup friendly since you can copy RDB files while the database is running: the RDB is never modified once produced, and while it gets produced it uses a temporary name and is renamed into its final destination atomically using rename(2) only when the new snapshot is complete. | |
# Scripts & Files | |
rdb="/var/spool/alohi/storage/redis/dump.rdb" |
This file contains hidden or 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 | |
# | |
## mongoDB backup script | |
## usage | |
## mongo-backup.sh port host backup.dir | |
temp_backup_dir="/tmp" | |
default_backup_dir="/data/backup/mongo" | |
host=${1:-"127.0.0.1"} |
This file contains hidden or 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 | |
# | |
# Highligh Nginx config file in Vim | |
# Download syntax highlight | |
mkdir -p ~/.vim/syntax/ | |
wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O ~/.vim/syntax/nginx.vim | |
# Set location of Nginx config file | |
cat > ~/.vim/filetype.vim <<EOF |
This file contains hidden or 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
alireza@alireza-pc:~/Downloads/GoLand-2019.1.3/bin$ go get -x -u github.com/micro/micro | |
mkdir -p /home/alireza/go/pkg/mod/cache/vcs # git2 https://github.com/micro/micro | |
# lock /home/alireza/go/pkg/mod/cache/vcs/84b7fd5a6fde223b4ec1c11e231552052e2f254fb38739f64fcf0c03731e7f1c.lock# /home/alireza/go/pkg/mod/cache/vcs/84b7fd5a6fde223b4ec1c11e231552052e2f254fb38739f64fcf0c03731e7f1c for git2 https://github.com/micro/micro | |
cd /home/alireza/go/pkg/mod/cache/vcs/84b7fd5a6fde223b4ec1c11e231552052e2f254fb38739f64fcf0c03731e7f1c; git ls-remote -q https://github.com/micro/micro | |
1.188s # cd /home/alireza/go/pkg/mod/cache/vcs/84b7fd5a6fde223b4ec1c11e231552052e2f254fb38739f64fcf0c03731e7f1c; git ls-remote -q https://github.com/micro/micro | |
mkdir -p /home/alireza/go/pkg/mod/cache/vcs # git2 https://github.com/coreos/etcd | |
# lock /home/alireza/go/pkg/mod/cache/vcs/e0603d6b678c67453e2d85ba58d5dd0030d8a3ed443832680252eb8f82272b52.lock# /home/alireza/go/pkg/mod/cache/vcs/e0603d6b678c67453e2d85ba58d5dd0030d8a3ed443832680252eb8f82 |
This file contains hidden or 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
alireza@alireza-pc:~/go$ go get -x -u github.com/micro/micro | |
mkdir -p /home/alireza/go/pkg/mod/cache/vcs # git2 https://github.com/micro/micro | |
# lock /home/alireza/go/pkg/mod/cache/vcs/84b7fd5a6fde223b4ec1c11e231552052e2f254fb38739f64fcf0c03731e7f1c.lock# /home/alireza/go/pkg/mod/cache/vcs/84b7fd5a6fde223b4ec1c11e231552052e2f254fb38739f64fcf0c03731e7f1c for git2 https://github.com/micro/micro | |
cd /home/alireza/go/pkg/mod/cache/vcs/84b7fd5a6fde223b4ec1c11e231552052e2f254fb38739f64fcf0c03731e7f1c; git ls-remote -q https://github.com/micro/micro | |
1.123s # cd /home/alireza/go/pkg/mod/cache/vcs/84b7fd5a6fde223b4ec1c11e231552052e2f254fb38739f64fcf0c03731e7f1c; git ls-remote -q https://github.com/micro/micro | |
mkdir -p /home/alireza/go/pkg/mod/cache/vcs # git2 https://github.com/coreos/etcd | |
# lock /home/alireza/go/pkg/mod/cache/vcs/e0603d6b678c67453e2d85ba58d5dd0030d8a3ed443832680252eb8f82272b52.lockmkdir -p /home/alireza/go/pkg/mod/cache/vcs # git2 https://github.com/micro/cli | |
# lock /home/alireza/go/pkg/mod/cache/vcs/ |
OlderNewer