Skip to content

Instantly share code, notes, and snippets.

View paulobunga's full-sized avatar
🏠
Available for work

Paul Obunga paulobunga

🏠
Available for work
View GitHub Profile
@paulobunga
paulobunga / create_working_directory.md
Last active February 12, 2019 21:37
codeigniter_ajax_crud

Creating a working directory / project folder

  • Open terminal
  • cd ~
  • cd Desktop
  • cd PROJECTS
  • mkdir codeigniter_ajax_crud
@paulobunga
paulobunga / mysql_find_duplicates.md
Created June 2, 2019 13:50
MySQL Find duplicate entries and delete them

SELECT location, COUNT(location) FROM locations GROUP BY location HAVING COUNT(location) > 1

@paulobunga
paulobunga / insert_unique_data_from_other_table.md
Created June 2, 2019 14:57
MySQL Trigger to insert distinct values while checking existing in new table

INSERT INTO locations(dhis_id, facility_name, location) SELECT DISTINCT dhis_id, facility_name, location FROM dhis_count WHERE dhis_id NOT IN(SELECT dhis_id FROM locations)

@paulobunga
paulobunga / user_table.sql
Created June 10, 2019 16:41
Create users table using the sql below
CREATE TABLE users(
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`firstname` varchar(255) NOT NULL,
`lastname` varchar(255) NOT NULL);
@paulobunga
paulobunga / script.sh
Created June 14, 2019 14:30
Enable FTP Access for wordpress plugin install
chown -R www-data:www-data /var/www
find /var/www/ -type d -exec chmod 755 {} \;
find /var/www/ -type f -exec chmod 644 {} \;
@paulobunga
paulobunga / LocationFragment.java
Created June 28, 2019 14:32 — forked from louisbl/LocationFragment.java
Fragment for Location Manager
package;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
@paulobunga
paulobunga / ImageInputHelper.java
Created July 4, 2019 01:43 — forked from eluleci/ImageInputHelper.java
Android: Helper for Android for selecting image from gallery, taking a photo with camera and cropping image.
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.util.Log;
import java.io.File;
import java.io.IOException;
@paulobunga
paulobunga / DeviceInformation.java
Created July 13, 2019 06:18 — forked from hendrawd/DeviceInformation.java
Helper class for getting Device Information
package your.app.util;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
@paulobunga
paulobunga / RecyclerItemClickListener.java
Created July 17, 2019 09:27 — forked from chetangani/RecyclerItemClickListener.java
Recycler View implementing OnItemTouchListener
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener {
private OnItemClickListener mListener;
public interface OnItemClickListener {
Sub Create()
'Updateby Extendoffice 20160704
Dim I As Long
Dim xNumber As Integer
Dim xName As String
Dim xActiveSheet As Worksheet
On Error Resume Next
Application.ScreenUpdating = False
Set xActiveSheet = ActiveSheet
xNumber = InputBox("Enter number of times to copy the current sheet")