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 / graphe.py
Created April 18, 2017 12:35
Programme pour créer des graphes en python (Par Anas Mazouni)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
from slugify import slugify
import random
colors = ['b','g','r','m','y','c']
@Stormix
Stormix / PyTorStemPrivoxy.md
Created May 13, 2017 18:23 — forked from KhepryQuixote/PyTorStemPrivoxy.md
Python script to connect to Tor via Stem and Privoxy, requesting a new connection (hence a new IP as well) as desired.

Crawling Anonymously with Tor in Python

adapted from the article "Crawling anonymously with Tor in Python" by S. Acharya, Nov 2, 2013.

The most common use-case is to be able to hide one's identity using TOR or being able to change identities programmatically, for example when you are crawling a website like Google and you don’t want to be rate-limited or blocked via IP address.

Tor

Install Tor.

"""
Configuring the server:
1.Install tor:
sudo apt-get update
sudo apt-get install tor
sudo /etc/init.d/tor restart
2. Generate password hash for Torrc :
tor --hash-password my_password #change my_password to something xD
copy the hash : "16:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
3. Configure Torrc
@Stormix
Stormix / example.php
Last active July 18, 2017 18:24
Monolog Basic Example
<?php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));
// add records to the log
@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;
<?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", ...}'
<?php
// Template HTML (index.html)
<p>Welcome {{ name }}!</p>
// Rendering
require_once '/path/to/composer/autoloader.php';
Twig_Autoloader::register();
@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';
@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 / 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
}