Skip to content

Instantly share code, notes, and snippets.

View mashcom's full-sized avatar
💭
Working

Blessing Mashcom Mashoko mashcom

💭
Working
View GitHub Profile
@mashcom
mashcom / 3_install_database.sh
Last active June 14, 2023 13:49
3_install_database.sh
## DATABASE MIGRATIONS
set -eu
# Run database migrations
sudo venvs/django/bin/python manage.py makemigrations
sudo venvs/django/bin/python manage.py migrate
#create application super user
sudo venvs/django/bin/python manage.py createsuperuser
@mashcom
mashcom / 000-default.conf
Created June 14, 2023 13:08
Originality Apache
SetEnv APPLICATION_SERVER_ADMIN support@mashcom.co.zw
SetEnv APPLICATION_DOMAIN_NAME originality.eastus.cloudapp.azure.com
SetEnv APPLICATION_ROOT_DIR /var/originality-integration-fiverr
SetEnv WSGID_PROCESS_NAME originality_app_process_name
<VirtualHost *:80>
ServerAdmin ${APPLICATION_SERVER_ADMIN}
ServerName ${APPLICATION_DOMAIN_NAME}
DocumentRoot ${APPLICATION_ROOT_DIR}
ErrorLog ${APACHE_LOG_DIR}/originality_error.log
@mashcom
mashcom / install.sh
Created June 14, 2023 13:07
Originality Install Script
#!/bin/bash
## BASE INSTALLATION
# Update package lists
sudo apt-get update
# Install necessary packages
sudo apt-get install apache2 # Apache HTTP Server
sudo apt-get install apache2-dev # Apache development headers and module support
[Unit]
Description=AutoSSH tunnel service everythingcli MySQL on local port 5000
After=network.target
[Service]
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -p 64371 -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -NL 5000:localhost:3306 root@target_server
[Install]
WantedBy=multi-user.target
@mashcom
mashcom / patch.php
Created January 24, 2022 12:40
patch
<?php
namespace App\Http\Controllers;
use App\Models\Voter;
use Illuminate\Http\Request;
class VoterController extends Controller
{
/**
<div class="alert alert-info font-weight-bold">
<p>To secure your place, kindly pay full fees by 31 May 2020.</p>
<p>How to download acceptance letter</p>
<ul>
<li>Create your elearning account at <a href="https://elearning.msu.ac.zw/login/create_account" target="_blank">https://elearning.msu.ac.zw/login/create_account</a></li>
<li>Login to your new elearning account</li>
<li>On your elearning dashboard click the "Download Acceptance Letter" button to dowload your acceptance letter</li>
</ul>
</div>
@mashcom
mashcom / .htaccess
Created June 13, 2018 06:35
General Redirect Rules
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@mashcom
mashcom / wp_get_children.php
Created April 19, 2018 09:38
Get children of a current page
<?php
$id = the_ID();
while ( have_posts() ) : the_post();
$gp_args = array(
'post_type' => 'page',
'post_parent' => $id,
'order' => 'ASC',
'orderby' => 'menu_order',
'posts_per_page' => -1
);
#include <stdio.h>
int main(int argc, char * argv[]){
int ages[]={12,56,23,34,51};
char *name[]={"blessing","tawanda","prosper","simba","titi"};
int count=sizeof(ages)/sizeof(int);
int i=0;
@mashcom
mashcom / forloop.c
Created June 16, 2014 11:55
basic forloop statement in c
# include <stdio.h>
int main(int argc, char * argv[]){
int i=0;
// go through each string in argv
// why am I skipping argv[0]?
for(i = 1; i < argc; i++) {
printf("arg %d: %s\n", i, argv[i]);