Skip to content

Instantly share code, notes, and snippets.

@b1ghawk
b1ghawk / background.js
Created October 9, 2018 10:19 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@b1ghawk
b1ghawk / Login.java
Created November 21, 2018 09:39
Login into BiliBili (written by HongHong)
/**
*
*/
package 登陆B站;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
@b1ghawk
b1ghawk / gist:6b1a61832f19ec946d648a212262b8fd
Created February 20, 2019 16:20 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@b1ghawk
b1ghawk / better-nodejs-require-paths.md
Created April 9, 2019 08:34 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

<?php
/**
* Catch php output buffering data over jQuery AJAX
*
* @author: Sohel Rana ([email protected])
* @author url: https://blog.sohelrana.me
* @link: https://blog.sohelrana.me/catch-php-output-buffering-data-jquery-ajax/
* @licence MIT
*/
@b1ghawk
b1ghawk / NiochatServer.java
Created January 15, 2020 08:34 — forked from Botffy/NiochatServer.java
simple Java NIO chat server
package niochat;
import java.net.*;
import java.nio.*;
import java.nio.channels.*;
import java.io.IOException;
import java.util.*;
public class NiochatServer implements Runnable {
private final int port;
@b1ghawk
b1ghawk / CMakeLists.txt
Created June 24, 2020 03:07 — forked from jyukutyo/CMakeLists.txt
Build OpenJDK on CLion
cmake_minimum_required(VERSION 3.7)
project(hotspot)
include_directories(
src/hotspot/cpu
src/hotspot/os
src/hotspot/os_cpu
src/hotspot/share
src/hotspot/share/precompiled
src/hotspot/share/include
src/java.base/unix/native/include
@b1ghawk
b1ghawk / free-memory.rb
Created July 9, 2020 06:39 — forked from vigo/free-memory.rb
"free" command for osx. Shows available memory
#!/usr/bin/env ruby
# encoding: utf-8
# By Uğur Özyılmazel, @vigobronx | @ugurozyilmazel
# http://vigodome.com | http://ugur.ozyilmazel.com | http://github.com/vigo
def get_paged_memory_usage(match_string, paging=4096)
mvar = 3
if match_string.split(/[^\w]/).length > 1
mvar = 4
@b1ghawk
b1ghawk / POIUtil.java
Last active August 20, 2020 02:44
Apache POI patch : a more precise autoColumnWidth (with support for auto-wrap text)
import lombok.Data;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.SheetUtil;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.helpers.ColumnHelper;
import java.awt.font.FontRenderContext;
import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
@b1ghawk
b1ghawk / ast vs rpn.js
Created August 27, 2020 02:09 — forked from koorchik/ast vs rpn.js
Compare AST and RPN evaluation performance
/*
There is an AST (Abstract syntax tree) in JSON format.
AST represents Excel spreadsheet formula.
Is it possible in JavaScript to make RPN (Reverse Polish Notation) faster than AST?
AST evaluation is recusive and RPN evaluation is iterative.
But in any case, AST evaluation is faster despite recursion.
I guess that the main problem is in using dynamic js arrays to emulate stack.
Would RPN win if it was written in C/C++?