Skip to content

Instantly share code, notes, and snippets.

View francisoud's full-sized avatar

Benjamin Francisoud francisoud

  • Toulouse, France
View GitHub Profile
@francisoud
francisoud / proxy-auto-config.ps1
Created May 31, 2017 07:49
Auto configure windows proxy based on IP (home/work)
# Run this script: create a .cmd in "startup" menu
# Powershell -File %USERPROFILE%\proxy-auto-config.ps1
# Powershell.exe -executionpolicy remotesigned -File %USERPROFILE%\proxy-auto-config.ps1
# Use fixed IP address with DHCP and associate MAC address with fixed IP(s) (wifi/cable)
# Change IP mask bellow
# Sources:
# https://forums.manageengine.com/topic/setting-proxy-server-based-on-ip-address
# https://technet.microsoft.com/itpro/powershell/windows/nettcpip/get-netipaddress
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/d4051879-1a50-499a-a188-2a9b33004c96/configure-ie-proxy-settings-based-on-ip-address?forum=winserverpowershell
Arguments:
C:\Program Files\nodejs\node.exe C:\Program Files (x86)\Yarn\bin\yarn.js install
PATH:
C:\ProgramData\Oracle\Java\javapath;C:\Informatica\9.5.1\clients\tools\datadirect;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\ORACLE\ORA10G\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Java\jdk1.8.0_91\bin;C:\Users\t917561\.m2\wrapper\dists\apache-maven-3.3.9-bin\2609u9g41na2l7ogackmif6fj2\apache-maven-3.3.9\bin;C:\Program Files\Git\cmd;C:\softwares\CloudFoundry;C:\Program Files\nodejs\;C:\ORACLE\ORA11G\product\11.2.0\client_1\bin;C:\Program Files (x86)\Yarn\bin;C:\softwares\Ruby22\bin;C:\Users\t917561\AppData\Roaming\npm;C:\Users\t917561\AppData\Local\Yarn\.bin
Yarn version:
0.21.3
Node version:
REM Assuming a settings.xml is commited in project root dir
REM add this line on top of mvnw.cmd
IF NOT EXIST "%USERPROFILE%\.m2\settings.xml" call xcopy /F %CD%\settings.xml %USERPROFILE%\.m2\
@francisoud
francisoud / cleanup-tmp.sh
Last active May 3, 2016 07:01
Script to clean up /tmp dir from files created during various jenkins builds
#!/bin/bash
# see ctonrtab -e
# At 02:00 on Mon.
# 0 2 * * 1 /root/cleanup-tmp.sh >> /tmp/crontab/cleanup-tmp.log 2>&1
echo '-------- /root/cleanup-tmp.sh ---------'
date
# cleanup /tmp files and directories
rm -vfr /tmp/log* /tmp/*log /tmp/*.sh /tmp/RackMultipart* /tmp/npm-* /tmp/native-platform* /tmp/phantomjs* /tmp/sonar-* /tmp/*.css
@francisoud
francisoud / rename_one_drive.ps1
Last active April 4, 2016 08:52
Rename extension that M$ OneDrive Enterprise doesn't like :(
Function Rename-Files($path)
{
Get-ChildItem -path $path |
Foreach-Object {
if($_ -is [System.IO.DirectoryInfo]) {
# echo "directory: $_"
Rename-Files -path $_.FullName
} else {
# replace with exetension .swf, etc.
$newName = $_.name -replace '\.jar', '.jar.rename'
@francisoud
francisoud / rename.ps1
Created December 23, 2015 13:33
A powershell script to remove spaces and special char from filenames
Function Rename-Files($path)
{
Get-ChildItem -path $path |
Foreach-Object {
if($_ -is [System.IO.DirectoryInfo]) {
echo "directory: $_"
Rename-Files -path $_.FullName
} else {
$newName = $_.name -replace '[^A-Za-z0-9-_ \.\[\]]', ''
$newName = $newName -replace ' ', '_'
@francisoud
francisoud / index-boostrap.html
Created July 27, 2012 17:01
Test Boostrap, Less & nouveau tag HTML5
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Title of the document</title>
# language: fr
Fonctionnalité: Addition
# http://wiki.github.com/aslakhellesoy/cucumber/scenario-outlines
# ne pas utiliser 'Plan du Scénario' (ou alors avec Exemples)
Scénario: Addition de deux nombres
Soit une calculatrice
Et que j'entre 2 pour le premier nombre
Et que je tape sur la touche "+"
Et que j'entre 2 pour le second nombre
require 'fileutils'
File.open("result.csv", File::CREAT|File::RDWR) do |csv_file|
Dir["JSPs/**/*.jsp"].each do |file|
lines = File.readlines(file)
csv_file << "#{file}\t#{lines.length}\n"
end
end
# Configuration:
# change 'username'
# change 'max_pages'
# it's the number of pages of bookmarks
# you need to go to delicious and find the exact number manually
# see Watir::Browser.xxx for extra config parameters
#
# This code:
# 1- open a browser to your delicious page
# 2- fetch each link