Skip to content

Instantly share code, notes, and snippets.

View JAGFx's full-sized avatar
🎯
Focusing

SMITH Emmanuel JAGFx

🎯
Focusing
View GitHub Profile
@ItKindaWorks
ItKindaWorks / powerMon_VoltageAndCurrent.ino
Created August 1, 2017 04:18
A simple arduino program for measuring and calibrating AC voltage and current sensors.
// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3
#include "EmonLib.h" // Include Emon Library
#define VOLT_CAL 148.7
#define CURRENT_CAL 62.6
EnergyMonitor emon1; // Create an instance
@dasgoll
dasgoll / gist:455522f09cb963872f64e23bb58804b2
Created January 28, 2017 15:42
Jenkins REST API example using crumb
Each Jenkins page has a REST API hyperlink at the bottom, this is because each page has its own endpoint.
http://localhost:8080/me
configure
Click 'Show API Token'
78e21f82a9e137614fef5b9593bcf827 = API Token
curl -s -u goll:78e21f82a9e137614fef5b9593bcf827 http://localhost:8080/crumbIssuer/api/json
@rchrd2
rchrd2 / test-php-basic-auth.php
Last active February 1, 2024 21:18 — forked from westonruter/test-php-basic-auth.php
PHP basic auth example
<?php
function require_auth() {
$AUTH_USER = 'admin';
$AUTH_PASS = 'admin';
header('Cache-Control: no-cache, must-revalidate, max-age=0');
$has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW']));
$is_not_authenticated = (
!$has_supplied_credentials ||
$_SERVER['PHP_AUTH_USER'] != $AUTH_USER ||
$_SERVER['PHP_AUTH_PW'] != $AUTH_PASS
@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active April 26, 2024 00:27
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings
@renshuki
renshuki / ubuntu_agnoster_install.md
Last active April 23, 2024 13:04
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@joashp
joashp / openssl_encrypt_decrypt.php
Created September 4, 2015 15:59
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@ryantbrown
ryantbrown / gulp-zip.js
Created March 22, 2015 23:08
Node: Create Zip File with Gulp
var fs = require('fs');
var path = require('path');
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')(); // Load all gulp plugins
// automatically and attach
// them to the `plugins` object
var runSequence = require('run-sequence'); // Temporary solution until gulp 4
// https://github.com/gulpjs/gulp/issues/355
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 18, 2024 16:07
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@ramonsmits
ramonsmits / gist:7563502
Created November 20, 2013 13:52
Example of Mandrill webhook JSON data.
[
{
"event": "send",
"msg": {
"ts": 1365109999,
"subject": "This an example webhook message",
"email": "example.webhook@mandrillapp.com",
"sender": "example.sender@mandrillapp.com",
"tags": [
"webhook-example"
@Slauta
Slauta / src\Acme\UserBundle\Entity\UserRepository.php
Created July 25, 2012 09:30
DataTable server side for Symfony 2 Doctrine (ver 2)
<?php
namespace Acme\UserBundle\Entity;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr;
/**
* UserRepository
*