Skip to content

Instantly share code, notes, and snippets.

View TwanoO67's full-sized avatar

WEBER Antoine TwanoO67

View GitHub Profile
#!/bin/bash
RED='\033[0;31m'
NC='\033[0m' # No Color
echo "Trying to curl every IP on your network"
for IP in $(arp -a |grep 192 |awk '{print $2}' |sed -r 's/\(//g' | sed -r 's/\)//g')
do
echo -e "${RED}TESTING: $IP${NC}"
curl http://$IP
@TwanoO67
TwanoO67 / bluetooth.sh
Created February 7, 2019 16:51
reconnect your bluetooth handset (when problem with AD2P profile)
#!/usr/bin/expect -f
#sudo apt-get install expect
#
#get your decide address with bluetoothctl
spawn service bluetooth restart
sleep 3
version: '2.0'
services:
php:
container_name: "laravel"
image: intelligensia/numesia-apache-php
restart: always
volumes:
#On utilise la clef ssh, et config git du poste courant
- "~/.ssh:/root/.ssh"
- "./config/ssh-wwwdata:/var/www/.ssh"
@TwanoO67
TwanoO67 / ng2-cache.js
Created September 28, 2016 12:04
cache with rs
getFiles(idinfosys, idcategorie){
//when this http request is cached and not old more than 3sec
if(Date.now() > this.cachedData[idcategorie].time+3){
let rs = new ReplaySubject<any>(1);
rs.next(this.cachedData[idcategorie].data);
return rs;
}
// https request isn't cached
return this.http.get(this.SERVER_URL+'dms/list/categories?idinfosys='+idinfosys+'&idcategorie='+idcategorie+'&alf_ticket='+this.TICKET).map((data : Response) => {
// cache this http request
@TwanoO67
TwanoO67 / nested_obj_to_array.php
Created May 11, 2016 13:34
Convert nested Object to associative array in php
<?php
function object_to_array($obj) {
if(is_object($obj)) $obj = (array) dismount($obj);
if(is_array($obj)) {
$new = array();
foreach($obj as $key => $val) {
$new[$key] = object_to_array($val);
}
}
trans_pitch = ($TRANSVERSE_PITCH * 0.866);
elem_diam_milli = ($HEATING_ELEMENT_DIAMETER / 1000);
pitch_by_diam = ($TRANSVERSE_PITCH / elem_diam_milli);
trans_pitch_by_diam = (trans_pitch / elem_diam_milli);
pow_tpbd_by_pbd = Math.pow(trans_pitch_by_diam / pitch_by_diam - 1, 3);
pbd_by_lpbd = (pitch_by_diam / (pitch_by_diam - 1));
sqrt_tpbd = Math.pow(trans_pitch_by_diam, 0.5);
value = (((((280 * Math.PI * (Math.pow(sqrt_tpbd - 0.6, 2) + 0.75) / ((4 * pitch_by_diam * trans_pitch_by_diam - Math.PI) * Math.pow(pitch_by_diam, 1.6))) / ($REYNOLDS_INLET * pbd_by_lpbd)) + ((2.5 + (1.2 / Math.pow(pitch_by_diam - 0.85, 1.08)) + 0.4 * pow_tpbd_by_pbd - 0.01 * Math.pow(pitch_by_diam / trans_pitch_by_diam - 1, 3)) / Math.pow($REYNOLDS_INLET * pbd_by_lpbd, 0.25)) * (1 - Math.exp( - ($REYNOLDS_INLET * pbd_by_lpbd + 1000) / 2000))) * $INLET_DENSITY_VALUE * Math.pow($AVERAGE_SPEED_INLET_SELECTED * pbd_by_lpbd, 2) / 2 * (Math.pow($NUMBER_ACTIVE_HEATING_ELEMENT * 2, 0.5)) * ($NUMBER_CUT_BAFFLES + 1)) + ((((280 * Math.PI * (Mat
trans_pitch = ($TRANSVERSE_PITCH * 0.866);
elem_diam_milli = ($HEATING_ELEMENT_DIAMETER / 1000);
pitch_by_diam = pitch_by_diam;
value = (((((280 * Math.PI * (Math.pow(Math.pow(trans_pitch / elem_diam_milli, 0.5) - 0.6, 2) + 0.75) / ((4 * pitch_by_diam * (trans_pitch / elem_diam_milli) - Math.PI) * Math.pow($TRANSVERSE_PITCH / elem_diam_milli, 1.6))) / ($REYNOLDS_INLET * (pitch_by_diam / (pitch_by_diam - 1)))) + ((2.5 + (1.2 / Math.pow(pitch_by_diam - 0.85, 1.08)) + 0.4 * Math.pow((trans_pitch / elem_diam_milli) / pitch_by_diam - 1, 3) - 0.01 * Math.pow(pitch_by_diam / (trans_pitch / elem_diam_milli) - 1, 3)) / Math.pow($REYNOLDS_INLET * (pitch_by_diam / (pitch_by_diam - 1)), 0.25)) * (1 - Math.exp( - ($REYNOLDS_INLET * (pitch_by_diam / (pitch_by_diam - 1)) + 1000) / 2000))) * $INLET_DENSITY_VALUE * Math.pow($AVERAGE_SPEED_INLET_SELECTED * (pitch_by_diam / (pitch_by_diam - 1)), 2) / 2 * (Math.pow($NUMBER_ACTIVE_HEATING_ELEMENT * 2, 0.5)) * ($NUMBER_CUT_BAFFLES + 1)) + ((((280 * Math.PI * (Math.pow(Math.pow(tra