Skip to content

Instantly share code, notes, and snippets.

@orzFly
orzFly / script-template.sh
Created Dec 15, 2020 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
View script-template.sh
#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
trap cleanup SIGINT SIGTERM ERR EXIT
usage() {
cat <<EOF
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class='origin'></div>
@orzFly
orzFly / README.md
Created Jul 13, 2017 — forked from joyrexus/README.md
Nested grouping of arrays
View README.md

nest

A multi-level groupBy for arrays inspired by D3's nest operator.

Nesting allows elements in an array to be grouped into a hierarchical tree structure; think of it like the GROUP BY operator in SQL, except you can have multiple levels of grouping, and the resulting output is a tree rather than a flat table. The levels in the tree are specified by key functions.

@orzFly
orzFly / Appex.c
Created Mar 9, 2017 — forked from blackgear/Appex.c
Generate license for AppEX
View Appex.c
#include <net/if.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <unistd.h>
int main() {
int fd;
struct ifreq ifr;
@orzFly
orzFly / aria2.rb
Created Jul 8, 2015
aria2 1.19.0 with libssh2
View aria2.rb
class Aria2 < Formula
homepage "http://aria2.sourceforge.net/"
url "http://sourceforge.net/projects/aria2/files/stable/aria2-1.19.0/aria2-1.19.0.tar.bz2"
sha1 "f5c6cad19fa8dda1394664d66930d59a3a7c4fa0"
depends_on "pkg-config" => :build
depends_on "c-ares" => :build
depends_on "libnettle" => :build
depends_on "libssh2" => :build
View PermutationAndCombination.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace _4DigitalSolver
{
public class PermutationAndCombination<T>
{
/// <summary>
/// 交换两个变量
@orzFly
orzFly / config.coffee
Last active Aug 29, 2015
node-config-loader
View config.coffee
_ = require 'lodash'
fs = require 'fs'
class Config # Singleton
constructor: (env) ->
env || = process.env.NODE_ENV
env || = 'development'
@current = @load(env)
@env = env
@orzFly
orzFly / nb.plugin.zsh
Last active Aug 29, 2015
NB: npm bin wrapper for zsh
View nb.plugin.zsh
#!/usr/bin/env zsh
nb() {
local npmbin="`npm bin`"
if [ ! -d "$npmbin" ]; then
echo "NB is not available at $npmbin"
return 1
fi
local command="$1"
builtin shift 1
View TouchwizHacker.java
package com.orzfly.xposed.touchwizhacker;
import android.content.res.XModuleResources;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
@orzFly
orzFly / powerline.zsh
Last active Aug 29, 2015
powerline-zsh
View powerline.zsh
local COLOR_FG_WHITE="%{$(tput setaf 7)%}"
local COLOR_FG_GRAY="%{$(tput setaf 8)%}"
local COLOR_FG_FAILURE="%{$(tput setaf 1)%}"
local COLOR_FG_SUCCESS="%{$(tput setaf 4)%}"
local COLOR_FG="%{$(tput setaf 0)%}"
local COLOR_BG_FAILURE="%{$(tput setab 1)%}"
local COLOR_BG_SUCCESS="%{$(tput setab 4)%}"
local COLOR_BG="%{$(tput setab 7)%}"
local COLOR_RESET="%{$(tput sgr0)%}"
readonly _ZSH_POWERLINE_SEP="$COLOR_FG_GRAY"$'\uE0B1'"$COLOR_FG"