After some time, I have many local branches still exist. Just delete them all with this simple command :
$ git branch | grep -v "master" | xargs git branch -D
This command is for delete your local git branches and keep only for master branch.
Security Researcher, DevOps, SRE
After some time, I have many local branches still exist. Just delete them all with this simple command :
$ git branch | grep -v "master" | xargs git branch -D
This command is for delete your local git branches and keep only for master branch.
So I’m just lazy, I know there is better way to serve Ruby on Rails with unicorn or uWSGI, but I will try later.
This time I just want a have a quick look how’s the RoR running on the browser only with nginx, just a quick guide, no bullshit. so currently I have rails installed on my ubuntu machine 14.04 with mysql database configured and nginx. So make sure you have those things installed properly to follow this guide.
I usually create my local domain first to navigate it easier:
$ sudo echo -e "127.0.0.1\tmyapp.local" >> /etc/hosts
Create the nginx config for your web app :
$ sudo vim /etc/nginx/conf.d/myapp.conf
very simple myapp.conf looks like:
server { listen 80; server_name www.myapp.local myapp.local; charset utf-8; access_log /var/log/nginx/myapp.access.log; error_log /var/log/nginx/myapp.error.log; location / { proxy_pass http://127.0.0.1:3000; } }
Check nginx config and restart
$ sudo nginx -t $ sudo service nginx restart
Run the rails (I told you, I’m just lazy) :
$ cd /myapp $ rails server &
And now, Rails is running with port 3000 which nginx already addressed to myapp.local domain. Open up the browser and navigate to http://myapp.local
I’m sick of people who write tutorials which is not clear to install the Rails, too long, too much multiple choice, rambling. This is tutorial that actually works for me. Hope it would work for you too.
Install some dependencies first
$ sudo apt-get update $ sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev nodejs
And we install the ruby, the current new version when this post is written is ruby 2.4.1, you might want to change with the newer version if available.
$ wget http://ftp.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.gz $ tar xzvf ruby-2.4.1.tar.gz $ cd ruby-2.4.1 $ ./configure $ make $ sudo make install
Check the ruby version
$ ruby -v
Install bundler and Rails with gem
$ sudo gem install bundler $ sudo gem install rails
Check the Rails version
$ rails -v
Create new app
$ rails new my_new_app
Sometimes I got confused whether to set my static file with nginx or just inside the Django.
This is how I do it inside urls.py in django app directory.
from django.views.generic import TemplateView urlpatterns = { .... url(r'^static\.txt$', TemplateView.as_view(template_name='files/static.txt', content_type='text/plain')), .... }
and navigate to https://myurl.com/static.txt
You go to twitter, and select your following and scroll all the way down until it reaches the bottom, you can hold on the Page Down button to be more efficient.
If it reaches the bottom of the page, open up the console or if you use chrome, press Ctrl+Shift+J, select console tab, and paste this code:
[].slice.call(document.querySelectorAll('.unfollow-text')).forEach(function(button) { button.click(); });
nailed it.
So, this error showed up when I tried to update gms google services for push notifications.
Error:Execution failed for task ':app:processDebugGoogleServices'. > Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
Currently, I compiled android.gms:play-services with version 8.3.0 which is not allowed at this time cause I have different version level within my build.gradle file. To fix this, you just need to update com.google.gms:google-services version inside both build.gradle files.
build.gradle file in project level :
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.1' classpath 'com.android.tools.build:gradle:2.2.0' classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }
inside the build.grade app level file, I added compile ‘com.google.android.gms:play-services:9.0.0’ inside dependencies tag and apply plugin: ‘com.google.gms.google-services’ at the end of lines. So, it looks like this:
apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { applicationId "com.myLambdaapp.myLambdaapp" minSdkVersion 14 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support.constraint:constraint-layout:1.0.2' testCompile 'junit:junit:4.12' compile 'com.google.android.gms:play-services:9.0.0' } apply plugin: 'com.google.gms.google-services'
This is how to check connection in android whether your phone is connected to the internet or not. put this function inside your public class.
private boolean isConnected() { ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Activity.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected()) return true; else return false; }
Ignore permissions
git config core.fileMode false
list branch
git branch
rename branch
git branch -m <newname>
move to another branch
git checkout your-branch
hard reset branch
git reset --hard origin/master
create new branch
git checkout -b new-branch
delete local branch
git branch -D your-branch
merge from develop to master
git merge develop
init on existed project and push master for the first time
git init git remote add origin ssh://git@bitbucket.org/your-username/your-repo.git git add . git commit -am "initial commit" git push -u origin master