Skip to content

Instantly share code, notes, and snippets.

View icarrr's full-sized avatar
🚴
Cycling anywhere and Work from everywhere

Faizar Septiawan icarrr

🚴
Cycling anywhere and Work from everywhere
View GitHub Profile
@icarrr
icarrr / main.py
Created November 21, 2019 09:11
Access a function variable outside the function without using “global”
def hi():
# other code...
hi.bye = 42 # Create function attribute.
sigh = 10
hi()
print(hi.bye) # -> 42
@icarrr
icarrr / immortal.bat
Created November 25, 2019 11:57
Can move files that are more than 2 days old
@echo off
set X=2
set "source=source"
set "destination=destination"
robocopy "%source%" "%destination%" /move /minage:%X%
@icarrr
icarrr / rabbitmq.txt
Created November 28, 2019 05:56 — forked from sdieunidou/rabbitmq.txt
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@icarrr
icarrr / main.sql
Created December 2, 2019 17:56
Get version of Microsoft SQL Server and Microsoft SQL Server Management Studio
SELECT SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('ProductLevel') AS ProductLevel,
SERVERPROPERTY('Edition') AS Edition;
EXEC sys.xp_msver;
@icarrr
icarrr / README.md
Created December 3, 2019 06:46
Backup and Extract file compress lzma
  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.sh
Created December 4, 2019 03:37
Auto reset cert linux
#!/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
<#
.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.py
Created December 8, 2019 17:09
htmlmin to minify your html
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">
@icarrr
icarrr / add_port.sh
Created December 9, 2019 03:58
Add and remove port RabbitMQ on CentOS 7 or RHEL 7
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 / get_list_iface.ps1
Created December 9, 2019 04:20
Get list interface using PowerShell
netsh interface show interface
CMD /c PAUSE