Skip to content

Instantly share code, notes, and snippets.

View betapcode's full-sized avatar

Phạm Ngọc Minh betapcode

  • tamtay.vn
  • Hà Nội - Việt Nam
View GitHub Profile
@betapcode
betapcode / etc.init.d.nginx
Created January 23, 2015 13:09
File Config Nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# pidfile: /var/run/nginx.pid
@betapcode
betapcode / ghost.c
Created January 28, 2015 04:01
ghost.c
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define CANARY "in_the_coal_mine"
struct {
char buffer[1024];
char canary[sizeof(CANARY)];
}
@betapcode
betapcode / diskspace.sh
Created February 5, 2015 15:44
file check disk space on server linux
#!/bin/bash
# Created by @betapcode - time 05/12/2014
# Check Out of disk space on server
# Copyright (c) 2005 nixCraft project <http://cyberciti.biz/fb/>
# admin email account - eg: minh.pham@tamtay.vn betapcode@gmail.com pnminh.it@gmail.com
ADMIN="minh.pham@tamtay.vn"
# set usage alert threshold - default is 90%
THRESHOLD=90
@betapcode
betapcode / opencv-test-c.cpp
Created February 15, 2015 06:13
file test sử dụng opencv sử dụng C++
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv )
{
if ( argc != 2 )
{
printf("usage: DisplayImage.out <Image_Path>\n");
@betapcode
betapcode / CMakeLists.txt
Created February 15, 2015 06:16
File định nghĩa khai báo compile opencv sử dụng cmake
cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage opencv-test-c.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )
#!/bin/sh
#
# nginx Startup script for nginx
#
# chkconfig: - 85 15
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# description: nginx is an HTTP and reverse proxy server
@betapcode
betapcode / mongodb.plist
Last active October 17, 2015 17:29
mongodb.plist add to LaunchDaemons on macbook with path /Library/LaunchDaemons/mongodb.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>mongodb</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mongodb/bin/mongod</string>
@betapcode
betapcode / seq_mongo_auto.php
Created October 20, 2015 06:11
Auto incrêmnting Sequence in mongodb using php
<?php
$m = new MongoClient();
// select a database
$db = $m->seq;
// select a collection (analogous to a relational database's table)
$collection = $db->counters;
$user_collection = $db->user;
@betapcode
betapcode / install_thrift.sh
Last active October 28, 2015 03:40 — forked from amuraru/install_thrift.sh
install thrift 0.8.0
#/bin/bash
set -e
wget http://archive.apache.org/dist/thrift/0.8.0/thrift-0.8.0.tar.gz
tar zxf thrift-0.8.0.tar.gz
pushd thrift-0.8.0
wget https://issues.apache.org/jira/secure/attachment/12511532/thrift-1465_1.patch
patch -p0 < thrift-1465_1.patch
wget https://issues.apache.org/jira/secure/attachment/12537024/THRIFT-1474-read-exceptions-first.patch
@betapcode
betapcode / create_ipa.sh
Created December 2, 2015 15:29 — forked from six519/create_ipa.sh
Building Ionic iOS Release And Generate ipa File Script
#!/bin/bash
# Thanks to: https://gist.github.com/DavidFrahm/4409d6b74e46377e7be7
# Usage: ./create_ipa.sh <Scheme Name> <Provisioning Profile>
echo "Building Ionic iOS release..."
ionic build --release ios
pushd platforms/ios/
echo "Building archive file..."
xcodebuild -scheme "$1" -configuration Release clean archive -archivePath "build/$1.xcarchive"