Skip to content

Instantly share code, notes, and snippets.

View mansouryaacoubi's full-sized avatar
🥑
FR E SH A VOCA DO

Mansour Yaacoubi mansouryaacoubi

🥑
FR E SH A VOCA DO
View GitHub Profile
@mansouryaacoubi
mansouryaacoubi / getWifiKey.bat
Created September 4, 2018 09:37
Batch to get WiFi Key
@echo off
set /p SSID="Please enter WiFi SSID: "
set keyfile=%SSID%_key.txt
set
echo Retrieving security key for %SSID%...
netsh WLAN show profile name="%SSID%" key=clear >%keyfile%
echo Security key was successfully saved in %keyfile%.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mansouryaacoubi
mansouryaacoubi / gelocation-disable-workaround-orig.js
Last active April 23, 2018 07:08
GeoLocation Prompt Deactivation/Disable
function disableLocationRequest() {
var workaroundFunc = function(successCallback=null, errorCallback=null, options=null) {
console.warn('User Location Request disabled');
};
// Backup native code
navigator.geolocation.old_getCurrentPosition = navigator.geolocation.getCurrentPosition;
navigator.geolocation.old_watchPosition = navigator.geolocation.watchPosition;
// Disable original behaviour
navigator.geolocation.getCurrentPosition = workaroundFunc;
navigator.geolocation.watchPosition = workaroundFunc;
@mansouryaacoubi
mansouryaacoubi / occurrences.js
Created February 22, 2018 15:58
Find amount of occurrences of value in array (Javascript)
Array.prototype.occurrences = function(val) {
var i = 0, c = 0;
while( (i = this.indexOf(val,i)+1) && ++c );
return c;
};
@mansouryaacoubi
mansouryaacoubi / InstallPackagesPython.md
Created December 27, 2017 23:55
Install Packages in Python with PIP and Installers
@mansouryaacoubi
mansouryaacoubi / fha_services.bat
Created December 15, 2017 09:55
Install Services for FH-Aachen
REM @autor Mansour Yaacoubi
REM @version 1.5.1
REM @description A batch processing file to setup
REM @changelog Bugfix for to early drive mount (Internet connection check),
REM added FH-Aachen BSCW Cloud Service, added functionality to re- and deinstall,
REM unmounts drives at deinstallation
@echo off
cd\
color 74
@mansouryaacoubi
mansouryaacoubi / searchnfind.js
Created December 12, 2017 11:18
Different version to search in Array in Javascript
let categories = [{id: 1, name: 'EM'},{id: 2, name: 'EW'}, {id: 3, name: 'U15M'}, {id: 4, name: 'U15W'}];
let cat = null;
let selected = 3;
// VERSION 1: Use foreach-loop
for(var i in categories) {
cat = categories[i];
if(cat.id == selected) {
break;
}
@mansouryaacoubi
mansouryaacoubi / mining_stats.php
Last active November 17, 2017 15:13
Create JSON from Bitcoin Miner Pool Stats for own Mining (GroupFabric) with stats.csv file
<?php
header('Content-Type: application/json');
const DEFAULT_BTC_PAYOUT_ADDRESS = '1f7now3v2J56gzpYQfkmn1mv9KvcqtC6E';
define('BTC_PAYOUT_ADDRESS', isset($_GET['q'])?$_GET['q']:DEFAULT_BTC_PAYOUT_ADDRESS);
const BASE_URL = 'http://www.groupfabric.com/pool/?q=';
const SEARCH_FLAG = 'set_viewmodel(';
const FILE_NAME = 'stats.csv';
@mansouryaacoubi
mansouryaacoubi / install-squid.sh
Created September 25, 2017 22:36
Install a Squid Proxy Server on Raspberry Pi
#!/bin/bash
# Run script as root (higher privileges)
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit 1
else
clear
echo
echo "Script is running with higher privileges as: $SUDO_USER -> $(whoami)"
@mansouryaacoubi
mansouryaacoubi / install-ionic.sh
Created September 22, 2017 13:06
Install Ionic on Raspberry Pi
#!/bin/bash
# @usage bash <(curl -s https://gist.githubusercontent.com/mansouryaacoubi/5f0744ba2bc04a295d13239ed51f125c/raw/a31cf51544f36440faffdaf91d473d0339d35752/install-ionic.sh)
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit 1
else
clear
echo