Skip to content

Instantly share code, notes, and snippets.

View saminwankwo's full-sized avatar

Nwankwo Samuel saminwankwo

View GitHub Profile
@saminwankwo
saminwankwo / a2dp.py
Created April 20, 2018 13:24 — forked from pylover/a2dp.py
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
#! /usr/bin/env python3.5
"""
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04 and also debian jessie, with bluez5.
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone.
This will be only fixes the bluez5 problem mentioned above .
@saminwankwo
saminwankwo / datetime.java
Last active July 10, 2018 20:41
A demo code to calculate user's year, date and time of birth
package com.root.datetime;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.Period;
import java.time.ZoneId;
import java.util.Date;
@saminwankwo
saminwankwo / checkleapyear.java
Last active July 12, 2018 07:21
code to determine whether the given year is leap year or not.
public class DetermineLeapYearExample {
public static void main(String[] args) {
//year we want to check
int year = 2004;
//if year is divisible by 4, it is a leap year
if((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0)))
@saminwankwo
saminwankwo / index.html
Created August 7, 2018 23:57
Javascript Calculator
<h1>JavaScript Calculator</h1>
<p class="warning">Don't divide by zero</p>
<div id="calculator" class="calculator">
<button id="clear" class="clear">C</button>
<div id="viewer" class="viewer">0</div>
<button class="num" data-num="7">7</button>
@saminwankwo
saminwankwo / Login.php
Created September 25, 2018 01:33
A simple Registeration and login form in Php Sql
login_page.php
<form action="verify.php" method="post">
User Name:<br>
<input type="text" name="username"><br><br>
Password:<br>
<input type="password" name="password"><br><br>
<input type="submit" name="submit" value="Login">
</form>
verify.php
@saminwankwo
saminwankwo / flip.html
Created March 29, 2019 23:43
A simple flip card, or profile flip page
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: Arial, Helvetica, sans-serif;
}
.flip-card {
@saminwankwo
saminwankwo / Simple Quiz App.html
Last active September 16, 2019 14:09
A simple quiz application designed in javascript
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
@saminwankwo
saminwankwo / index.html
Last active March 5, 2020 06:35
Responsive Chat Widget
<section class="avenue-messenger">
<div class="menu">
<div class="items"><span>
<a href="#" title="Minimize">&mdash;</a><br>
<!--
<a href="">enter email</a><br>
<a href="">email transcript</a><br>-->
<a href="#" title="End Chat">&#10005;</a>
</span></div>
@saminwankwo
saminwankwo / create_subdomain_cpanel.php
Created September 25, 2020 11:57 — forked from hsali/create_subdomain_cpanel.php
PHP Script to create subdomain on cpanel .
function create_subdomain($subDomain,$cPanelUser,$cPanelPass,$rootDomain) {
// $buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain;
$buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/subdomains/" . $subDomain;
$openSocket = fsockopen('localhost',2082);
if(!$openSocket) {
return "Socket error";
exit();
@saminwankwo
saminwankwo / file.php
Last active April 23, 2021 08:05
a simple class to convert number to ords
<?php
//simple class to convert number to words in php based on http://www.karlrixon.co.uk/writing/convert-numbers-to-words-with-php/
if ( !class_exists('NumbersToWords') ){
/**
* NumbersToWords
*/
class NumbersToWords{
public static $hyphen = '-';
public static $conjunction = ' and ';