Skip to content

Instantly share code, notes, and snippets.

View houtianze's full-sized avatar
🎯
Focusing

Hou Tianze houtianze

🎯
Focusing
View GitHub Profile
@houtianze
houtianze / facebook.html
Created April 6, 2017 12:52
Facebook login
<!DOCTYPE html>
<html>
<head>
<title>Facebook Login JavaScript Example</title>
<meta charset="UTF-8">
</head>
<body>
<p id="greeting">Test</p>
<script>
// This is called with the results from from FB.getLoginStatus().
'use strict';
// Code not verified / tested though. -Tianze
var express = require("express");
var fs = require("fs");
var _ = require("underscore");
var dbJsonFileName = "carts.json";
var dbJson = fs.readFileSync(dbJsonFileName, 'utf8');
@houtianze
houtianze / get.cert.md
Last active March 22, 2017 03:38
Get Cert in X509
function get_cert()
{
	local host="$1"
	local port="$2"
	if [ -z "$port" ]
	then
		port="443"
	fi
@houtianze
houtianze / build.xsel.on.centos.sh
Last active August 29, 2020 22:18
Build xsel on CentOS
#!/bin/sh
set -e
# ================================================================
# << Update >>
# Running the following is enough, no need to build yourself
# sudo yum install epel-release.noarch
# sudo yum install xsel
# ================================================================
@houtianze
houtianze / build.xclip.on.centos.sh
Last active April 16, 2020 07:32
Build xclip on CentOS
#!/bin/sh
set -e
# ================================================================
# << Update >>
# Running the following is enough, no need to build yourself
# sudo yum install epel-release.noarch
# sudo yum install xclip
# ================================================================
@houtianze
houtianze / enable.sysv.script.md
Created September 21, 2016 09:25
Enable a SysV Init Script

(Assuming your executable script is called foo)

  1. Create your script in /etc/init.d/foo
  2. Add it chkconfig --add foo
  3. Enable it chkconfig foo on
@houtianze
houtianze / sysv.init.script.to.systemd.unit.file.md
Last active February 20, 2024 14:00
Convert SysV Init scripts to Systemd Unit File

Let's say you have a SysV Init Script named foo

  1. Copy the file to /etc/init.d/foo

  2. Enable the SysV service: chkconfig --add foo

  3. Enable the SysV service: chkconfig foo on

  4. Start the service: service foo start. After this, systemd-sysv-generator will generate this file /run/systemd/generator.late/foo.service, copy this file to /etc/systemd/system by running: cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service

  5. Edit /etc/systemd/system/foo.service by running systemctl edit foo.service, add in the following line to foo.servie (this makes the service installable)

[Install]

@houtianze
houtianze / fork.18m.wsvt.user.js
Last active August 7, 2017 06:15
GreaseMonkey IBM WSVT Forking Script
// ==UserScript==
// @name Fork 18m WSVT
// @namespace 18m
// @description Just fork it
// @updateURL https://gist.github.com/houtianze/ee2cf2f4d022911566a09e77bcfc9233/raw
// @version 0.1.1
// @grant none
// @include http*://*.ibm.com/WSVTASEAN/*IsamDetails.action
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js
// ==/UserScript==
@houtianze
houtianze / gitpullall.sh
Created June 24, 2016 05:01
Perform recursive git pulling at the current / given directory
#!/bin/sh
pullall() {
curdir=`pwd`
if [ -d ".git" ]
then
echo "Git pulling at $curdir"
git pull
else
echo "Skipping non git directory $curdir"
@houtianze
houtianze / buildapk.bat
Created April 12, 2016 00:53
A simple Windows batch file to build apk from a smali directory
:: you need to have apktool in your path
if not x%1==x goto doit
:usage
echo %~n0 ^<smali dir^>
goto end
:doit
set EXTRA_SIGN_AGS=
if not x%KEYPASS%==x set EXTRA_SIGN_AGS=-storepass %KEYPASS% -keypass %KEYPASS%