Skip to content

Instantly share code, notes, and snippets.

@fangj99
fangj99 / jsonval.sh
Created January 22, 2021 00:49 — forked from cjus/jsonval.sh
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
@fangj99
fangj99 / processwire-dropzone-ajax.php
Created September 8, 2018 00:19
Processwire dropzone.js
<?php
/**
* Process dropzone ajax form
*
* @author Ivan Milincic <[email protected]>
* @copyright 2017 Ivan Milincic
*
*
*/
@fangj99
fangj99 / dropzone.php
Created September 8, 2018 00:19
Dropzone.js with php multiple files upload
<?php
// define absolute folder path
$storeFolder = 'ABSOLUTE_FOLDER_PATH/'
// if folder doesn't exists, create it
if(!file_exists($storeFolder) && !is_dir($storeFolder)) {
mkdir($storeFolder);
}
// upload files to $storeFolder
@fangj99
fangj99 / clearCSDNArticleDetail.js
Created September 5, 2018 05:55 — forked from guangtuan/clearCSDNArticleDetail.js
clear csdn article detail
// ==UserScript==
// @name clear csdn article detail
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://blog.csdn.net/*/article/details/*
// @grant none
// ==/UserScript==
@fangj99
fangj99 / gitBash_windows.md
Created August 29, 2018 22:32 — forked from evanwill/gitBash_windows.md
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so

@fangj99
fangj99 / v.php
Created July 10, 2018 04:42 — forked from fhefh2015/v.php
抖音无水印下载地址
<?php
/**
* Created by PhpStorm.
* User: aric
* Date: 18/7/10 上午9:34
*/
//获取重定向最终网址
function get_redirect_final_target($url)
{
@fangj99
fangj99 / file0.cs
Created May 22, 2018 05:39 — forked from TomoakiNagahara/file0.cs
How to using UniWebView2 (UniWebView2の使用方法) ref: http://qiita.com/TomoakiNagahara/items/2785c85c7b416f88e08f
using UnityEngine;
using System.Collections;
public class Main : MonoBehaviour {
private UniWebView _webView;
private string _errorMessage;
// Use this for initialization
@fangj99
fangj99 / ref-updated
Created May 3, 2018 04:37 — forked from axelson/ref-updated
Ref-updated gerrit script to send emails via the mail command when commits are pushed directly to gerrit. Install into the gerrit/hooks directory and make sure it is executable. You may want to change the "gitblit.rams" url to point to your own source code viewing website (such as a gitblit server). This has been tested on Gerrit 2.5
#!/bin/bash
#ref-updated --oldrev <old rev> --newrev <new rev> --refname <ref name> --project <project name> --submitter <submitter>
OLD_REV="$2"
NEW_REV="$4"
REF_NAME="$6"
PROJECT_NAME="$8"
SUBMITTER="${10}"
LOG="/tmp/log.txt"
@fangj99
fangj99 / jira-behing-nginx-ssl
Created April 6, 2018 02:06 — forked from jtbonhomme/jira-behing-nginx-ssl
Atlassian JIRA behind nginx + SSL
# force HTTP to HTTPS - /etc/nginx/conf.d/nonssl.conf
server {
listen 80;
server_name jira.example.com;
access_log off;
return 301 https://$server_name$request_uri;
}
# /etc/nginx/conf.d/jira.conf
server {
// ==UserScript==
// @name 去你大爷的 CSDN 全文阅读
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 把登录后查看全文阅读的那个啥玩意儿给干掉
// @author laobubu
// @match http://blog.csdn.net/*/article/details/*
// @grant none
// ==/UserScript==