Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
Working from home

Faizar Septiawan icarrr

🏡
Working from home
View GitHub Profile
View global-gitignore.md

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore
@icarrr
icarrr / restart_network.ps1
Created Dec 9, 2019
Restart network iFace ethernet and VBox
View restart_network.ps1
# Restart iFace Ethernet
Restart-NetAdapter -Name "Ethernet"
# Restart iFace VBox
Restart-NetAdapter -Name "VirtualBox Host-Only Network"
@icarrr
icarrr / get_list_iface.ps1
Created Dec 9, 2019
Get list interface using PowerShell
View get_list_iface.ps1
netsh interface show interface
CMD /c PAUSE
@icarrr
icarrr / add_port.sh
Created Dec 9, 2019
Add and remove port RabbitMQ on CentOS 7 or RHEL 7
View add_port.sh
sudo firewall-cmd --zone=public --permanent --add-port=4369/tcp --add-port=25672/tcp --add-port=5671-5672/tcp --add-port=15672/tcp --add-port=61613-61614/tcp --add-port=1883/tcp --add-port=8883/tcp
sudo firewall-cmd --reload
@icarrr
icarrr / main.py
Created Dec 8, 2019
htmlmin to minify your html
View main.py
import htmlmin
html = """
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Case</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
View WS2012R2Optimisations.ps1
<#
.SYNOPSIS
Optimises Windows Server 2012 R2 Operating Systems running in a Citrix SBC environment.
.DESCRIPTION
This script disables services, disables scheduled tasks and modifies the registry to optimise system performance on Windows Server 2012 R2 running in a Citrix SBC environment.
.SCRIPT CONSTRUCT
Script Name : JGSpiers-WS2012R2Optimisations.ps1
@icarrr
icarrr / main.sh
Created Dec 4, 2019
Auto reset cert linux
View main.sh
#!/bin/bash
globalTime="$(date '+%Y%m%d %H%M%S' -d "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')" | awk '{print $2}')"
if [ $globalTime == "060001" ]; then
$HOME/reset_cert.sh
fi
@icarrr
icarrr / README.md
Created Dec 3, 2019
Backup and Extract file compress lzma
View README.md
  1. To backup files to type lzma, run the main.sh script.
  2. To extract files, use the following command:
xz -d file.tar.lzma
ls -l # check list file
tar -xvf file.tar
@icarrr
icarrr / main.sql
Created Dec 2, 2019
Get version of Microsoft SQL Server and Microsoft SQL Server Management Studio
View main.sql
SELECT SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('ProductLevel') AS ProductLevel,
SERVERPROPERTY('Edition') AS Edition;
EXEC sys.xp_msver;
@icarrr
icarrr / main.sh
Last active Dec 13, 2019
Reset the list of trusted CA certificates in RHEL 7
View main.sh
#!/bin/bash
# Get time
localTime=$(date '+%Y%m%d_%H%M%S' -d "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')")
# Create cert bak dir
mkdir -p $HOME/cert.bak
# Reset cert
sudo rpm -Vv ca-certificates | awk '$1!="........." && $2!="d" {system("mv -v " $NF " $HOME/cert.bak")}'
sudo yum check-update ca-certificates; (($?==100)) && sudo yum update -y ca-certificates || yum reinstall -y ca-certificates