Skip to content

Instantly share code, notes, and snippets.

View Stormix's full-sized avatar
🧙
Hippity hoppity your code is now my property.

Anas Mazouni Stormix

🧙
Hippity hoppity your code is now my property.
View GitHub Profile
@Stormix
Stormix / .env
Created January 19, 2022 19:19
Make all playlist private on spotify
SPOTIPY_CLIENT_ID=''
SPOTIPY_CLIENT_SECRET=''
SPOTIPY_REDIRECT_URI='http://localhost'
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from time import sleep
#
url = 'https://github.com'
username = "bruh"
password= "bruh"
@Stormix
Stormix / ping.py
Created July 7, 2020 06:24
Ping360: Fetching the distance for a given angle
from sensor import Ping360
# Global Variables
device = "/dev/ttyUSB0" # the serial port
baudrate = 115200
gain = 0
numberOfSamples = 200 # Number of points
transmitFrequency = 740 # Default frequency
sonarRange = 1 # in m
speedOfSound = 1500 # in m/s
@Stormix
Stormix / neighbours.ts
Created July 1, 2020 05:07
Given a 2D matrix (flattened to 1D) and an ID, get the 8 surrounding neighbours
public getNeighbours(idx: number): number[] {
const neighbours: number[] = []
const size = this.rows * this.cols
const w = this.cols
const h = this.rows
const debug = {
cell: idx,
n: -1,
w: -1,
e: -1,
@Stormix
Stormix / bootstrap.ts
Last active May 30, 2020 10:41
Laravel SPA token mismatch 419
import axios from 'axios'
import createAuthRefreshInterceptor from 'axios-auth-refresh'
const getCSRFToken = () => {
const token: HTMLMetaElement | null = document.head.querySelector(
'meta[name="csrf-token"]'
)
return token?.content
}
@Stormix
Stormix / init.coffee
Last active October 28, 2017 09:43
6be8b8b393dcf34e1a1c93222df3943e
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@Stormix
Stormix / example.php
Created July 18, 2017 18:43
A .env example for the php library PHP dotenv
// .env example
DATABASE_NAME=""
DATABASE_USER=""
DATABASE_PASS=""
SECRET_KEY="souper_seekret_key"
// Example.php You project file
<?php
require 'vendor/autoload.php';
<?php
// Template HTML (index.html)
<p>Welcome {{ name }}!</p>
// Rendering
require_once '/path/to/composer/autoloader.php';
Twig_Autoloader::register();
<?php
$client = new \GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
echo $res->getStatusCode();
// 200
echo $res->getHeaderLine('content-type');
// 'application/json; charset=utf8'
echo $res->getBody();
// '{"id": 1420053, "name": "guzzle", ...}'
@Stormix
Stormix / example.php
Created July 18, 2017 18:29
Using Whoops Error Handler
<?php
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
$whoops->register();
// Uncomment the following line to view an error page example.
// echo 1/0;