Skip to content

Instantly share code, notes, and snippets.

View Joemires's full-sized avatar
🎯
Focusing

Joseph Bassey Joemires

🎯
Focusing
View GitHub Profile
#!/bin/bash
##
# File:
# nginx_modsite
# Description:
# Provides a basic script to automate enabling and disabling websites found
# in the default configuration directories:
# /etc/nginx/sites-available and /etc/nginx/sites-enabled
# For easy access to this script, copy it into the directory:
@Joemires
Joemires / addAttendee.php
Created April 30, 2022 09:07 — forked from AFelipeTrujillo/addAttendee.php
Use Google Calendar API
<?php
include_once 'google-api-php-client/vendor/autoload.php';
$client = new Google_Client();
$application_creds = 'service-account-credentials.json';
$credentials_file = file_exists($application_creds) ? $application_creds : false;
define("SCOPE",Google_Service_Calendar::CALENDAR);
define("APP_NAME","Google Calendar API PHP");
0x4d1fd16a6127E452c847fbB0b5d3F1A77A51A8B4
<html>
<head>
<title>client</title>
<script src="http://localhost:8888/socket.io/socket.io.js"></script>
<script type="text/javascript">
var socket = new io.Socket('localhost');
socket.connect();
socket.on('connect', function()
{
console.log('connected');
@Joemires
Joemires / parse-csv.php
Created November 22, 2021 12:40 — forked from benbalter/parse-csv.php
Parse CSV into Associative Array
<?php
$lines = explode( "\n", file_get_contents( 'input.csv' ) );
$headers = str_getcsv( array_shift( $lines ) );
$data = array();
foreach ( $lines as $line ) {
$row = array();
foreach ( str_getcsv( $line ) as $key => $field )
@Joemires
Joemires / step01.php
Created October 18, 2021 09:02 — forked from alimashuri/step01.php
PHP commands for basic MongoDB operations
<?php
try {
$mongo = new Mongo(); // default host:port
$db = $mongo->example;
$collection = $db->test;
$document = array('x' => 1);
$collection->insert($document);
print_r($document);
@Joemires
Joemires / gist:450e8bbd82f23ae87ec51284b95a842f
Created September 13, 2021 12:58 — forked from karlgroves/gist:7544592
Get DOM path of an element
function getDomPath(el) {
var stack = [];
while ( el.parentNode != null ) {
console.log(el.nodeName);
var sibCount = 0;
var sibIndex = 0;
for ( var i = 0; i < el.parentNode.childNodes.length; i++ ) {
var sib = el.parentNode.childNodes[i];
if ( sib.nodeName == el.nodeName ) {
if ( sib === el ) {
@Joemires
Joemires / getPath.js
Created September 13, 2021 12:57 — forked from barisaydinoglu/getPath.js
getPath.js if for getting a jQuery selector for an element. parsePath.js is for parsing the selector string to path array.
jQuery.fn.extend({
getPath: function () {
var path = "",
node = this;
while (node.length) {
var realNode = node[0],
name = realNode.localName,
id, classNameStr, currentNodeSelector;
if (!name) {
break;
@Joemires
Joemires / docker-install-parrot.sh
Created May 10, 2021 20:13 — forked from nuga99/docker-install-parrot.sh
Install Docker Engine on Parrot OS
#!/bin/sh
# From https://www.hiroom2.com/2017/09/24/parrotsec-3-8-docker-engine-en/
set -e
# Install dependencies.
sudo apt install -y curl apt-transport-https \
software-properties-common ca-certificates
# Install docker.