SnakeNET

Utilisateur principal de ce site web.

Oct 172016
 

Amusant. Si vous faites « enregistrer sous » et choisissez le format « CSV » et que vous avez des caractères bizarres ( Comme é,è,&,..) Excel les détruira lors de l’enregistrement (pas sympa)

Si vous faites « fichier > exporter » et choisissez le format CSV, ca va mieux! mais c’est pas encore ça.. (les champs ne sont pas entre guillemets et on ne peux pas choisir le caractère de séparation…

Voici donc un script PowerShell qui fait le boulot…

Et pour que ce soit GENIAL, faites un raccourci windows avec cette commande:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe  -ExecutionPolicy Bypass   -file  « H:\Scripts\XLS to CSV.ps1 »
(pensez à changer le chemin du script)
Ainsi, il vous suffira de faire un drag’n drop de votre fichier excel sur ce raccourci et HOP! converti !
(on pourait aussi envisager de le mettre dans « send to » mais, ca, je vous laisse faire)

param([string]$xlFile=’nothing’)
$debugMode=$false
$ErrorActionPreference=’Stop’
if ($debugMode) { $xlFile= »H:\Book1.xlsx » }
$csvFile=$xlfile.Replace(‘.xlsx’,’.csv’).replace(‘.xls’,’.csv’)
## Checking…
if ( $xlFile -eq ‘nothing’ ) { Write-Host « No Excel file given. aborting… »                                                     -foregroundcolor red ;$tmp=Read-Host « Press ENTER key to exit »;exit }
if ( test-path($xlFile -eq $false)  ) { Write-Host « Specified Excel file does not exist. »                                        -foregroundcolor red ;$tmp=Read-Host « Press ENTER key to exit »;exit }
if ( test-path($csvFile)   ) { Write-Host « Old converted CSV file exist. Please, delete it before trying to convert it again. »   -foregroundcolor red ;$tmp=Read-Host « Press ENTER key to exit »;exit }
# http://stackoverflow.com/questions/687891/exception-automating-excel-2007-with-powershell-when-calling-workbooks-add
& {
[threading.thread]::CurrentThread.CurrentCulture = ‘en-US’
$xl = New-Object -COM « Excel.Application »
$xl.Visible = $debugMode
Write-Host « Opening source file » -foregroundcolor green
$wb = $xl.Workbooks.Open($xlFile)
$ws = $wb.Sheets.Item(1)
  $i=1
while( $ws.Cells.Item(1, $i).value2 -ne $null ) { if ( $debugMode) {Write-host « Debug 1 : counting column $i »}; $i++ }
$maxColonne=$i-1
  $i=1
while( $ws.Cells.Item($i, 1).value2 -ne $null ) { if ( $debugMode) {Write-host « Debug 1 : counting row $i »}; $i++ }
$maxLigne=$i
  Write-Host « There will be $maxColonne columns and $MaxLigne lines to convert. » -foregroundcolor green
$object=@()
$ligne=2   # ligne 1 = titre
$colonne=1
  while( $ws.Cells.Item($ligne,1).value2 -ne $null ) {
$line=New-Object PSObject
$colonne=1
while( $colonne -le $maxColonne) {
$cell=$ws.Cells.Item($ligne,$colonne).value2
if ($cell -eq $null) { $cell = «  » }
Add-Member -InputObject $line -MemberType NoteProperty -Name $ws.Cells.Item(1, $colonne).value2 -Value $cell
if ( $debugMode) {Write-host « debug2  » + $ws.Cells.Item($ligne,$colonne).value2 }
$colonne++
}
$ligne++
$object += $line
write-host -NoNewline « `r                                              `r Progres : $ligne/$maxLigne »
}
  $wb.Close() | out-null
$xl.Quit() | out-null
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($xl) | out-null
  Write-Host « `r`n$ligne rows where converted. » -foregroundcolor green
Write-Host « Saving datas to $csvFile. Please, wait… » -foregroundcolor cyan
$object | Export-Csv $csvFile -NoTypeInformation -Delimiter ‘;’ -Encoding UTF8
Write-Host « Save completed. » -foregroundcolor green
sleep 3
}
Tadaaaaa…
Oct 142016
 

Vous allez dans Azure? Vous voulez utiliser un mot de passe super complexe? et bien non !
En effet, les règles de Microsoft sont : entre 8 et 16 caractères et pas de caractères spéciaux trop spéciaux.

Selon mes tests, ces caractères ne passent pas : ù, µ, £, €, à, é, §, è, ç, à, ², ³

Pire! Si vous faites un reset password, et que lors du changement de mot de passe, vous en mettez un « trop » sécurisé, vous saurez vous connecter une fois, mais plus les fois suivantes!

Par contre, ABCdef123 est considéré par MS comme un mot de passe « fort » !

Merci Microsoft !!!!!

Sep 152016
 

Pré-requis :

Un share réseau sur lequel l’objet COMPUTER de la machine VEEAM a les droits en écriture.
Le soft ignore les paramètres de credentials créés pour l’occasion, alors, autant s’en passer complètement 🙂
Le script doit être lancé en tant qu’administrateur !!

J’ai préféré créer un script qui fait tout plutôt que de faire de la config dans l’application et dans le script.

Le script :

# Author: Vladimir Eremin
# Created Date: 3/24/2015
# http://forums.veeam.com/member31097.html
#
# Adapted by Myself
# Must be run as administrator !
# backup everything except VMs defined

##################################################################
#                   User Defined Variables
##################################################################

$ExceptionVMNames = @('DSVA-VM01','VM-VEEAM-01')           # Theses VMs will NOT be backuped.
$HostName = "ESXNAME01"
$Directory = "\\NAS01.DOMAIN.COM\VEEAM"
$CompressionLevel = "5"              # Desired compression level (Optional; Possible values: 0 - None, 4 - Dedupe-friendly, 5 - Optimal, 6 - High, 9 - Extreme)
$EnableQuiescence = $True            # Quiesce VM when taking snapshot (Optional; VMware Tools are required; Possible values: $True/$False)
$Retention = "In3days"               # Possible values: Never , Tonight, TomorrowNight, In3days, In1Week, In2Weeks, In1Month)

$EnableNotification = $True          # Send an eMail about the backup when completed.
$SMTPServer = "smtp.domain.com"
$EmailFrom = "veeam.site1@domain.com"
$EmailTo = "myself@domain.com"
$EmailSubject = "VM backup of SITE 1"




# Pour la création des objets nécessaires au backup. Il n'est pas nécessaire de les créer dans l'interface graphique.
$ESX_name='ESXNAME01.domain.com'
$ESX_User='root'
$ESX_password='MemePasEnReve:-)'
$NAS_name='NAS01'

# Get-Command -Module VeeamPSSnapIn           # pour lister les commandes possibles...

##################################################################
#                   End User Defined Variables
##################################################################

Add-PSSnapin VeeamPSSnapin

Connect-VBRServer -server localhost

if ( Find-VBRViEntity -name $ESX_name -HostsAndClusters ) {
  Write-Host "ESX exist" -foregroundcolor GREEN
} else {
  Write-Host "ESX does not exist. Create it" -foregroundcolor CYAN
  Add-VBRESXi -Name $ESX_name -User $ESX_User -Password $ESX_password
}

$Server = Get-VBRServer -name $HostName

# Création du repository.
# Attention, les droits NTFS du share doivent autoriser l'objet COMPUTER a modifier les fichiers sur le NAS.
if (Get-VBRBackupRepository -name $NAS_name ) {
  Write-Host "Repository exist" -foregroundcolor GREEN
} else {
  Write-Host "Repository does not exist. Create it"  -foregroundcolor CYAN
  Add-VBRBackupRepository -Name $NAS_name -Type CifsShare -RotatedDrive -Description "Synology NAS" -Server $server -Folder $Directory
}

# Creation du proxy pour backup local
if ( ( Get-VBRViProxy | measure).count -ne 1  ) {
  Write-Host "Proxy does not exist. Create it" -foregroundcolor CYAN
  Get-VBRServer | ? { $_.type -eq "Local" } | Add-VBRViProxy -Description "Local Backup Proxy" -MaxTasks 2
} else {
  Write-Host "Proxy exist"  -foregroundcolor GREEN
}

#################### Main program ################

$MesssagyBody = @()

foreach ($VM in Find-VBRViEntity -Server $Server | ? {$_.type -eq "vm" -and $_.name -notin $ExceptionVMNames -and $_.name -notlike "*_clone_*" }){

  Write-Host "Starting backup of " $VM.name -nonewline -foregroundcolor cyan
  $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention
  if ( $ZIPSession.Result -eq 'Failed' ) {
    Write-Host ". statut : " $ZIPSession.Result -foregroundcolor RED
  } else {
    Write-Host ". statut : " $ZIPSession.Result -foregroundcolor GREEN
  }


  If ($EnableNotification){
    $TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
    $FailedSessions =  $TaskSessions | where {$_.status -ne "ESucceeded"}

    if ($FailedSessions -ne $Null){
      $MesssagyBody = $MesssagyBody + ($ZIPSession | Select-Object @{n="Name";e={($_.name).Substring(0, $_.name.LastIndexOf("("))}} ,@{n="Start Time";e={$_.CreationTime}},@{n="End Time";e={$_.EndTime}},Result,@{n="Details";e={$FailedSessions.Title}})
    }Else{
      $MesssagyBody = $MesssagyBody + ($ZIPSession | Select-Object @{n="Name";e={($_.name).Substring(0, $_.name.LastIndexOf("("))}} ,@{n="Start Time";e={$_.CreationTime}},@{n="End Time";e={$_.EndTime}},Result,@{n="Details";e={($TaskSessions | sort creationtime -Descending | select -first 1).Title}})
    }
  }
}

If ($EnableNotification){
  #                   Email formatting
  $style = "<style>BODY{font-family: Arial; font-size: 10pt;}"
  $style+=   "TABLE{border: 1px solid black; border-collapse: collapse;}"
  $style+=   "TH{border: 1px solid black; background: #ddddff; padding: 5px; }"
  $style+=   "TD{border: 1px solid black; padding: 5px; }"
  $style+= "</style>"

  $Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
  $Message.Subject = $EmailSubject
  $Message.IsBodyHTML = $True
  $message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
  $SMTP = New-Object Net.Mail.SmtpClient($SMTPServer)
  $SMTP.Send($Message)
}
La commande pour la tache planifiée :
schtasks /create /SC daily /TN Daily_VM_backup /TR "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -file C:\Script\Veeam_Zip_SITE1.ps1" /ST 23:00 /RU system
Et voila…
Sep 132016
 

Sources:
http://old.k2underground.com/blogs/johnny/archive/2012/09/13/deploying-the-silverlight-package-to-users-using-a-gpo.aspx
https://4sysops.com/archives/install-32-bit-and-64-bit-applications-with-group-policy-and-sccm/

L’application à déployer peut exister en 32 et 64 bit (avec 2 installeurs différents).

Etape 1 : Créer les packages MSI

Prenons l’exemple de Silverlight. Celui-ci doit être « préparé » pour être déployable par GPO.

    • Télécharger l’installeur depuis le site de Microsoft.
    • Dans une invite de commande, se rendre dans le répertoire où on a téléchargé l’application et tapper cette commande :
    • Silverlight_x64.exe -x ou Silverlight.exe -x (pour la version 32bit)
    • Indiquer le même répertoire que celui où vous avez téléchargé le package
    • Utiliser un soft comme 7zip pour extraire le contenu de Silverlight.7z (silverlight.msp ) dans le même répertoire que celui où vous avez téléchargé le package
    • msiexec /p silverlight.msp /a silverlight.msi
    • Déplacer le fichier silverlight.msi et les répertoires PFiles et PFiles_64 (ce dernier n’existe QUE dans la version 64 bit) dans le répertoire où se trouvent vos binaires de déploiement des GPO. Exemple : \\domaine.local\DSL\Silverlight\x64\.

Notez bien que j’ai indiqué x64! car j’ai traité le package 64 bit. Pour la version 32 bit, déplacez le dans …x86. Le nom n’est pas obligatoire, mais admettez que c’est quand même plus facile.

Etape 2 : déployer le(s) package(s)

    • Donner les bonnes permissions sur le share !!! (Authenticated users : Read)
    • Lancer la console GPO (gpmc.msc)
    • Créer une GPO à la bonne O.U.
    • Aller dans Computer Configuration > Policies > Software Settings > Software Installation
    • Pointer vers le MSI (32 ou 64bit) via son share réseau !!!
    • Choisissez un déploiement « assigné »

Attention ! Si vous avez 2 packages (32 et 64 bit) vous devez faire 2 déploiement. MAIS pour la version 32 bit, il ne faut pas choisir « assigné » mais avancé > Déploiement > Options Avancées et DECOCHER la case qui rend les applis 32bit installables sous 64 bit.

Une fois finit, pour tester, rendez-vous sur une machine cible et faites un « gpupdate /force ». Si la commande vous demande de redémarrer, c’est qu’il s’est rendu compte qu’il a une application à installer (ca se fait au reboot.)

Tadaaa!

Août 122016
 

Configurer le wifi en ligne de commande

nmtui

Mettre à jour et redémarrer l’engin

apt-get update -y && apt-get upgrade -y && init 6

Installer la gestion du point d’accès et la prise de contrôle a distance

apt-get install openssh-server

apt-get install dnsmasq hostapd
echo interface=wlan1 > /etc/dnsmasq.d/access_point.conf
echo except-interface=wlan0 >> /etc/dnsmasq.d/access_point.conf
echo dhcp-range=172.17.0.2,172.17.0.250,1h >> /etc/dnsmasq.d/access_point.conf
echo dhcp-option=1,255.255.255.0 >> /etc/dnsmasq.d/access_point.conf
echo dhcp-option=3,172.17.0.1 >> /etc/dnsmasq.d/access_point.conf
echo auto wlan1 >> /etc/network/interfaces
echo iface wlan1 inet static >> /etc/network/interfaces
echo address 172.17.0.1 >> /etc/network/interfaces
echo netmask 255.255.255.0 >> /etc/network/interfaces
ifup wlan1
/etc/init.d/dnsmasq restart
echo interface=wlan1 > /etc/hostapd.conf
echo driver=nl80211 >> /etc/hostapd.conf
echo ssid=PocketChip>> /etc/hostapd.conf
echo channel=1 >> /etc/hostapd.conf
echo ctrl_interface=/var/run/hostapd >> /etc/hostapd.conf
echo [Unit] > /lib/systemd/system/hostapd-systemd.service
echo Description=hostapd service >> /lib/systemd/system/hostapd-systemd.service
echo Wants=network-manager-service >> /lib/systemd/system/hostapd-systemd.service
echo After=network-manager-service >> /lib/systemd/system/hostapd-systemd.service
echo Wants=module-init-tools-service >> /lib/systemd/system/hostapd-systemd.service
echo After=module-init-tools-service >> /lib/systemd/system/hostapd-systemd.service
echo ConditionPathExists=/etc/hostapd.conf >> /lib/systemd/system/hostapd-systemd.service
echo [Service] >> /lib/systemd/system/hostapd-systemd.service
echo Restart=always >> /lib/systemd/system/hostapd-systemd.service
echo ExecStart=/usr/sbin/hostapd /etc/hostapd.conf >> /lib/systemd/system/hostapd-systemd.service
echo [Install] >> /lib/systemd/system/hostapd-systemd.service
echo WantedBy=multi-user.target >> /lib/systemd/system/hostapd-systemd.service
update-rc.d hostapd disable
systemctl daemon-reload
systemctl enable hostapd-systemd
init 6

Mettre a jour l’interface graphique du pocketchip

https://bbs.nextthing.co/t/pocket-home-marshmallow-edition/6579
https://github.com/o-marshmallow/PocketCHIP-pocket-home

wget -O installPocketHome.sh « https://drive.google.com/uc?export=download&id=0B1jRc4IqT9kiN0pfb3FGdlJtZjA »
chmod +x installPocketHome.sh
./installPocketHome.sh
init 6

Installer un Tools qui gère l’alimentation du CHIP comme un grand!

— Je vous invite a suivre ce post : génial. Version courte ci-dessous:

apt-get install i2c-tools
wget -O /usr/local/bin/blink.sh http://fordsfords.github.io/blink/blink.sh
chmod +x /usr/local/bin/blink.sh
wget -O /etc/systemd/system/blink.service http://fordsfords.github.io/blink/blink.service
systemctl enable /etc/systemd/system/blink.service
wget -O /usr/local/etc/blink.cfg http://fordsfords.github.io/blink/blink.cfg
service blink start

 

 

Août 122016
 

Totalement inspiré de http://www.raspibo.org/wiki/index.php/Compile_the_Linux_kernel_for_Chip:_my_personal_HOWTO
Pré-requis indispensable : un debian SID (unstable) 32 bit.

# Stocker l’IP du chip pour automatiser le reste des commandes.
# si scp ne fonctionne pas, installer openssh-client sur le chip et le PC
CHIP=10.254.0.6

apt-get install git build-essential fakeroot kernel-package zlib1g-dev libncurses5-dev lzop
apt-get install gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf

mkdir -p /extra/tmp/chip/LINUX
cd /extra/tmp/chip/LINUX
git clone https://github.com/NextThingCo/CHIP-linux.git

cd /extra/tmp/chip/LINUX/CHIP-linux
git checkout -b debian/4.3.0-ntc-4 origin/debian/4.3.0-ntc-4

scp chip@$CHIP:/boot/config-4.3.0-ntc /extra/tmp/chip/LINUX/CHIP-linux

make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- menuconfig

## faire LOAD du fichier CONFIG copié depuis le CHIP.
## Ajouter iptables
# Networking >> Networking options >> Network packet filtering (replaces ipchains) >> Core Netfilter Configuration >> Netfilter Xtables support (required for ip_tables) and select the all following options as modules.
# Networking >> Networking options >> Network packet filtering (replaces ipchains) >> IP: Net Filter configurationS >> IP Tables support
## Ajouter un suffixe
# General setup —> () Local version – append to kernel release
# my personal suffix is NLE.
# sauver la config dans le fichier « .config »

### The parameter -j should be set to the number of cores of your computer + 1. I have an 4-core (2 real cores + 2 hyperthreads), so I use 5.
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -j 5

mkdir /tmp/lib
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- INSTALL_MOD_PATH=/tmp/lib modules_install

cd /extra/tmp/chip/LINUX
git clone https://github.com/NextThingCo/RTL8723BS.git
cd RTL8723BS
git checkout -b debian origin/debian
for i in debian/patches/0*; do echo $i; patch -p 1 <$i ; done

make -j 5 CONFIG_PLATFORM_ARM_SUNxI=y ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -C /extra/tmp/chip/LINUX/CHIP-linux/ M=$PWD CONFIG_RTL8723BS=m INSTALL_MOD_PATH=/tmp/lib
make -j 5 CONFIG_PLATFORM_ARM_SUNxI=y ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -C /extra/tmp/chip/LINUX/CHIP-linux/ M=$PWD CONFIG_RTL8723BS=m INSTALL_MOD_PATH=/tmp/lib modules_install

scp /extra/tmp/chip/LINUX/CHIP-linux/arch/arm/boot/zImage root@$CHIP:/boot/vmlinuz-4.3.0NLE+
scp /extra/tmp/chip/LINUX/CHIP-linux/.config root@$CHIP:/boot/config-4.3.0NLE+
scp /extra/tmp/chip/LINUX/CHIP-linux/System.map root@$CHIP:/boot/System.map-4.3.0NLE+
cd /tmp/lib/lib/modules
tar cf – 4.3.0NLE+ | ssh root@$CHIP ‘cd /lib/modules; tar xf -‘
cd ../firmware/
tar cf – . | ssh root@$CHIP ‘mkdir /lib/firmware/4.3.0NLE+; cd /lib/firmware/4.3.0NLE+; tar xf -‘

rm -rf /tmp/tar/
mkdir -p /tmp/tar/boot
cp /extra/tmp/chip/LINUX/CHIP-linux/arch/arm/boot/zImage /tmp/tar/boot/vmlinuz-4.3.0NLE+
# cp /extra/tmp/chip/LINUX/CHIP-linux/arch/arm/boot/zImage /tmp/tar/boot/zImage
cp /extra/tmp/chip/LINUX/CHIP-linux/.config /tmp/tar/boot/config-4.3.0NLE+
cp /extra/tmp/chip/LINUX/CHIP-linux/System.map /tmp/tar/boot/System.map-4.3.0NLE+

mkdir -p /tmp/tar/lib/modules/4.3.0NLE+
mkdir -p /tmp/tar/lib/firmware/4.3.0NLE+

cp -r /tmp/lib/lib/firmware/* /tmp/tar/lib/firmware/4.3.0NLE+
cp -r /tmp/lib/lib/modules /tmp/tar/lib/

cd /tmp/tar
rm /tmp/kernel.tar
tar -cf ../kernel.tar *
gzip ../kernel.tar

rcp /tmp/kernel.tar.gz $CHIP:/root/

sinon, à l’arrache :
kernel.tar.gz

wget -d –header= »User-Agent: Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11″ http://snakenet.eu/blog/wp-content/uploads/2016/08/kernel.tar.gz
cd /
tar -zxf ~/kernel.tar.gz

### Tester le nouveau kernel sans tout casser : se connecter en UART et lors du uBOOT, appuyer sur une touche, puis :

setenv boot_initrd ‘mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload $fdt_addr_r /boot/sun5i-r8-chip.dtb; ubifsload 0x44000000 /boot/initrd.uimage; ubifsload $kernel_addr_r /boot/vmlinuz-4.3.0NLE+; bootz $kernel_addr_r 0x44000000 $fdt_addr_r’
setenv boot_noinitrd ‘mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload $fdt_addr_r /boot/sun5i-r8-chip.dtb; ubifsload $kernel_addr_r /boot/vmlinuz-4.3.0NLE+; bootz $kernel_addr_r – $fdt_addr_r’

boot

### Pour nettoyer les conneries de ce f* kernel :

rm /boot/vmlinuz-4.3.0NLE+ /boot/config-4.3.0NLE+ /boot/System.map-4.3.0NLE+ /lib/firmware/4.3.0NLE+ /lib/modules/4.3.0NLE+
cp /boot/zImage.bak /boot/zImage

Juil 282016
 

#!/bin/sh
# Fortement inspiré de battery.sh
# a mettre dans /etc/init.d/monitorBattery.sh
# a configurer dans crontab :
# * * * * * /etc/init.d/monitorBattery.sh > /var/log/monitorBattery.log

#!/bin/sh
/usr/sbin/i2cset -y -f 0 0x34 0x82 0xC3

POWER_OP_MODE=$(/usr/sbin/i2cget -y -f 0 0x34 0x01)

BAT_EXIST=$(($(($POWER_OP_MODE&0x20))/32)) # divide by 32 is like shifting rigth 5 times
# echo « BAT_EXIST= »$BAT_EXIST

BAT_VOLT_MSB=$(/usr/sbin/i2cget -y -f 0 0x34 0x78)
BAT_VOLT_LSB=$(/usr/sbin/i2cget -y -f 0 0x34 0x79)

#echo $BAT_VOLT_MSB $BAT_VOLT_LSB
BAT_BIN=$(( $(($BAT_VOLT_MSB << 4)) | $(($(($BAT_VOLT_LSB & 0x0F)) )) ))

BAT_VOLT=$(echo « ($BAT_BIN*1.1) »|bc)
# echo « Battery voltage = « $BAT_VOLT »mV »

BAT_IDISCHG_MSB=$(/usr/sbin/i2cget -y -f 0 0x34 0x7C)
BAT_IDISCHG_LSB=$(/usr/sbin/i2cget -y -f 0 0x34 0x7D)

BAT_IDISCHG_BIN=$(( $(($BAT_IDISCHG_MSB << 5)) | $(($(($BAT_IDISCHG_LSB & 0x1F)) )) ))

BAT_IDISCHG=$(echo « ($BAT_IDISCHG_BIN*0.5) »|bc)
# echo « Battery discharge current = « $BAT_IDISCHG »mA »

if [ $BAT_EXIST -eq 1 ]
then
echo « il y a une batterie »
if (( $(bc <<< « $BAT_IDISCHG > 50 ») ))
then
echo « la batterie se decharge… J’ai plus de courant »
if (( $(bc <<< « $BAT_VOLT < 3500 ») )) then echo « La batterie est faible, moins de 3,5 volt » echo  » Battery depleted.. Shutting down : $BAT_VOLT mV » `uptime -p` >> /var/log/monitorBattery.trc
echo « extinction »
init 0
else
echo « Battery voltage = « $BAT_VOLT »mV »
echo « Ca va, on continue, ca tient… »
echo  » On battery : $BAT_VOLT mV » `uptime -p` >> /var/log/monitorBattery.trc
uptime -p
fi
fi
fi

Juil 062016
 

Un émulateur NES
apt-get install fceux
Et pour le lancer :
nes
Oui, je sais, c’est trompeur

Un emulateur Gameboy
apt-get install gngb
Et pour le lancer :
gngb -o -a FICHIER_ROM.ZIP

Avoir l’écran tactile a l’endroit avec la version 4.4 du CHIP OS :
vi /usr/share/X11/xorg.conf.d/99.calibration.conf
Section "InputClass"
Identifier "calibration"
MatchProduct "1c25000.rtp"
Option "Calibration" "4055 41 3705 194"
Option "SwapAxes" "0"
EndSection

Source : https://bbs.nextthing.co/t/pocketchip-running-chip-4-4-gui/5319

sinon :

apt-get install xinput-calibrator xinput
xinput_calibrator --output-type xinput

sauver Pico 8
( find /usr -iname pico-8\* -exec tar rzvfp /var/tmp/pico8.tgz {} \; )
source : https://bbs.nextthing.co/t/pocketchip-running-chip-4-4-gui/5319/27

https://bbs.nextthing.co/t/pocketchip-running-chip-4-4-gui/5319/27

Juil 062016
 

Microsoft a changé sa méthode pour le rapatriement des GPO. Je vous passe les détails. Si vous voulez en savoir plus : https://support.microsoft.com/en-us/kb/3163622

Maintenant, si, comme moi, vous devez (à l’arrache) tripoter vos GPOs pour que ça refonctionne, voici un script PowerShell qui fait en sorte que ca fonctionne..

Si vous n’enlevez pas les commentaires, vous n’aurez qu’un audit…


$AuthenticatedUsers_NAME='Utilisateurs authentifiés'
$DomainComputers_NAME='Domain Computers'

foreach ($GPO in Get-GPO -All | sort displayname){
$permissions=Get-GPPermissions -Guid $GPO.Id -All

if ($GPO.user.Enabled -and $GPO.computer.Enabled ){
Write-Host $gpo.DisplayName "`t`t`t`tDOUBLE SECURITY :: Please, check !" -foregroundcolor cyan
}

if ($GPO.user.Enabled ){
Write-Host -nonewline $gpo.DisplayName USER
$permission=($permissions | where { $_.trustee.name -eq $AuthenticatedUsers_NAME } ).permission
if ($permission -eq 'GpoApply' -or $permission -eq 'GpoRead') {
Write-Host " : $permission" -foregroundcolor green
} else {
Write-Host "`t-- Missing USER permission --" -foregroundcolor RED
# Set-GPPermissions -Guid $GPO.Id -TargetName $AuthenticatedUsers_NAME -TargetType group -PermissionLevel GpoRead | out-null
}
}

if ($GPO.computer.Enabled ){
Write-Host -nonewline $gpo.DisplayName COMPUTER
$permission=($permissions | where { $_.trustee.name -eq $DomainComputers_NAME } ).permission
if ($permission -eq 'GpoApply' -or $permission -eq 'GpoRead') {
Write-Host " : $permission" -foregroundcolor green
} else {
Write-Host "`t-- Missing COMPUTER permission --" -foregroundcolor RED
# Set-GPPermissions -Guid $GPO.Id -TargetName $DomainComputers_NAME -TargetType group -PermissionLevel GpoRead | out-null

}
}
}

Avr 202016
 

cat /etc/init.d/low_bat_shutdown
#!/bin/bash

# LiPoPi

# Shut down the Pi if the GPIO goes high indicating low battery
# GPIO Port

gpio_port= »15″
# Enable GPIO

if [ ! -d « /sys/class/gpio/gpio$gpio_port » ]; then

  echo 15 > /sys/class/gpio/export || { echo -e « Can’t access GPIO $gpio_port » 1>&2; exit 1; }

fi
# Set it to input

echo « in » > /sys/class/gpio/gpio$gpio_port/direction || { echo -e « Can’t set GPIO $gpio_port to an input » 1>&2; exit 1; }
# Set it as active high

echo 0 > /sys/class/gpio/gpio$gpio_port/active_low || { echo -e « Can’t set GPIO $gpio_port to active high » 1>&2; exit 1; }
# If its low (low battery light is on), shutdown

if [ « `cat /sys/class/gpio/gpio$gpio_port/value` » != 1 ]; then

  echo « Shutting down due to low power `date` »

  /sbin/shutdown -h now || { echo -e « Can’t halt the system » 1>&2; exit 1; }

fi