Skip to content

Instantly share code, notes, and snippets.

View bliaxiong's full-sized avatar
🎯
Focusing

bxio bliaxiong

🎯
Focusing
View GitHub Profile
@bliaxiong
bliaxiong / www.youtube.com.js
Created January 10, 2021 16:33
Youtube userscript to block ads in videos
const observer = new MutationObserver(mutations => {
for(const mutation of mutations) {
for(const addedNode of mutation.addedNodes) {
if(addedNode.tagName === "VIDEO") {
const video = addedNode
video.addEventListener("timeupdate", () => {
const adSkipButton = document.querySelector(".ytp-ad-skip-button-slot button,.ytp-ad-overlay-close-button")
if(adSkipButton) {
adSkipButton.click()
}
import React, { Component } from "react";
import PropTypes from "prop-types";
import TaskItem from "./TaskItem";
import { randomStr } from "../utils/util"
class TaskItems extends Component {
static propTypes = {
taskListId: PropTypes.num,
taskItems: PropTypes.array,
userId: PropTypes.string
#!/bin/sh
ffmpeg -ss 600 -i input.mp4 -vframes 1 -filter:v 'yadif,scale=420:270' output.png
// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// Safari <= 9 "[object HTMLElementConstructor]"
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// Internet Explorer 6-11
var isIE = /*@cc_on!@*/false || !!document.documentMode;
// Edge 20+
var isEdge = !isIE && !!window.StyleMedia;
@bliaxiong
bliaxiong / .vimrc
Last active September 27, 2016 20:21
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/nerdtree.git'
Plugin 'easymotion/vim-easymotion'
var React = require('react');
var Example = React.createClass({
//
propTypes: function() {
},
displayName: function() {
},
#!/bin/sh
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
rm server.pass.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
@bliaxiong
bliaxiong / golang_serve_file.go
Created January 31, 2015 03:15
Simple golang server to serve a zip file.
package main
import (
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "applicaiton/zip")
w.Header().Set("Content-Disposition", "attachment; filename='file.html.zip'")
@bliaxiong
bliaxiong / mysql_sqlx.go
Created December 31, 2014 06:25
Go mysql sqlx example
package main
import (
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
"log"
)
type User struct {
Id int
@bliaxiong
bliaxiong / check_file_upload.js
Last active August 29, 2015 14:12
Js check upload file size
// This awesome jQuery plugin will check the file size and against the selected upload file and
// determine if its allowable. The size limit will have to be in bytes.
// Parameters:
// evt_type - the javascript event, if non is needed, set to empty string
// limit - the size limit in bytes (default javascript size measurement)
$.fn.fileSizeCheck = function(evt_type, limit) {
var sizeLimit = limit;
if (evt_type == "") {