Skip to content

Instantly share code, notes, and snippets.

View Ghostscypher's full-sized avatar

Brian Ngetich Ghostscypher

View GitHub Profile
@Ghostscypher
Ghostscypher / excel_column_names.md
Last active June 2, 2024 14:41
Get the excel column name e.g. column 0 is A.

When working with excel and you need to know the column name given it's index for example column 0 is A, column 26 is AA etc. Also given AA reverse the it to get a column index of 26. A little bit into what each function does, get_cell_value takes in a string of a given excel cell e.g. A5 where A is the column name and 0 is the row index. It returns the row and column index as [5, 0] i.e. an array/tuple where 5 is the row index and 0 is the column index. In short row 5 column 0. The getColumnName takes in the column index and reeturns the string version of it. For example getColumnName(5) means get the string equivalent of column with a column index of 5 which returns E.

<?php
@Ghostscypher
Ghostscypher / Cantor pairing.py
Created August 1, 2021 09:48
Perform a canot pairing of n-length
import math
'''
Translated from:
en.wikipedia.org/wiki/Pairing_function, both the pairing
and upairing functions
'''
def cantor_pairing(x, y):
return int((((x + y +1) * (x + y)) / 2) + y)
server {
listen 80;
server_name example.com;
# App root path here
root /srv/example.com/public;
# For ssl support add correct path here
#ssl_certificate /path/to/www.example.com.cert;
#ssl_certificate_key /path/to/www.example.com.key;
<VirtualHost _default_:443>
ServerName example.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www/public_html/example.com/public
<Directory /var/www/public_html/example.com>
AllowOverride All
</Directory>
### Our config starts here ###
<?php
use BeyondCode\LaravelWebSockets\Dashboard\Http\Middleware\Authorize;
return [
/*
* Set a custom dashboard configuration
*/
'dashboard' => [
<?php
// config/broadcasting.config
return [
//....
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
/*
* Decicated echo js file
*/
import Echo from 'laravel-echo';
window.Pusher = require('pusher-js');
// If using http connection use this
window.Echo = new Echo({
broadcaster: 'pusher',
server {
listen 80;
server_name example.com app1.example.com app2.example.com;
# App root path here
root /srv/example.com/public;
# For ssl support add correct path here
#ssl_certificate /path/to/www.example.com.cert;
#ssl_certificate_key /path/to/www.example.com.key;
<VirtualHost _default_:443>
ServerName example.com
ServerAlias app1.example.com app2.example.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www/public_html/example.com/public
<Directory /var/www/public_html/example.com>
AllowOverride All
</Directory>
<?php
use Illuminate\Support\Facades\Broadcast;
/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your