Skip to content

Instantly share code, notes, and snippets.

Brahim Machkouri brahimmachkouri

Block or report user

Report or block brahimmachkouri

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brahimmachkouri
brahimmachkouri / fusion-version.ps1
Created Mar 18, 2019
Get the latest version of fusioninventory agent in Powershell
View fusion-version.ps1
$result = (Invoke-WebRequest –Uri "https://github.com/fusioninventory/fusioninventory-agent/releases/latest" -UseBasicParsing).BaseResponse.ResponseUri.AbsolutePath.Split('/')[-1]
@brahimmachkouri
brahimmachkouri / latest-fusion-agent.php
Last active Feb 26, 2019
Get the latest version of fusioninventory agent
View latest-fusion-agent.php
<?php
// BM 20190226
function get_links($link)
{
$result = "";
$ret = array();
/*** a new dom object ***/
$dom = new domDocument;
View OS X macOS Install ISO Creator
#!/bin/bash
################################
# OS X Install ISO Creater #
# #
# Author: shela #
################################
#######################################
# Declarations
@brahimmachkouri
brahimmachkouri / pmx.php
Last active Oct 17, 2017
"Proxy" to access Proxmox cluster
View pmx.php
<?php
/*
It will access the first node available.
*/
$hosts = array('10.0.2.15','10.0.2.16','10.0.2.17');
$port = '8006';
$active = ''; // active node
foreach ($hosts as $host)
{
View uninstall_ajenti.sh
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
DISTRO=
OS=
if grep 'Debian' /etc/issue > /dev/null 2>&1 ; then
@brahimmachkouri
brahimmachkouri / movm.py
Created Jun 20, 2017
Export/Import Virtualbox VM
View movm.py
#!/usr/bin/env python
import os
import subprocess
import shutil
homePath = os.path.expanduser("~")
vmPath = None
vbPath = os.environ.get('VBOX_MSI_INSTALL_PATH',None)
id = None
with open('./.vagrant/machines/default/virtualbox/id') as file:
@brahimmachkouri
brahimmachkouri / vagrant-uuids.sh
Last active Jun 24, 2017
This script displays vagrant index_uuid for each VM created with Vagrant (macOS)
View vagrant-uuids.sh
#!/bin/bash
vms=$(vagrant global-status | awk -F " " '{ print $5 }' | grep Users)
for vm in $vms
do
if [ -d "$vm" ]; then
cat $vm/.vagrant/machines/default/virtualbox/index_uuid
echo " $vm"
fi
done
View pushbullet.php
<?php
// Used code from the following sources:
// https://gist.github.com/styxit/e34d4c6f8cb23d55f5af#file-synology-pushover-php
// http://pastebin.com/iHAFAHGq
// Thanks to: https://styxit.com/2014/05/10/synology-pushover.html
// Only allow request made by localhost?
@brahimmachkouri
brahimmachkouri / aes-cfb-example.go
Created Dec 24, 2016 — forked from temoto/aes-cfb-example.go
Example of AES (Rijndael) CFB encryption in Go. IMHO, http://golang.org/pkg/crypto/cipher/ could benefit a lot from similar snippet.
View aes-cfb-example.go
package main
import (
"crypto/aes"
"crypto/cipher"
"fmt"
)
func EncryptAESCFB(dst, src, key, iv []byte) error {
aesBlockEncrypter, err := aes.NewCipher([]byte(key))
@brahimmachkouri
brahimmachkouri / brew-install.sh
Last active Jun 15, 2016
Install brew, cask, vagrant and virtualbox automatically
View brew-install.sh
#/bin/bash
# macOS only
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap caskroom/cask
brew cask install vagrant
brew cask install virtualbox
You can’t perform that action at this time.