Skip to content

Instantly share code, notes, and snippets.

View 03balogun's full-sized avatar

Balogun Wahab 03balogun

View GitHub Profile
<?php
// custom/Extension/modules/Schedulers/Ext/ScheduledTasks/SendInvoiceEmail.php
function SendInvoiceEmail($job){
global $log, $sugar_config;
$log->fatal("###### BEGIN SENDING INVOICE EMAIL ########");
try{
// $job->data here is the required data to complete this task,
//which in our is the invoice id, we are generating pdf for
if (isset($job->data) && $job->data !== '') {
@03balogun
03balogun / custom_utils.php
Last active January 18, 2020 19:03
This file will contain sendEmail and jobQueue functions that we can use globally within suiteCRM application.
<?php
// custom/include/custom_utils.php
function sendEmail($email, $subject, $emailBody , $attachment = null)
{
// Convert the email to array in case we are sending to multiple emails
$emails = explode(',', $email);
global $log;
$emailObj = new Email();
$defaults = $emailObj->getSystemDefaultEmail();
@03balogun
03balogun / increase_root_fedora.md
Created September 26, 2019 16:54 — forked from 181192/increase_root_fedora.md
How to increase the root partition size on Fedora

How to increase the root partition size on Fedora

Boot up with an Fedora Live USB stick.

  1. Run vgs to check if there's any space:
$ sudo vgs
  VG     #PV #LV #SN Attr   VSize    VFree
  fedora   1   3   0 wz--n- <237.28g    0 
// express/.gitlab-ci.yml
...
deploy:
stage: deploy
script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
// express/.gitlab-ci.yml
image: node:10.11.0
cache:
paths:
- node_modules/
stages:
- build
// ig-bot/Bot/config/puppeter.json
{
"base_url": "https://www.instagram.com",
"username": "your-username",
"password": "your-password",
"hashTags": ["cars","cat","soccer","javascript","places","football", "Motivation"],
"settings": {
"run_every_x_hours": 3,
"like_ratio": 0.75,
@03balogun
03balogun / index.js
Created November 14, 2018 12:45
Export module
module.exports = InstagramBot;
@03balogun
03balogun / index.js
Last active November 24, 2018 17:09
Bot entry point
// ig-bot/index.js
const Bot = require('./Bot');// this directly imports the Bot/index.js file
const config = require('./Bot/config/puppeteer');
const run = async () => {
const bot = new Bot();
const startTime = Date();
@03balogun
03balogun / index.js
Last active November 24, 2018 17:06
Add the closeBrowser() method to our class
//index.js
...
async closeBrowser(){
await this.browser.close();
}
}
@03balogun
03balogun / index.js
Last active November 24, 2018 17:02
Add the unFollowUsers() method to our class
//ig-bot/Bot/index.js
...
async unFollowUsers() {
let date_range = new Date().getTime() - (this.config.settings.unfollow_after_days * 86400000);
// get the list of users we are currently following
let following = await this.firebase_db.getFollowings();
let users_to_unfollow = [];