Skip to content

Instantly share code, notes, and snippets.

View atuanpham's full-sized avatar
Drinking coffee

Tuan Pham atuanpham

Drinking coffee
View GitHub Profile
#################################################################
# _` #
# _ooOoo_ #
# o8888888o #
# 88" . "88 #
# (| -_- |) #
# O\ = /O #
# ____/`---'\____ #
# .' \\| |// `. #
# / \\||| : |||// \ #
@TomyJaya
TomyJaya / spring-data-rest-notes.md
Last active March 20, 2024 07:06
Spring Data REST - Useful notes

How To change baseUri:

in application.properties add:

spring.data.rest.basePath=/api
  • or -

in application.yml add:

@matthiasg
matthiasg / gist:2b8748cfdf919ce77c3fd0438613cee6
Created April 12, 2016 21:11 — forked from robinloxley1/gist:7ea7c4f37a3413b1ca16
sample elasticsearch query to sort parent based on child field
{
"query":{
"has_child":{
"query":{
"function_score":{
"functions":[
{
"field_value_factor":{
"factor":1,
"field":"count"
@geshan
geshan / scope-and-steps-outlines.md
Last active January 5, 2021 23:38
user system ticket

Scope and steps for user system ticket - PX-4

Proposed steps to develop the ticket:

  1. Add new table to the main db users table, with needed columns (id, email, password, first_name, last_name, restore_key, created_at, updated_at)
  2. Add a migration for the columns mentioned above
  3. Tests the migration on local and also record the time it takes to run locally.
  4. Add form to create new user and make persist it in the db table. Password will be encrypted using SHA512.
  5. Do basic validation like required
  6. Enhance validation to accept only email in email field, accept only alphabets (not numbers) for first name and last name.
@vitorbritto
vitorbritto / rm_mysql.md
Last active April 23, 2024 14:21
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

    brew remove mysql
    
@soheilhy
soheilhy / nginxproxy.md
Last active March 22, 2024 08:54
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@chrisjhoughton
chrisjhoughton / proxy.apache.conf
Last active April 26, 2024 06:26
Sample Nginx reverse proxy to Apache set up for Wordpress.
<VirtualHost *:{PORT}>
ServerName www.yourdomain.com
ServerAdmin mail@domain.com
DocumentRoot /var/www/yourdir/
<Directory /var/www/yourdir>
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
@glenfant
glenfant / logging_yaml_config.py
Last active November 11, 2021 14:08
A example of logging medium complex configuration using YAML on Python 2.7 or 3.2
# -*- coding: utf-8
"""\
A simple demo of logging configuration with YAML (Python 2.7)
=============================================================
Requires PyYAML -> "easy_install PyYAML"
See the recipes for configuring logging with dicts and YAML
- http://docs.python.org/2.7/howto/logging-cookbook.html
- http://stackoverflow.com/questions/10519392/python2-7-logging-configuration-with-yaml
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a