Skip to content

Instantly share code, notes, and snippets.

Avatar

sugiarto ugifractal

View GitHub Profile
View move_docker_image
mv /Users/sugiarto/Library/Containers/com.docker.docker /Users/sugiarto/Library/Containers/com_docker_docker
mkdir /Volumes/docker/com.docker.docker
ln -s /Volumes/docker/com.docker.docker /Users/sugiarto/Library/Containers/com.docker.docker
cp -r /Users/sugiarto/Library/Containers/com_docker_docker/* /Volumes/docker/com.docker.docker/
@ugifractal
ugifractal / mosquitto.conf
Created Dec 4, 2020
sample auth plugin for mqtt http /usr/local/etc/mosquitto/mosquitto.conf
View mosquitto.conf
auth_plugin /Users/sugiarto/my_apps/sugi/goapp/mosquitto-go-auth/go-auth.so
auth_opt_backends http
auth_opt_http_host localhost
auth_opt_http_port 8000
auth_opt_http_getuser_uri /mqtt/get_user
auth_opt_http_response_mode status
auth_opt_http_params_mode json
auth_opt_http_aclcheck_uri /mqtt/get_acl
@ugifractal
ugifractal / gist:8295f86d29119a450f3644f7b190284c
Created Dec 2, 2020
Noticed gem error ActiveRecord::RecordInvalid (Validation failed: xxxx must exist):
View gist:8295f86d29119a450f3644f7b190284c
When sending notification using rails jumpstart and noticed gem I got following error:
NewLead.with(account: Account.first, lead: lead).deliver(User.find(lead.receiver_id))
and got Error performing Noticed::DeliveryMethods::Database (Job ID: 50b96038-e794-4b3b-b9aa-76c400876daa) from Async(default) in 112.37ms: ActiveRecord::RecordInvalid (Validation failed: Account must exist):
This happen because account_id missing on attributes.
Fixed by adding "format" to "deliver_by" at new_lead.rb
# To deliver this notification:
View ffi gem install
gem install ffi -v ‘1.9.23’ -- --with-ldflags=-L/usr/local/Cellar/libffi/3.3/lib --with-cppflags=-I/usr/local/Cellar/libffi/3.3/include --with-cflags=“-Wno-error=implicit-function-declaration”
@ugifractal
ugifractal / rpi_using_usb_soundcard.txt
Created Jul 30, 2019
set raspberry pi 3 to use usb soundcard as default
View rpi_using_usb_soundcard.txt
$ sudo nano /usr/share/alsa/alsa.conf
then update from:
defaults.ctl.card 0
defaults.pcm.card 0
become:
@ugifractal
ugifractal / auto_start_app_for_openauto.txt
Last active Jul 30, 2019
this is how I made openauto start automatically on raspberry
View auto_start_app_for_openauto.txt
$ cd ~/.config
$ mkdir autostart
$ cd autostart
$ sudo nano autoapp.desktop
then copy this:
[Desktop Entry]
Name=Autoapp
Exec=sudo /home/pi/openauto/bin/autoapp
@ugifractal
ugifractal / openauto_install.txt
Last active Jul 30, 2019
installation open auto
View openauto_install.txt
- Preparing required package
$ sudo apt-get update
$ sudo apt-get install -y libboost-all-dev libusb-1.0.0-dev libssl-dev cmake libprotobuf-dev protobuf-c-compiler protobuf-compiler
$ sudo apt-get install -y libqt5multimedia5 libqt5multimedia5-plugins libqt5multimediawidgets5 qtmultimedia5-dev libqt5bluetooth5 libqt5bluetooth5-bin qtconnectivity5-dev pulseaudio librtaudio-dev librtaudio5a
- Build aasdk
cd ~
Fork abraha2d's aasdk to your account
$ git clone https://github.com/USERNAME/aasdk.git
@ugifractal
ugifractal / fix.txt
Created Jun 29, 2019
fixing react-native version mismatch
View fix.txt
yarn react-native upgrade
rm -rf node_modules
yarn
expo client:install:android
expo start
@ugifractal
ugifractal / util.rb
Created Nov 22, 2018
ruby Method using Faraday to send push notification on onesignal API
View util.rb
def self.onesignal_notify(user, message)
headers = {
"Authorization" => "BASIC #{APP_CONFIG['onesignal']['api_key']}",
"Content-Type" => "Application/json"
}
body = {
"app_id" => APP_CONFIG['onesignal']['app_id'],
"data" => {"type": "post"},
"contents" => {"en" => message},
#"include_player_ids" => [user.onesignal],
View org1.csv
id cofog1code cofog2code cofog3code cofog1label cofog2label cofog3label amount time
1431772969128-10 01 01.1 01.1.1 General public services Executive and legislative organs, financial and fiscal affairs, external affairs Executive and legislative organs 1 2015
1431772969128-11 01 01.1 01.1.2 General public services Executive and legislative organs, financial and fiscal affairs, external affairs Financial and fiscal affairs 1 2015
You can’t perform that action at this time.