Skip to content

Instantly share code, notes, and snippets.

docker run --name mysql_test -e MYSQL_USER=test -e MYSQL_PASSWORD=test -e MYSQL_DATABASE=test -p 3380:3306 -d mysql/mysql-server
docker logs mysql_test 2>&1 | grep GENERATED
@sergeioff
sergeioff / .zshrc
Created December 7, 2018 14:19
My .zshrc config
# Path to your oh-my-zsh installation.
export ZSH="/Users/sergeioff/.oh-my-zsh"
ZSH_THEME="agnoster"
COMPLETION_WAITING_DOTS="true"
plugins=(
git
autojump
@sergeioff
sergeioff / install.sh
Last active January 16, 2019 13:26
OS X post-install script
echo "Enter your name:"
read NAME
echo "Enter your email:"
read EMAIL
# Install xcode console developer tools
xcode-select --install
# Git configuration
git config --global user.name $NAME
@sergeioff
sergeioff / ripDVD.sh
Created September 20, 2018 17:51
Rip DVD to mp4 supported by iMovie
for entry in "."/*
do
if [[ "$entry" =~ .VOB$ ]]; then
/Applications/VLC.app/Contents/MacOS/VLC -I dummy --sout "#transcode{vcodec=h264,acodec=aac,ab=128,channels=2,samplerate=44100}:std{access=file,mux="mp4",dst=$entry.mp4}" "$entry" vlc://quit
fi
done
@sergeioff
sergeioff / IsDeviceLowEnd.java
Last active November 15, 2017 14:01 — forked from Ray33/IsDeviceLowEnd.java
Check if device is low end.Low end= Low Memory || Bad Network
private boolean getIsLowDevice(Context context) {
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
ActivityManager activityManager = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.getMemoryInfo(mi);
double availableMegs = (double)mi.availMem / 0x100000L;
String networkType = getNetworkClass(context);
return "2G".equalsIgnoreCase(networkType) || availableMegs <= 400;
}
@sergeioff
sergeioff / nginx.conf
Created August 17, 2017 12:00
working nginx config
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@sergeioff
sergeioff / default
Created August 17, 2017 10:38
generic nginx configuration
location ~ /assets/(.*) {
try_files $uri $uri/ /ui/assets/$1;
}
location ~ (([^\/]+)+(\.js|svg|eot|ico|woff2|ttf|woff|map$)) {
try_files $uri $uri/ /ui/$1;
}
@sergeioff
sergeioff / nginx.conf
Created August 16, 2017 15:01
Nginx configuration for angular
root /var/www/html/;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location ~ ([^\/]+)(?=\/.\.js$|\.js$){
try_files $uri $uri/ /ui/$1.js;