Skip to content

Instantly share code, notes, and snippets.

@MrCrap
MrCrap / Format Rupiah di Python.md
Created August 28, 2017 11:09 — forked from yanwarrior/Format Rupiah di Python.md
Format rupiah di Python
# rupiah.py
# ---------------

import locale

def rupiah_format(angka, with_prefix=False, desimal=2):
    locale.setlocale(locale.LC_NUMERIC, 'IND')
    rupiah = locale.format("%.*f", (desimal, angka), True)
 if with_prefix:
@MrCrap
MrCrap / centos7-nginx-laravel-configuration
Created February 21, 2023 07:38 — forked from breekoy/centos7-nginx-laravel-configuration
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
@MrCrap
MrCrap / Response.php
Created February 17, 2022 19:49 — forked from jeffochoa/Response.php
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;
@MrCrap
MrCrap / gist:6008642b9b480e7c34524cd6606139bd
Created December 1, 2021 18:25 — forked from pawelmhm/gist:8917867
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()
@MrCrap
MrCrap / config.py
Created July 5, 2018 08:57 — forked from oinume/config.py
Flask + python-oauth2 + python-twitter sample
# app/config.py
# -*- coding: utf-8 -*-
import os
class Config(object):
DEBUG = False
SQLALCHEMY_ECHO = False
SECRET_KEY = 'dev_key_h8hfne89vm'
CSRF_ENABLED = True
CSRF_SESSION_LKEY = 'dev_key_h8asSNJ9s9=+'
@MrCrap
MrCrap / osx-10.9-setup.md
Created August 16, 2017 06:29 — forked from kevinelliott/osx-10.9-setup.md
Clean Install – Mac OS X 10.9 Mavericks

Mac OS X 10.9 Mavericks

Custom recipe to get OS X 10.9 Mavericks running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install.

Install Software

The software selected is software that is "tried and true" --- software I need after any fresh install. I often install other software not listed here, but is handled in a case-by-case basis.

Install from App Store

@MrCrap
MrCrap / README.md
Created August 6, 2017 17:41 — forked from andrewsmedina/README.md
Find slow queries in mongo DB

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...