Skip to content

Instantly share code, notes, and snippets.

View djekl's full-sized avatar
:octocat:
Working from home

Alan Wynn djekl

:octocat:
Working from home
View GitHub Profile
@djekl
djekl / XboxAPI Send Message.php
Created July 31, 2019 07:06
Example on how to send a message using Guzzle via XboxAPI
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Pool;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
$client = new Client();
@djekl
djekl / XboxAuth.php
Created June 15, 2019 16:33
This is the example code for XboxAuth.dev, a service that allows you to have "Sign in with Xbox" on your site!
<?php
if (isset($_GET['code'])) {
XboxAuth::callback($_GET['code']);
} else {
XboxAuth::redirect();
}
class XboxAuth
{
@djekl
djekl / 2018_02_13_142413_add_renews_at_column_to_subscriptions.php
Created March 25, 2019 06:38 — forked from garygreen/2018_02_13_142413_add_renews_at_column_to_subscriptions.php
Sync Stripe Renewal Date for all subscriptions - Laravel Console Command
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddRenewsAtColumnToSubscriptions extends Migration
{
/**
* Run the migrations.
@djekl
djekl / README.md
Created October 28, 2018 19:13 — forked from mpociot/README.md
Discord + BotMan example

BotMan - Discord example chatbot

Once you set up your discord bot, you need to add it to your server:

Look up your chatbot's client ID and visit this URL:

https://discordapp.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot&permissions=0

Run the discord.php file through CLI:

@djekl
djekl / clean-up-boot-partition-ubuntu.md
Created September 29, 2018 15:31 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@djekl
djekl / crontab.txt
Created June 28, 2018 09:07
Un-pause all cups printers every minute
* * * * * ls /etc/cups/ppd/ | cut -d "." -f1 | xargs -i sudo /usr/sbin/cupsenable {}
@djekl
djekl / PackageApplication
Created October 11, 2017 08:43
PackageApplication script from Xcode 8.2.1
#!/usr/bin/perl
#
# PackageApplication
#
# Copyright (c) 2009-2012 Apple Inc. All rights reserved.
#
# Package an iPhone Application into an .ipa wrapper
#
use Pod::Usage;
@djekl
djekl / full-ffmpeg.sh
Last active May 23, 2018 10:13
Install full ffmpeg in debian wheezy (with aac(m4a) and x264 support)
# !/bin/bash
sudo apt-get update && sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libtheora-dev libtool libvorbis-dev pkg-config texinfo zlib1g-dev
sudo apt-get install -y yasm
mkdir ~/ffmpeg_sources
# Yasm
cd ~/ffmpeg_sources
@djekl
djekl / taybalt.zsh-theme
Created February 18, 2017 20:07
a slightly modified version of taybalt.zsh-theme from here - https://github.com/driesvints/dotfiles/blob/master/taybalt-custom.zsh-theme
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
#
@djekl
djekl / deriveSP800108HmacSHA256Key.java
Created October 13, 2016 08:07
Does anybody know how to convert this to PHP correctly, and can provide a derived key in java, for comparison in PHP
static byte[] deriveSP800108HmacSHA256Key(final int n, final byte[] array, final String s, final byte[] array2) {
final ByteBuffer allocate = ByteBuffer.allocate(n);
final ByteBuffer allocate2 = ByteBuffer.allocate(4);
final Mac initializedHmacSha256Digester = Cryptography.getInitializedHmacSha256Digester(new SecretKeySpec(array, "HmacSHA256"));
int n2 = 1;
while (allocate.position() < n) {
initializedHmacSha256Digester.reset();
allocate2.clear();
allocate2.putInt(n2);
allocate2.rewind();