Skip to content

Instantly share code, notes, and snippets.

View natp0ng's full-sized avatar
🐯

Nut natp0ng

🐯
  • 06:51 (UTC +07:00)
View GitHub Profile
package xredis
import (
"strconv"
)
// HDel command:
// Removes the specified fields from the hash stored at key.
// Specified fields that do not exist within this hash are ignored.
// If key does not exist, it is treated as an empty hash and this command returns 0.
package xredis
import (
"errors"
"strconv"
)
// Del removes the specified keys.
// A key is ignored if it does not exist.
// Integer reply: The number of keys that were removed.
@natp0ng
natp0ng / wildcard
Created November 15, 2014 09:42
Nginx wildcard configuration
# *.example.com
server {
listen 80;
listen [::]:80;
server_name ~^(?<subdomain>.+)\.example\.com$;
access_log /srv/web/example.com/logs/nginx_access.log vhost_combined;
error_log /srv/web/example.com/logs/nginx_error.log;
@natp0ng
natp0ng / example.php
Last active August 29, 2015 14:15
Check for maintenance mode both Laravel4 and 5
// Laravel4 in global.php
<?php
App::down(function()
{
$ip = Request::getClientIp();
$allowed = array('192.168.1.7', '192.168.1.8', '127.0.0.1');
if(!in_array($ip, $allowed))
{
return Response::view('maintenance', array(), 503);
const {desktopCapturer, remote, ipcRenderer} = require('electron');
const util = require('util');
import { getSignedRequest, uploadFileToS3 } from './helper';
var MediaStreamRecorder = require('msr');
var mediaRecorder;
var transactionId;
var uiSelectScreen, uiButtonCapture, uiPlayer, uiLinkViewer, uiPreview;
let desktopSharing = false;
var recordAndUpload = true;
@natp0ng
natp0ng / webos-ss-client.js
Created August 18, 2016 04:41 — forked from jlai/webos-ss-client.js
Example nodejs code for connecting to a webOS Smart TV
/*
* Copyright (c) 2014 LG Electronics.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@natp0ng
natp0ng / main.js
Created January 17, 2017 07:09
Electron Remote Debugging via IP address
"use strict";
const electron = require('electron');
const app = electron.app;
app.commandLine.appendSwitch('remote-debugging-port', '8888');
// ref: https://github.com/nodejitsu/node-http-proxy
const http = require('http'),
httpProxy = require('http-proxy');
@natp0ng
natp0ng / LaravelSecurity
Created March 21, 2017 18:00
Laravel framework file permission - Security
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
@natp0ng
natp0ng / NginxRedirect.md
Created July 10, 2017 17:11 — forked from EmranAhmed/NginxRedirect.md
NGINX Redirect, Rewrite

Redirect: Temporary and Permanent

Source

What is an HTTP Redirect?

HTTP redirection, or URL redirection, is a technique of pointing one domain or address to another. There are many uses for redirection, and a few different kinds of redirection to consider.

As you create content and administrate servers, you will often find the need to redirect traffic from one place to another. This guide will discuss the different use-cases for these techniques, and how to accomplish them in Apache and Nginx.

@natp0ng
natp0ng / default
Created January 19, 2018 10:19 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}