Skip to content

Instantly share code, notes, and snippets.

View ShadrackKimutai's full-sized avatar

Shadrack K Kimutai ShadrackKimutai

View GitHub Profile
@ShadrackKimutai
ShadrackKimutai / gist:1156f7c9ddec1266cec1f41994bb0bcf
Created November 4, 2023 15:30
Script to Fetch Student Names for Moodle Link Submission
import os
def list_subdirectories(directory):
"""Lists all subdirectory names in a directory.
Args:
directory: The directory to list subdirectories in.
Returns:
A list of all subdirectory names in the directory.
@ShadrackKimutai
ShadrackKimutai / JasperReportExample.java
Created November 8, 2020 04:30
Jasper Report Example
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package co.ke.shardx.jasper.reports.example;
import java.awt.BorderLayout;
import java.io.File;
import java.sql.Connection;
@ShadrackKimutai
ShadrackKimutai / LineFollowerReader.ino
Created March 7, 2020 20:14
code for detecting line using QTR-8RC Reflectance Sensor Array. set on white on black. incase of the opposite, switch 1 for 0 and 0 for 1 in the unary at line 24
#include <QTRSensors.h>
#define NUM_SENSORS 8
#define NUM_SAMPLES_PER_SENSOR 4
#define EMITTER_PIN 2
// sensors 0 through 7 are connected to analog inputs 0 through 7, respectively
QTRSensorsAnalog qtra((unsigned char[]) {0,1,2,3,4,5,6,7},NUM_SENSORS, NUM_SAMPLES_PER_SENSOR, EMITTER_PIN);
unsigned int sensorValues[NUM_SENSORS];
@ShadrackKimutai
ShadrackKimutai / linefollowerarray.ino
Last active February 18, 2020 19:43
SparkFun Line Follower Array with Arduino Robot Code
#include "Wire.h"
#include "sensorbar.h"
#include "Servo.h"
Servo base, elbow, gLeft, gRight;
const int mL1 = 8, mL2 = 7, mR1 = 4, mR2 = 9, mLPWM = 5, mRPWM = 6;
const int TRACK_SPEED = 80, MAX_SPEED = 160, APPROACH_SPEED = 60, ALIGN_HIGH_SPEED = 90, ALIGN_LOW_SPEED = 30;
char lastLane = 'C';
#define MID_VAL 500
@ShadrackKimutai
ShadrackKimutai / index.php
Created January 27, 2020 06:03
Bug ridden index
@extends('layouts.app')
@section('title', 'SkillMap Home')
@section('content')
<div id="content"> <div id="map" style="width: 100%; height: 100%;"></div>
</div>
</div>
@ShadrackKimutai
ShadrackKimutai / gmaps.js
Created March 25, 2018 17:33 — forked from cvan/gmaps.js
Google Maps multiple destinations sorted by shortest path
require('es6-promise').polyfill();
var request = require('request');
const API_KEY = process.env.GOOGLE_MAPS_API_KEY || '';
var places = [
'steins, mountain view, CA',
'st. stephens green, mountain view, CA',
@ShadrackKimutai
ShadrackKimutai / Robot arm Sequence.
Last active February 18, 2020 20:31
Improved last lane memory working
#include "Wire.h"
#include "sensorbar.h"
#include "Servo.h"
Servo base, elbow, gLeft, gRight;
const int mL1 = 8, mL2 = 7, mR1 = 4, mR2 = 9, mLPWM = 5, mRPWM = 6;
const int TRACK_SPEED = 80, MAX_SPEED = 160, APPROACH_SPEED = 60, ALIGN_HIGH_SPEED = 90, ALIGN_LOW_SPEED = 30;
char lastLane = 'C';
#define MID_VAL 500
#include <SoftwareSerial.h>
//Author Shadrack Kimutai
//SIM900 TX is connected to Arduino D8
#define SIM900_TX_PIN 8
//SIM900 RX is connected to Arduino D7
#define SIM900_RX_PIN 7
//Create software serial object to communicate with SIM900
SoftwareSerial serialSIM900(SIM900_TX_PIN,SIM900_RX_PIN);
#include <gprs.h>
#include <SoftwareSerial.h>
const int trigPin = 2;
const int echoPin = 4;
const int ledPin =13;
const int medium =60;
const int high=35;
const int low=80;
GPRS gprs;
package ke.ac.rvti.rvttipollapp;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;