Skip to content

Instantly share code, notes, and snippets.

@orzFly
orzFly / script-template.sh
Created December 15, 2020 12:20 — 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/
#!/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
<!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 July 13, 2017 09:02 — forked from joyrexus/README.md
Nested grouping of arrays

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 March 9, 2017 16:50 — forked from blackgear/Appex.c
Generate license for AppEX
#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 July 8, 2015 18:13
aria2 1.19.0 with libssh2
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
@orzFly
orzFly / PermutationAndCombination.cs
Created June 28, 2015 13:06
Bulls and Cows Solver
using System;
using System.Collections.Generic;
using System.Text;
namespace _4DigitalSolver
{
public class PermutationAndCombination<T>
{
/// <summary>
/// 交换两个变量
@orzFly
orzFly / config.coffee
Last active August 29, 2015 14:23
node-config-loader
_ = 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 August 29, 2015 14:21
NB: npm bin wrapper for 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
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 August 29, 2015 14:13
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"