Skip to content

Instantly share code, notes, and snippets.

@ViKingIX
ViKingIX / gencrt.sh
Created October 23, 2015 05:45
Create a self signed certificate in one line
openssl req -x509 -newkey rsa:2048 -keyout $NAME.key -out $NAME.pem -days 365 -nodes \
-subj "/C=TW/ST=Taiwan/L=Taipei/O=$ORG/OU=$UNIT/CN=$NAME"
@ViKingIX
ViKingIX / matrix_msg.c
Created November 20, 2015 01:33
matrix like message display animation
void scr_about_init(void)
{
w_about = newwin_title(0, WAV_HEIGHT, "About", false);
for (i = 0; i < ARRAY_SIZE(about_lines); i++) {
linecd[i] = malloc(strlen(about_lines[i]) * sizeof(int));
for (j = 0; j < strlen(about_lines[i]); j++)
linecd[i][j] = (rand() / (float)RAND_MAX) * 120 + 60;
}
}
@ViKingIX
ViKingIX / uninst_pip.sh
Created November 27, 2015 03:02
uninstall pip
python -m pip uninstall pip
@ViKingIX
ViKingIX / ssh_secure.sh
Created December 10, 2015 07:04
block brute force ssh login
iptables -A SSH -m conntrack --ctstate NEW -m recent --set --name ssh --mask 255.255.255.255 --rsource
iptables -A SSH -m recent --update --seconds 30 --hitcount 6 --name ssh --mask 255.255.255.255 --rsource -j DROP
iptables -A SSH -m recent --update --seconds 15 --hitcount 2 --name ssh --mask 255.255.255.255 --rsource -j DROP
iptables -A SSH -j ACCEPT
@ViKingIX
ViKingIX / ubuntu-14.04.4_bna.md
Last active April 18, 2016 02:23
Install Firmware for Brocade BR-1020 on Ubuntu 14.04.4

Fix bna.ko on Ubuntu 14.04.4

Get Firmwares

cd /lib/firmware
sudo wget http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/plain/{ctfw,ct2fw}-3.2.5.1.bin

Update initramfs

@ViKingIX
ViKingIX / install_niresh_hackintosh.md
Created April 28, 2016 07:25
How to Install Niresh Yosemite on Your PC

How to Install Niresh Yosemite on Your PC

OS X Yosemite (10.10) is the latest OS X release of 2014 by apple, but Apple locks the operating system to only be installed in genuine Apple computers known as Macintosh & they cost a lot any how there is always a way if you want to install the operating system in your common pc, without paying high cost for a real mac you can make a Hackintosh

We have previously covered the article for Installing Niresh Mavericks on PC if you’re interested in Installing Mac OS X Yosemite on PC this article is for you, You may experience many problems while trying to Install Hackintosh, most of them can be fixed easily most troubleshoot informations are included in this guide so first just read all Instructions once before starting any procedures.

Few Notes about this OSX 10.10 & 10.10.1 (Intel & AMD Supported)

@ViKingIX
ViKingIX / baas-fw.md
Last active December 21, 2016 09:36
BaaS Linux Firewall

BaaS Linux Firewall

/etc/sysctl.conf

net.ipv4.ip_forward=1

/etc/network/interfaces

cntf1

@ViKingIX
ViKingIX / reverse_tree.php
Last active February 22, 2017 08:09
build tree bottom up then traverse top down
<?php
class Node {
public $val;
public $mem;
public $par;
function __constructor($v)
{
$this->val = $v;
$this->mem = Array();
@ViKingIX
ViKingIX / VMware notes
Created April 14, 2017 09:52
VMware notes
# VMware notes
#### BR-1020 Driver
#### Mount virtual cd on ESXi host
1. Find out cdrom device reference
```bash
esxcfg-mpath -l
```
2. Load iso9660 module
@ViKingIX
ViKingIX / KVM + Ceph with Pacemaker.md
Created March 8, 2018 04:02
KVM + Ceph with Pacemaker

KVM + Ceph with Pacemaker

Architecture

  • Hosts: 2
  • Roles:
    • Host 1: KVM, Ceph
    • Host 2: KVM, Ceph

Steps

  1. setup ceph cluster