Skip to content

Instantly share code, notes, and snippets.

View luoyjx's full-sized avatar
📖

yanjixiong luoyjx

📖
View GitHub Profile
@luoyjx
luoyjx / ResideMenuDemo_.gitignore
Created January 16, 2015 07:15
侧边栏菜单APP
.gradle
/local.properties
/.idea/workspace.xml
.DS_Store
/build
@luoyjx
luoyjx / morgan_access_log.js
Created August 29, 2016 02:51
morgan access log config
var fs = require('fs');
var app = express();
var logger = require('morgan');
var FileStreamRotator = require('file-stream-rotator');
var logDirectory = config.access_log_path;
// ensure log directory exists
fs.existsSync(logDirectory) || fs.mkdirSync(logDirectory)
@luoyjx
luoyjx / choujiang.html
Created January 3, 2017 09:57
年会抽奖
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<meta http-equiv="Content-Language" content="zh-CN"/>
<title>抽奖活动</title>
<style type="text/css">
body {padding-top:100px;font:12px "\5B8B\4F53",sans-serif;text-align:center;}
.result_box {margin:0 auto;width:700px;padding:100px 0;text-align:center;border:3px solid #40AA53;background:#efe;}
.result_box #oknum {width:700px;color:#cc0000;font-size:50pt;font-family:Verdana;text-align:center;border:none;background:#efe;}
.button_box {margin:50px 0 0 0;}
@luoyjx
luoyjx / kickass.js
Created April 11, 2017 05:09 — forked from jackqt/kickass.js
Kick Ass
javascript:var%20KICKASSVERSION='2.0';var%20s%20=%20document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='//hi.kickassapp.com/kickass.js';void(0);
#!/bin/bash
user=`whoami`
if [ "$user" != "root" ]; then
echo "You Password" | su root
fi
@luoyjx
luoyjx / line-number
Created September 3, 2017 05:36
get func call line number
'use strict'
var path = require('path')
// Stack trace format :
// https://github.com/v8/v8/wiki/Stack%20Trace%20API
var stackReg = /at\s+(.*)\s+\((.*):(\d*):(\d*)\)/i;
var stackReg2 = /at\s+()(.*):(\d*):(\d*)/i;
module.exports = function log (basedir) {
@luoyjx
luoyjx / ssh2-to-redis.js
Created January 10, 2019 14:33
how to connect to redis via ssh
'use strict';
import {createAction} from 'Utils';
import {Client} from 'ssh2';
import net from 'net';
import Redis from 'ioredis';
function getIndex(getState) {
const {activeInstanceKey, instances} = getState()
return instances.findIndex(instance => instance.get('key') === activeInstanceKey)
@luoyjx
luoyjx / sse.go
Created March 26, 2019 13:00 — forked from ismasan/sse.go
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
@luoyjx
luoyjx / upload.js
Created June 18, 2019 08:25
upload file with node-fetch & form-data
const fetch = require('node-fetch')
const FormData = require('form-data')
const pdfPath = '/path/to/pdfFile'
async function upload () {
const formData = new FormData()
formData.append('name', 'xxx')
formData.append('filename', 'xxxxxxxx.pdf')
formData.append('file', fs.readFileSync(pdfPath), {
@luoyjx
luoyjx / update-golang.md
Created July 9, 2019 04:59 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by: