Skip to content

Instantly share code, notes, and snippets.

View fanyer's full-sized avatar

Fy fanyer

  • Somewhere on Earth
View GitHub Profile
@fanyer
fanyer / shell-out.ps1
Created March 3, 2023 08:01 — forked from kreig303/shell-out.ps1
Powershell aliases for git and npm
##
# POWERSHELL SPECIFIC
##
Set-Alias clr clear # slight contraction of clear command
function brc { Start notepad "C:\Users\kzimmerman012\Documents\PowerShell\profile.ps1" } # for editing this file
function Reload-PowerShell { Start-Process pwsh; exit } # reload PowerShell Core
Set-Alias relo Reload-PowerShell
function lw { dir | fw } # wide listing
function up { cd .. } # better back
function rmraf { Remove-Item -Recurse -Force $args[0] }
@fanyer
fanyer / downloadjsonascsv.js
Created February 13, 2023 11:44 — forked from royashbrook/downloadjsonascsv.js
Button Handler to download some JSON as CSV
//bind onclick to downloadcsv.
//o should be the json you want to turn into a table
//h should be a string array for the header row, or this can be null and it will use the keys from the first record
//n is the name of the file, csv will be appended. if omitted it will just be 'data.csv'
export const downloadcsv = (o,h,n = 'data') => {
downloadFile( toCSV(o,h) , n + '.csv', 'text/csv' );
}
const toCSV = (o,h) => {
const a = (v) => `"${v.join(`","`)}"`
let csv = []
@fanyer
fanyer / get-script-promise.js
Created February 2, 2023 02:53 — forked from james2doyle/get-script-promise.js
Async load a script in the page and run it. Uses promises
// this function will work cross-browser for loading scripts asynchronously
function loadScript(src) {
return new Promise(function(resolve, reject) {
const s = document.createElement('script');
let r = false;
s.type = 'text/javascript';
s.src = src;
s.async = true;
s.onerror = function(err) {
reject(err, s);
@fanyer
fanyer / .vimrc
Created July 20, 2022 02:07 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@fanyer
fanyer / .block
Created January 19, 2020 03:43 — forked from kerryrodden/.block
Sequences sunburst (d3 v4)
license: apache-2.0
@fanyer
fanyer / build.gradle
Created May 14, 2019 13:52 — forked from TurekBot/build.gradle
Gradle Shadow Example
group 'com.github.yourusername'
version '1.0-SNAPSHOT'
//These are dependencies that have to do with just the build. See: https://stackoverflow.com/a/23627293/5432315
buildscript {
repositories {
jcenter()
}
dependencies {
//This is necessary to use the gradle shadow plugin
// react-native/local-cli/server/util/attachWebsocketServer.js
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @format
from PIL import Image # 导入Pillow的Image模块
IMG = "/Users/fanyer/Downloads/b.png" # 需要处理掉的图片路径
filePath = "/Users/fanyer/test/b.txt" # 处理结果的保存路径
ascii_char = list("$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:,\"^`'. ")
height = 45
width = 100
# 重点。将256灰度映射到70个字符上
@fanyer
fanyer / sms.py
Created October 4, 2018 12:28 — forked from lihongjie0209/sms.py
from androidhelper import Android
from time import sleep
import json
import urllib2
d = Android()
url = "youserver/sms/notify"
while(True):
messages = d.smsGetMessages(False)
for i in messages.result:
let fs = require("fs");
let pako = require("pako");
let str = fs.readFileSync(
__dirname + "/903977b432af87d0cfb7766bbe038a8f76ca78"
);
function Uint8ToString(u8a) {
let CHUNK_SZ = 0x800000;
let c = [];
for (let i = 0; i < u8a.length; i += CHUNK_SZ) {