Skip to content

Instantly share code, notes, and snippets.

@breekoy
breekoy / centos7-nginx-laravel-configuration
Last active April 25, 2024 01:57
Configuration steps on CentOS7 server to run Laravel applications + Redis and Node.JS on nginx
==== CENTOS 7 LEMP STACK INSTALLATION ====
0. Make sure the centos 7 server have internet connection
1. Install the EPEL Repository
sudo yum -y install epel-release
2. Install the Remi Repository
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
3. Install Nginx
@jeffochoa
jeffochoa / Response.php
Last active April 20, 2024 12:35
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@luiseok
luiseok / jail.local
Last active September 20, 2023 07:16
Fail2ban MongoDB filter.d configuration file
#
# File Path : /etc/fail2ban/jail.local
#
# Please modify the port and logpath that you configured.
#
[mongo-auth]
enabled = true
filter = mongo-auth
@mozillazg
mozillazg / supervisord.service
Last active December 1, 2023 12:59 — forked from tonyseek/supervisord.service
install and configure supervisord on centos 7.
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
ExecStart=/bin/supervisord -c /etc/supervisord/supervisord.conf
ExecReload=/bin/supervisorctl reload
ExecStop=/bin/supervisorctl shutdown
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9
Mozilla/5.0 (iPad; CPU OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H321 Safari/600.1.4
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0)
@pretty00butt
pretty00butt / csvtomongo.py
Created December 16, 2015 12:43
csv to mongo with python
import sys
import csv
from pymongo import MongoClient
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
DOCUMENT_NAME = 'test'
COLLECTION_NAME = 'service'
@ivanvermeyen
ivanvermeyen / EnsureQueueListenerIsRunning.php
Last active February 13, 2024 12:40
Ensure that the Laravel queue listener is running with "php artisan queue:checkup" and restart it if necessary. You can run this automatically with a cron job: http://laravel.com/docs/scheduling
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class EnsureQueueListenerIsRunning extends Command
{
/**
* The name and signature of the console command.
@mprajwala
mprajwala / import_csv_to_mongo
Last active July 23, 2023 20:07
Store CSV data into mongodb using python pandas
#!/usr/bin/env python
import sys
import pandas as pd
import pymongo
import json
def import_content(filepath):
mng_client = pymongo.MongoClient('localhost', 27017)
@subfuzion
subfuzion / mongo-autostart-osx.md
Last active March 2, 2022 00:57
mongo auto start on OS X

Install with Homebrew

brew install mongodb

Set up launchctl to auto start mongod

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)

@pawelmhm
pawelmhm / gist:8917867
Last active January 23, 2024 15:03
Scrapy spider crawling Stack Overflow
from scrapy.spider import Spider
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
from scrapy.item import Item, Field
import urllib
class Question(Item):
tags = Field()
answers = Field()