Skip to content

Instantly share code, notes, and snippets.

View otienog1's full-sized avatar

George Otieno otienog1

View GitHub Profile
@otienog1
otienog1 / ubuntu-server-guest-additions.md
Last active November 1, 2022 21:11 — forked from vimishor/ubuntu-server-guest-additions.md
Installing VirtualBox Guest Additions on Ubuntu Server

Tested on Ubuntu Server 22.04

  • Start the Ubuntu Server VM and insert the Guest Additions CD image (Devices menu, Install Guest Additions).

  • Mount CD Rom:

    $ sudo mount /dev/cdrom /media
  • Install necessary build tools and dependencies:

@otienog1
otienog1 / countrydropdown.html
Created January 10, 2022 09:19 — forked from danrovito/countrydropdown.html
HTML Country Select Dropdown List
<label for="country">Country</label><span style="color: red !important; display: inline; float: none;">*</span>
<select id="country" name="country" class="form-control">
<option value="Afghanistan">Afghanistan</option>
<option value="Åland Islands">Åland Islands</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
@otienog1
otienog1 / nextjs.conf
Created November 23, 2021 11:35 — forked from zackad/nextjs.conf
NGINX server configuration for nextjs static generated site.
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location ~ /.+ {
try_files $uri $uri.html $uri =404;
}
@otienog1
otienog1 / backup_mysqldb.sh
Created August 10, 2021 07:46 — forked from skarllot/backup_mysqldb.sh
Bash script to backup all mysql databases thru mysqldump
#!/bin/bash
# Destiny folder where backups are stored
DEST=/tmp/bacula/server01
CURRDATE=$(date +"%F")
# Hostname where MySQL is running
HOSTNAME="srv-mysql"
# User name to make backup
USER="root"
@otienog1
otienog1 / index.php
Created September 13, 2020 10:36 — forked from abel-masila/index.php
A simple USSD registration application written in PHP
<?php
/* Simple sample USSD registration application
* USSD gateway that is being used is Africa's Talking USSD gateway
*/
// Print the response as plain text so that the gateway can read it
header('Content-type: text/plain');
/* local db configuration */
$dsn = 'mysql:dbname=dbname;host=127.0.0.1;'; //database name
@otienog1
otienog1 / .block
Created September 4, 2020 07:55 — forked from wushaobo/.block
Flask server-side session with redis
license: gpl-3.0
border: no
@otienog1
otienog1 / Instructions.sh
Created August 28, 2018 09:58 — forked from GhazanfarMir/Instructions.sh
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@otienog1
otienog1 / stream.sh
Created August 27, 2018 06:49 — forked from andreif/stream.sh
#!/bin/sh -xe
API_KEY="YOUR_API_KEY_GOES_HERE"
FPS="10"
VLC_PATH="/Applications/VLC.app/Contents/MacOS/VLC"
# I don't know how this'll behave on multimon, so you might want to hard-code.
# INRES='1440x900'
INRES=$(osascript -e 'tell application "Finder" to get bounds of window of desktop'|sed 's/, /x/g'|cut -f3- -dx)
OUTRES='1280x800'
# You can change this to record microphone or something else, from man soxformat (under coreaudio):
# coding=utf-8
import base64
from urllib2 import urlopen
import tempfile
import os
import tk
import json
class App(tk.Tk):
from datetime import datetime, timezone, timedelta
def convert_timezone(dtm, z='utc'):
t_utc = (dtm - (dtm.utcoffset() or timedelta()))
t_utc = t_utc.replace(tzinfo=timezone.utc)
z = z.lower().replace('utc', '').replace(' ', '').replace(':', '')
if not z:
return t_utc
if len(z) == 3: