Skip to content

Instantly share code, notes, and snippets.

@aloha1003
aloha1003 / app.js
Last active August 29, 2015 14:21 — forked from ralphmyw/app.js
var LINE = require('./line.js');
var line = new LINE();
var email = 'your email';
var password = 'your password';
line.login(email, password, function(error, result) {
if (error) {
return;
}
### USAGE
###
### ./ElasticSearch.sh 1.5.0 will install Elasticsearch 1.5.0
### ./ElasticSearch.sh 1.4.4 will install Elasticsearch 1.4.4
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
### ElasticSearch version
var fs = require('fs'),
http = require('http'),
https = require('https'),
express = require('express'),
token = '',
bodyParser = require('body-parser'),
request = require('request');
var port = 443;
@aloha1003
aloha1003 / gist:cb074b94a625e6790ccbde48fde2f5e2
Created July 28, 2016 15:43 — forked from mgedmin/gist:9547214
Setting up a Jenkins slave on Linux
# This is how you add a Jenkins slave
# On master:
sudo -u jenkins -H ssh-keygen
# On slave
adduser --system --group --home=/var/lib/jenkins-slave --no-create-home --disabled-password --quiet --shell /bin/bash jenkins-slave
install -d -o jenkins-slave -g jenkins-slave /var/lib/jenkins-slave
@aloha1003
aloha1003 / gist:47285c267bbca39e7ff9e6d4ab3c5b30
Created September 8, 2016 01:27 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@aloha1003
aloha1003 / webpack.config.js
Created April 23, 2017 04:10
Webpack with auto scan path for multiple entry points and recursive path mapping
'use strict';
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
// Map common libraries with aliases
var providePlugins = new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
@aloha1003
aloha1003 / Open iterm tab here
Created May 18, 2017 01:55 — forked from eric-hu/Open iterm tab here
Apple script to open an iterm2 tab from right-clicking on a file or folder in Finder. To use: (1) Open Automator (2) Create a new service (3) Change "Service receives selected" drop downs to "Files or folders" in "Finder" (4) Select "Run applescript" from the sidebar, then paste this script in and save
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
--
-- Modified to work with files as well, cd-ing to their container folder
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set filetype to (kind of (info for my_file))
-- Treats OS X applications as files. To treat them as folders, integrate this SO answer:
@aloha1003
aloha1003 / webpack.nginx.conf
Created May 25, 2017 02:18 — forked from SiZapPaaiGwat/webpack.nginx.conf
webpack-dev-server configuration in nginx on development server
upstream ws_server {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name 10.1.2.225;
location / {
proxy_pass http://ws_server/;
@aloha1003
aloha1003 / v-jquery-change.js
Created July 21, 2017 09:57 — forked from Galadirith/v-jquery-change.js
custom vue js directive for jquery events
Vue.directive('jquery-change', {
twoWay: true,
bind: function() {
var self = this;
$(self.el).on('change', function() {
self.set(this.value);
});
},
update: function(data) {
if(data) {
@aloha1003
aloha1003 / fake-autoplay-audio-ios-safari.html
Created January 26, 2018 21:48 — forked from ufologist/fake-autoplay-audio-ios-safari.html
Fake auto play html audio in iOS Safari the right way
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Fake auto play html audio in iOS Safari the right way</title>
</head>
<body>
<h1>在 iOS Safari 中假装自动播放 HTML5 audio(音乐) 的正确方式</h1>
<p>核心原理: 通过一个用户交互事件来主动 play 一下 audio</p>