Skip to content

Instantly share code, notes, and snippets.

View vitoo's full-sized avatar

Victorien Plancke vitoo

  • Paris, France
  • 12:12 (UTC +02:00)
View GitHub Profile
@vitoo
vitoo / Rename.ps1
Created March 15, 2024 13:49 — forked from timnew/Rename.ps1
Script to Rename Computer without Reboot
$ComputerName = "New Name"
Remove-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "Hostname"
Remove-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "NV Hostname"
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\Computername\Computername" -name "Computername" -value $ComputerName
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\Computername\ActiveComputername" -name "Computername" -value $ComputerName
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "Hostname" -value $ComputerName
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "NV Hostname" -value $ComputerName
Set-ItemProperty -path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -name "AltDefaultDomainName" -value $ComputerName
@vitoo
vitoo / download_artifact.sh
Last active February 10, 2023 09:26
Download last github action artifact of a given repository and branch
#!/bin/bash
set -e
cd /tmp
# Define the repository and branch name
repo=$1
branch=$2
token=$3
@vitoo
vitoo / archv.user.js
Last active June 25, 2021 13:29
archv.user.js
// ==UserScript==
// @name archv.user.js
// @version 0.1
// @grant none
// @include /^(http|https):\/\/www\.jeuxvideo\.com\/forums\/(.*)$/
// ==/UserScript==
let topic410 = false;
if(document.getElementsByClassName("img-erreur")[0] && document.getElementsByClassName("img-erreur")[0].src == "https://www.jeuxvideo.com/img/erreurs/e410.png"){
@vitoo
vitoo / config.json
Created April 27, 2021 14:33
Get page source through appium
{
"appium_host" : "127.0.0.1",
"appium_port" : 4444,
"device_udid": "emulator-5560",
"platform": "Android"
}
Feature('Api feature');
require('chai').should();
Scenario('test a GET request', async (I) => {
response = await I.sendGetRequest('/api');
//output : console.log(response.data);
response.status.should.eql(200);
//check json object
response.data.should.be.an('object');
Feature('Api');
require('chai').should();
var assert = require('assert');
Scenario('test something', async (I) => {
I.sendGetRequest('/api').then((response) => {
assert.equal(200, response.status);
});
@vitoo
vitoo / selecteur.md
Created September 22, 2017 09:08
Les sélecteurs selenium (xpath,css...) dans Cerberus

Les selecteurs dans Cerberus

Exemple avec le bouton de recherche norauto.fr

Code html du bouton :

<button id="search-submit-button" class="search" type="submit" name="search">Rechercher</button>

Le type de l'élément est ici un button, et il a plusieurs attribut : id, class, type, name.

@vitoo
vitoo / dni_portugal.js
Last active November 17, 2021 16:13
Generate DNI/NIF for Spain and Portugal, in javascript
//credit : https://github.com/asmarques/pt-id
function pad(value, length) {
var result = value + '';
while (result.length < length) {
result = '0' + result;
}
return result;
@vitoo
vitoo / sshrc
Last active August 2, 2017 18:31
Send discord webhook at ssh login (every user)
#/etc/ssh/sshrc
ip=`echo $SSH_CONNECTION | cut -d " " -f 1`
curl --silent -v \
-H "Content-Type: application/json" \
-X POST \
-d "{\"content\":\"new login $USER $ip \"}" \
https://discordapp.com/api/webhooks/_WEBOOK_URL > /dev/null 2>&1