Skip to content

Instantly share code, notes, and snippets.

View zymawy's full-sized avatar
🐛
Debugging

Hamza Ironside zymawy

🐛
Debugging
View GitHub Profile
@zymawy
zymawy / AudioLoading.cpp
Created January 10, 2023 20:25 — forked from jatinchowdhury18/AudioLoading.cpp
Loading audio files from BinaryData (JUCE/C++)
// loading audio file "guitar.wav"
AudioFormatManager formatManager;
formatManager.registerBasicFormats();
// normal way
File audioFile ("/path/to/guitar.wav");
FileInputStream* input = audioFile.createInputStream();
AudioFormatReader* reader = formatManager.createReaderFor (input);
// from the reader we can load into an audio buffer, etc...
@zymawy
zymawy / A Nuxt.js VPS production deployment.md
Created February 15, 2022 10:48 — forked from DreaMinder/A Nuxt.js VPS production deployment.md
Deployment manual for a real-world project built with nuxt.js + koa + nginx + pm2

Example of deployment process which I use in my Nuxt.js projects. I usually have 3 components running per project: admin-panel SPA, nuxt.js renderer and JSON API.

This manual is relevant for VPS such as DigitalOcean.com or Vultr.com. It's easier to use things like Now for deployment but for most cases VPS gives more flexebillity needed for projects bigger than a landing page.

UPD: This manual now compatible with nuxt@2.3. For older versions deployment, see revision history.


Let's assume that you have entered fresh installation of Ubuntu instance via SSH. Let's rock:

@zymawy
zymawy / A Nuxt.js VPS production deployment.md
Created February 15, 2022 10:48 — forked from zmts/A Nuxt.js VPS production deployment.md
Deployment manual for a real-world project built with nuxt.js + koa + nginx + pm2

Example of deployment process which I use in my Nuxt.js projects. I usually have 3 components running per project: admin-panel SPA, nuxt.js renderer and JSON API.

This manual is relevant for VPS such as DigitalOcean.com or Vultr.com. It's easier to use things like Now for deployment but for most cases VPS gives more flexebillity needed for projects bigger then a landing page.

UPD: This manual now compatible with nuxt@2.3. For older versions deployment, see revision history.


Let's assume that you have entered fresh installation of Ubuntu instance via SSH. Let's rock:

@zymawy
zymawy / .p10k.zsh
Created May 17, 2021 01:54 — forked from marc-gavanier/.p10k.zsh
Powerlevel10k
# Generated by Powerlevel10k configuration wizard on 2020-10-21 at 13:15 CEST.
# Based on romkatv/powerlevel10k/config/p10k-classic.zsh, checksum 49789.
# Wizard options: nerdfont-complete + powerline, small icons, classic, unicode, dark,
# 24h time, angled separators, sharp heads, flat tails, 2 lines, dotted, no frame,
# sparse, many icons, concise, instant_prompt=quiet.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with classic powerline prompt style. Type `p10k configure` to generate
# your own config based on it.
#
@zymawy
zymawy / readme.md
Created April 5, 2021 21:22 — forked from Niteshvgupta/readme.md
Install PHP7-compatible memcache on Mac OS X

1. Install PHP7 with brew

brew install php70

2. Install Memcache from source on PHP7 branch

git clone -b NON_BLOCKING_IO_php7 https://github.com/websupport-sk/pecl-memcache.git
cd pecl-memcache
phpize
./configure
make && make install
@zymawy
zymawy / background.js
Created March 11, 2021 14:34 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});

Install Supervisor with sudo apt-get install supervisor in Unix or brew install supervisor in Mac OSX. Ensure it's started with sudo service supervisor restart in Unix or brew services start supervisor in Mac OSX.

In Unix in /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

In Mac OSX first run supervisord -c /usr/local/etc/supervisord.ini and in /usr/local/etc/supervisor.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread in Unix and with: brew services restart supervisor in MAc OSX . And start using those changes with: sudo supervisorctl update.

@zymawy
zymawy / http_streaming.md
Created December 18, 2019 11:38 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

jQuery(document).ready(function(){
jQuery('#submit').click(function(e){
e.preventDefault();
jQuery.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
}
});
jQuery.ajax({
@zymawy
zymawy / push_apns.php
Created January 17, 2019 18:50 — forked from SiriusDely/push_apns.php
Push Notification PHP Script - Apple iOS, Android C2DM, BlackBerry PPG
<?php
// Put your device token here (without spaces):
$deviceToken = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// Put your private key's passphrase here:
$passphrase = 'xxxxxxx';
// Put your alert message here:
$message = 'A push notification has been sent!';