Skip to content

Instantly share code, notes, and snippets.

@tungpt247
tungpt247 / create-redis-cluster.sh
Created January 23, 2019 04:34 — forked from abhirockzz/create-redis-cluster.sh
Use redis-cli to create a Redis Cluster on Docker (with Redis 5.0)
#------------ bootstrap the cluster nodes --------------------
start_cmd='redis-server --port 6379 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes'
redis_image='redis:5.0-rc'
network_name='redis_cluster_net'
docker network create $network_name
echo $network_name " created"
#---------- create the cluster ------------------------
[B] [BUG] Change a bug, but do not any intended behavior or code style
[C] [CODESTYLE] Fix code style violation, reorder entries, but must not change any code or comment
[D] [DOCS] Add/fix/alter documentation or comments in the code
[F] [FUNC] Add new functionality or alter behaviour to match a new requirement (e.g. new button, new action)
[M] [META] Add/alter/update metadata like keywords, authors, mails and URLs or files required for development like .editorconfig or dynamicReturnTypeMeta.json, Build toolchains etc.
[P] [PURGE] Remove files or code that are not used anymore
[R] [REFACTOR] Extract code to methods/variables, simplify code. Must not change behavior.
[S] [SEC] Fix an security issue by updating a module/package or fix in the own code
[T] [TESTS] Add/fix/alter tests
[U] [UPDATE] Alter static data like labels or project dependencies, but not the application code. Must not change behaviour.
@tungpt247
tungpt247 / WebappSpringConfig.java
Created April 26, 2017 15:00 — forked from anthavio/WebappSpringConfig.java
spring-security java exploded configuration
@Configuration
@PropertySource(CoreSpringConfig.PROPERTIES)
public class WebappSpringConfig {
@Autowired
private Environment environment;
/**
* 'springSecurityFilterChain' is Magic ID and it is required by Spring Security DelegatingFilterProxy in web.xml
*
@tungpt247
tungpt247 / remove-docker-containers.md
Created February 28, 2017 14:21 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images
@tungpt247
tungpt247 / 1. Install python3.5 & pip3.md
Created August 29, 2016 02:02 — forked from alyssaq/1. Install python3.7 & pip3.md
python3.5 setup on Mac 10.11 (El Capitan)
{
"bold_folder_labels": true,
"color_scheme": "Packages/Colorcoder/Dracula (Colorcoded) (SL) (Colorcoded).tmTheme",
"convert_tabspaces_on_save": false,
"detect_indentation": true,
"ensure_newline_at_eof_on_save": true,
"expand_tabs_on_save": true,
"font_options": "subpixel_antialias",
"font_size": 13,
"highlight_line": true,
import UIKit
struct Person { // Entity (usually more complex e.g. NSManagedObject)
let firstName: String
let lastName: String
}
struct GreetingData { // Transport data structure (not Entity)
let greeting: String
let subject: String
rm -rf ~/.rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install --list
rbenv install 2.2.3
@tungpt247
tungpt247 / delete-derived-data
Last active November 7, 2015 03:08
Delete derived data
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf /Users/your-name/Library/Developer/Xcode/DerivedData/*
@tungpt247
tungpt247 / commandline-testing-iphone-app
Created October 30, 2015 03:14
Run Testing you app on Commandline
xcodebuild \
-scheme your-project-name \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 6,OS=8.1' \
test | xcpretty --test --color