Skip to content

Instantly share code, notes, and snippets.

View stiucsib86's full-sized avatar

binghan.eth stiucsib86

View GitHub Profile
@stiucsib86
stiucsib86 / laravel-artisan-command-change-user-permission
Created August 24, 2021 10:17
Changing User Permission when running Laravel Artisan Command or Scheduling Crontab
# If you are running into following error when running Laravel Artisan commands:
# The stream or file "/opt/bitnami/apps/{projects}/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
#
# This is caused by the logs/cache files owned by "daemon" (or www-data) user. To resolve this, you can run the command under the correct user, e.g:
$ sudo -u daemon php artisan schedule:run
# Similarly, if you want to schedule cronjobs, you can also
$ crontab -e
# Then change the user before running Artisan Commands, e.g. :
* * * * * cd /opt/bitnami/apps/{projects}/ && sudo -u daemon /opt/bitnami/php/bin/php artisan schedule:run >> /home/bitnami/logs/cron.log 2>&1
@stiucsib86
stiucsib86 / gist:9934f139ed1ccf93da47d41e9bbd8942
Created January 22, 2021 11:38
[Google Sheet] Useful scripts to pull data from Coingecko API
function getPriceCoingecko(crypto) {
if (!crypto) return null;
var cache = CacheService.getDocumentCache();
var cache_key = "Price_" + crypto;
var results;
if (results = cache.get(cache_key)) {
return parseFloat(results);
}
// Reference: https://api.coingecko.com/api/v3/coins/list
Include "/opt/bitnami/apps/website/conf/httpd-vhosts.conf"
cd /opt/bitnami/apps/website/htdocs/wp-content
chown daemon:daemon upgrade
chown -R daemon:daemon uploads
chmod 777 .
chmod -R 777 uploads

Keybase proof

I hereby claim:

  • I am stiucsib86 on github.
  • I am binghan (https://keybase.io/binghan) on keybase.
  • I have a public key whose fingerprint is 616D 265A 8DBA D5E1 47B7 340E 3DB7 7EC6 5F68 C98B

To claim this, I am signing this object:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<title></title>
<!--[if !mso]><!-->
<meta http-equiv="x-ua-compatible" content="IE=edge">
<!--<![endif]-->
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--[if !mso]><!-->
#!/bin/bash
# To run script
# 1. in background which immune to hangups (meaning you can exit terminal safely),
# 2. and write output to "nohup.out" file
#
# nohup ./privcy-raspberry-pi.sh &
# Prerequisite: Install required tools
sudo apt-get update
@stiucsib86
stiucsib86 / wallet.cpp
Created May 6, 2018 06:47
DeepOnion src/wallet.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "txdb.h"
#include "wallet.h"
#include "walletdb.h"
#include "crypter.h"
#include "ui_interface.h"
#!/bin/bash
# To run script
# 1. in background which immune to hangups (meaning you can exit terminal safely),
# 2. and write output to "nohup.out" file
#
# nohup ./deeponion-raspberry-pi.sh &
# Prerequisite: Install required tools
sudo apt-get install build-essential libtool autotools-dev autoconf automake pkg-config libssl-dev libboost-all-dev bsdmainutils libqrencode-dev libminiupnpc-dev libevent-dev libcap-dev libseccomp-dev git libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler
0xF6039F2359e5D2bDc5249AB1281d18e2C8549D9d
@stiucsib86
stiucsib86 / composer-teaser.js
Created February 6, 2017 03:45
Visual Composer fixes ".vc_teaser-btn-{{ name }}" error fixes
parse: function() {
var value = this.$data_field.val(),
data = !_.isEmpty(value) ? $.parseJSON(value) : [];
if(_.isEmpty(value)) {
data = [{link: "post", name: "title"}, {name: 'image'}, {name: 'text'}];
this.$data_field.val(JSON.stringify(data));
}
_.each(data, function(block_data){
if(_.isString(block_data.name) && block_data.name.indexOf('{{') < 0) {
var $control = $('.vc_teaser-btn-' + block_data.name, this.$toolbar).prop('checked', true);