Skip to content

Instantly share code, notes, and snippets.

@masbog
masbog / java8oracle.sh
Last active August 29, 2015 13:56
Change OpenJDK to OracleJDK 8 (CentOS 6)
yum -y remove java-1.6.0-openjdk
wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-x64.rpm" \
-O /opt/jdk-8-linux-x64.rpm
rpm -Uvh /opt/jdk-8-linux-x64.rpm
alternatives --install /usr/bin/java java /usr/java/jdk1.8.0/jre/bin/java 20000
alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0/bin/jar 20000
alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0/bin/javac 20000
@masbog
masbog / UIImage+ccolor.m
Last active August 29, 2015 14:00 — forked from kevinmcmahon/gist:2295471
Create UIImage from golor
- (UIImage *)imageWithColor:(UIColor *)color {
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
@masbog
masbog / ffmpeg_command
Last active August 29, 2015 14:06
create video with image and lenght using ffmpeg linux terminal
ffmpeg -s 720x576 -r 25 -loop 1 -y -i /root/anon.jpg -t 02:00:00 -acodec libfaac -ac 2 -ar 44100 -ab 128k -async 1 -vcodec libx264 -level 1.3 anon.mp4
if you want to add audio, add -i (audio file location)
#include <bitset>
#include <string>
#include <iostream>
#include <sstream>
using namespace std;
@masbog
masbog / mamp.md
Last active August 29, 2015 14:07 — forked from jfloff/mamp.md

First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

sudo lsof | grep LISTEN

If you do happen to have any process with something like this *:http (LISTEN), you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

ps <pid of that process>

If you don't see MAMP, you are in good hands, I have just the thing for you:

@masbog
masbog / bucard.sh
Created October 21, 2014 03:02
bucardo how to initialize 2 postgresql database server
#!/bin/bash
# slave ip server is 10.10.10.10
bucardo install --piddir=/tmp
bucardo add database db_master dbname=database_test
bucardo del database db_master
bucardo add database db_master dbname=database_test addalltables addallsequences
bucardo add database db_slave dbname=database_test host=10.10.10.10 addalltables addallsequences
bucardo add all table --herd=db_master_to_db_slave db=db_master
bucardo add all sequence --herd=db_master_to_db_slave db=db_master
bucardo add all table --herd=db_slave_to_db_master db=db_slave
@masbog
masbog / cydia.sh
Created October 26, 2014 19:09
Installing Cydia at iOS 8.x after jailbreak iDevice with Pangu from mac or linux
#!/bin/sh
echo "Input your iDevice ip address :"
read ipaddress
echo "create temporary directory at your desktop"
mkdir -p ~/Desktop/CydiaFileInstalls
echo "downloading Cydia"
cd ~/Desktop/CydiaFileInstalls && { curl -O http://cache.saurik.com/debs/cydia_1.1.13_iphoneos-arm.deb ; cd -; }
cd ~/Desktop/CydiaFileInstalls && { curl -O http://apt.saurik.com/debs/cydia-lproj_1.1.12_iphoneos-arm.deb ; cd -; }
ls -la ~/Desktop/CydiaFileInstalls
echo "default ssh password at your iphone is 'alpine' without quote"
@masbog
masbog / nginx_with_http_secure_link_and_lua_module.sh
Last active August 29, 2015 14:08
nginx_with_http_secure_link_and_lua_module
@masbog
masbog / nginx
Created November 4, 2014 10:31
NGINX init.d
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /opt/nginx/conf/nginx.conf
# config: /etc/sysconfig/nginx
@masbog
masbog / disable_ipv6.sh
Created November 27, 2014 10:00
Simple Disable IPV6 on CentOS
#!/bin/sh
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6" = 1 >> /etc/sysctl.conf
echo "IPV6INIT=no" >> /etc/sysconfig/network
service ip6tables stop
chkconfig ip6tables off
echo "install ipv6 /bin/true" > /etc/modprobe.d/ipv6_disabled.conf
echo "PLEASE REBOOT."
#!/bin/bash
### VARIABLES ###
PRE_PACK="openssl-devel pcre-devel make gcc"
VER="1.5.1"
# Setup Colours
black='\E[30;40m'
red='\E[31;40m'