Skip to content

Instantly share code, notes, and snippets.

@Albirew
Albirew / ratio.js
Created January 12, 2016 13:06
Un vieux JS pour rediriger l'utilisateur selon sa résolution (surtout pour différencier les smartphones)
/*JavaScript Redirection based on Ratio*/
var s = (screen.height/screen.width)
if (s==.75)
window.location.replace("/lol?somevars=4-3") // 4:3
else if (s==.625)
window.location.replace("/lol?somevars=8-5") // 8:5 (16:10)
else if (s==.5625)
window.location.replace("/lol?somevars=16-9") // 16:9
else if (s==.5294117647058824)
window.location.replace("/lol?somevars=17-9") // 17:9
@Albirew
Albirew / arch.js
Created January 12, 2016 13:14
Un vieux JS pour executer une action selon l'architecture de l'utilisateur (un exemple d'usage sur: http://albirew.fr/nddyn/ )
/*JavaScript action based on Arch*/
if (navigator.userAgent.indexOf('MSIE') != -1 ){document.write('<span style="color:red; font-weight: bold;">Internet ExplHORREUR!</span>');}
else if (navigator.userAgent.indexOf('Trident') != -1 ){document.write('<span style="color:red; font-weight: bold;">Internet ExplHORREUR!</span>');}
else if (navigator.userAgent.indexOf('Win64') != -1 ){document.write('<span style="color:green; font-weight: bold;">x64 browser on x64 Windows</span>');}
else if (navigator.userAgent.indexOf('WOW64') != -1 ){document.write('<span style="color:red; font-weight: bold;">x86 browser on x64 Windows</span>');}
else if (navigator.userAgent.indexOf('i686 on x86_64') != -1 ){document.write('<span style="color:red; font-weight: bold;">x86 browser on x64 Linux</span>');}
else if (navigator.userAgent.indexOf('x86_64') != -1 ){document.write('<span style="color:green; font-weight: bold;">x64 browser on x64 Linux</span>');}
else {document.write('... . . . something!');}</script>
@Albirew
Albirew / WebDavVista+.bat
Created January 12, 2016 13:27
Allow Basic Authentication with Windows 7 and Windows Vista WebDAV Client
@echo off
:: Allow Windows explorer on Vista and up to use basic auth (for use with 1&1 webdav for example: https://help.1and1.com/hosting-c37630/webspace-and-access-c85098/webdav-c40014/establish-a-webdav-connection-to-your-linux-package-a781732.html )
:: Difference with 1&1 script is that it automatically restart the webclient service for changes to be applied immediately.
echo Windows Registry Editor Version 5.00 >"%Temp%\WebDavBasicAuthLevel.reg"
echo. >>"%Temp%\WebDavBasicAuthLevel.reg"
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\WebClient\Parameters] >>"%Temp%\WebDavBasicAuthLevel.reg"
echo "BasicAuthLevel"=dword:00000002 >>"%Temp%\WebDavBasicAuthLevel.reg"
"%windir%\regedit.exe" /s "%Temp%\WebDavBasicAuthLevel.reg"
net stop webclient
del "%temp%\WebDavBasicAuthLevel.reg"
@Albirew
Albirew / sambaUsers.bat
Created February 21, 2016 13:56
prepare script and configuration for your linux samba server from some windows computer
@echo off
:: sambaUsers - prepare script and configuration for your linux samba server from some windows computer
:: Release history:
:: V1 - initial release
:: usersFolder is the mounted smb share where user folders will be created
set usersFolder=Z:\users
:: userlist contains list of users to be created, each line must contains only user:pass
set userList=%usersFolder%\userlist.txt
:: sambaPath is server-side internal path where users folder will be located
@Albirew
Albirew / backup-fichiers.sh
Created April 21, 2016 19:53
script de sauvegarde de fichiers via ftp
#!/bin/sh
#Backup des fichiers du serveur
#NÉCESSITE LFTP SUR VOTRE SERVEUR (apt install lftp)
#Définitions des variables
#date du jour au format année mois jour pour lister les fichiers naturellement par date
datejour=$(date +%Y%m%d)
localpath=~/backup/FICHIERS
#variables pour le serveur FTP (c'est quand qu'on passe sur rsync, déjà?)
remoteserver="serveur-backup.domaine.fr 21"
@Albirew
Albirew / backup-bdd.sh
Last active April 21, 2016 20:08
script de sauvegarde SQL via ftp
#!/bin/sh
#Backup des fichiers du serveur
#NÉCESSITE LFTP SUR VOTRE SERVEUR (apt install lftp)
#Définitions des variables
#date du jour au format année mois jour pour lister les fichiers naturellement par date
datejour=$(date +%Y%m%d)
localpath=~/backup/BDD
#variables pour le serveur FTP (et sinon, rsync?)
remoteserver="serveur-backup.domaine.fr 21"
@Albirew
Albirew / remove_GWX.bat
Last active March 14, 2017 23:50
Remove shitty Windows 10 upgrade notification from your W7-W8.1 computer
@echo off
:: Writed by CynerOne, updated and commented by Albirew
:: CynerOne original located here: http://lecrabeinfo.net/desinstaller-lapplication-obtenir-windows-10-supprimer-icone-windows-10.html#comment-2374542969
:: also added rev.18 of Matt's privilege escalation script: http://stackoverflow.com/posts/12264592/revisions
:: V2 added Inny suggestion: http://www.nextinpact.com/news/97735-microsoft-se-fait-plus-insistant-sur-migration-vers-windows-10.htm#/comment/5555097
:: V3 added Timo's list: http://lehollandaisvolant.net/?d=2016/01/16/13/29/06-windows-78-bloquer-les-mises-a-niveau-vers-windows-10
:: V4 escaped chevrons inside echo (my bad)
:: V5 reordered updates removal by kb number for readability and added some of isleaked updates: https://fix10.isleaked.com/oldwindows.html
:: V6 modified error check to make it not stop when non fatal error occur and added script to automatically hide nasty updates on Windows Update ( https://gist.github.com/neckcen/f099eda0b1cde283cdc9 )
:: V7 added WGA update and
@Albirew
Albirew / htaccess.bat
Created June 8, 2017 19:36
rename file in .htaccess in widows (cuz microsoft is a dick that don't allow filename starting with a dot)
@echo off
if [%1]==[] goto noarg
ren %1 .htaccess
exit
:noarg
echo rename input file into .htaccess
echo Usage: htaccess.bat "truc.txt"
pause
exit
@echo off
:: https://gist.github.com/Albirew/613cbf63595647ff26b269d5271871a0
:: added rev.18 of Matt's privilege escalation script: http://stackoverflow.com/posts/12264592/revisions
:: UAC privilege escalation
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)

Keybase proof

I hereby claim:

  • I am albirew on github.
  • I am albirew (https://keybase.io/albirew) on keybase.
  • I have a public key ASDoFxRYVR261WeLMAzUfRxGSRdoDnPYfC_ShEQeu_plxwo

To claim this, I am signing this object: