Skip to content

Instantly share code, notes, and snippets.

list all fields in a table pragma table_info(tableName)

Errors

  1. Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have
  • fix by: chmod 755 android/gradlew
  1. react-native run-android not found default
  • fix by remove dependency that not used from android/settings.gradle and MainApplication.java

colored diff command's result svn | vim -R -

  1. undefined is not a function (evaluating ...) this error occurred because import undefault item as a default item eg

`// should not work import AsyncStorage from 'react-native';

// work import { AsyncStorage } from 'react-native'; `

  1. Error aapt: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory archlinux Archlinux install https://www.archlinux.org/packages/core/x86_64/lib32-gcc-libs/

  2. Error stuck loading from ip:port on android emulator. Try to increase setting for fs.inotify.watch_user_watches by follow this thread facebook/react-native#3199 or one of these commands echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches or sudo sysctl fs.inotify.max_user_watches=65536, also setting ip:port for dev server in android emulator by choose dev setting -> dev server on dev menu pop up (open popup by shake device or run command adb shell input keyevent 82)

@bolerap
bolerap / emacs_cmd.md
Created May 9, 2018 06:55
Emacs useful commands
  1. Select all text in a buffer (like ctrl + a): c-x h (mark-whole-buffer)
  2. Reformat a block code (Auto indent code): c-m-\ (indent-region) (https://www.emacswiki.org/emacs/ReformatBuffer)
  3. comment a line of code or a block of code: m-;
  4. uncomment a region: c-m ;
@bolerap
bolerap / index_dyn_col_mongo.js
Last active April 4, 2018 10:11
Create dynamic collections mongodb
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/testdyn');
const consola = require('consola');
// use generator
function* limit() {
let index = 0;
while (index < 10000) {
yield index++;
}

error when run mix ecto.create fix by change password and restart postgres as following commands

sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
sudo /etc/init.d/postgresql restart

Then install this tool https://github.com/rvoicilas/inotify-tools/wiki when rung mix phx.server

@bolerap
bolerap / alpine_proxy_setting.md
Created September 11, 2017 08:13
Setting proxy for alpine linux
  1. create a file to keep environment variables (called env.sh here) at /etc/profile.d/env.sh
  2. export two proxy variable in /etc/profile.d/evn.sh as below
export http_proxy=http://<ip/name>:<port>
export https_proxy=$http_proxy
@bolerap
bolerap / mgoExample.go
Created August 16, 2017 04:31 — forked from border/mgoExample.go
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {