Skip to content

Instantly share code, notes, and snippets.

@jyfcrw
jyfcrw / proxy.ps1
Created June 16, 2018 04:53
PowerShell Internet Proxy Script
<#
.Synopsis
This function will set the proxy settings provided as input to the cmdlet.
.Description
This function will set the proxy server.
.Parameter ProxyServer
This parameter is set as the proxy for the system.
Data from. This parameter is Mandatory
.Example
Set-Proxy -proxy "127.0.0.1:7080"
@jyfcrw
jyfcrw / sidekiq.sh
Last active September 20, 2018 11:22
Command to start sidekiq as daemon
cd /var/www/default/apps/myproject/releases/20160225020340 && ( export PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH" ; bundle exec sidekiq --index 0 --pidfile /var/www/default/apps/lingwatch/shared/tmp/pids/sidekiq-0.pid --environment production --logfile /var/www/default/apps/lingwatch/shared/log/sidekiq.log --config config/sidekiq.yml --daemon )
@jyfcrw
jyfcrw / monitrc
Last active March 21, 2016 02:43
Monit basic configuration with HTTP/monit status
set daemon 120
set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
set eventqueue
basedir /var/lib/monit/events
slots 100
set httpd port 2812 and
allow localhost
@jyfcrw
jyfcrw / nginx-server-proxy
Last active March 21, 2016 02:40
Nginx server with simple proxy pass
server {
listen 80;
server_name mydomain.com *.mydomain.com;
location / {
proxy_pass http://otherdomain:9090;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
@jyfcrw
jyfcrw / nginx-server-xsendfile
Last active February 13, 2017 20:12
Nginx server configuration with X-Sendfile for Rails
server {
listen 80;
listen [::]:80;
server_name mydomian.com *.mydomian.com;
root /var/www/default/apps/myproject/current/public;
passenger_enabled on;
passenger_set_header X-Sendfile-Type "X-Accel-Redirect";
passenger_env_var HTTP_X_ACCEL_MAPPING /var/www/default/apps/myproject/shared/public/protects/=/protects/;
@jyfcrw
jyfcrw / nginx.conf
Last active March 21, 2016 02:35
nginx basic configuration
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
http {