Instantly share code, notes, and snippets.

View main.cpp
constexpr int ORD(int n){
int res = 1;
for(int i=0; i < n; i++){
res *= 10;
}
res++;
return res;
}
View main.cpp
auto cmp = [](int a, int b){return a > b;};
set<int, decltype(cmp)> s(cmp);
for_each(evens, evens + 100001, [&](int n){s.insert(n);});
int num_secondpop_evens = 0;
if(s.size() > 1){
num_secondpop_evens = *(++s.begin());
}
View README.md

This is a small modification of [http://cvxopt.org/applications/nucnrm/] for Python3 & CVXOPT. As the comment says, this program was originally written by Z. Liu and L. Vandenberghe, and it distributed under GPL.

View MainActivity.kt
package com.example.ashia.permission_test
import android.Manifest
import android.content.pm.PackageManager
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.os.Environment
import android.support.v4.app.ActivityCompat
import android.widget.Button
import android.widget.EditText
View vagrant-ip.sh
vagrant ssh -c "curl ipinfo.io/ip"
View output
./test.exe: symbol lookup error: ./test.exe: undefined symbol: Z3_get_full_version
View build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.ashia.filereadtest"
View ExampleFragmentPagerAdapter.kt
package com.example.ashia.pagertest
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
class ExampleFragmentPagerAdapter(fm: FragmentManager?) : FragmentPagerAdapter(fm) {
override fun getItem(position: Int): Fragment {
when(position){
0 -> {
View MainActivity.kt
package com.example.ashia.filereadtest
import android.content.Context
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.widget.AdapterView
View listtest.kt
package com.example.ashia.filereadtest
import android.content.Context
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.AdapterView
import android.widget.ListView
import android.widget.SimpleAdapter
import android.widget.Toast