Skip to content

Instantly share code, notes, and snippets.

Jason-Huang Pagliacii

View GitHub Profile
@Pagliacii
Pagliacii / Makefile
Last active May 31, 2020
Makefile template, usage: `make all_src_files[ debug=mode]`
View Makefile
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
@Pagliacii
Pagliacii / swf_header.py
Last active May 2, 2020
Parsing and getting the header of SWF files. [Adobe SWF File Format Specification](https://www.adobe.com/content/dam/acom/en/devnet/pdf/swf-file-format-spec.pdf)
View swf_header.py
#!/usr/bin/env python3
# _*_ coding:utf-8 _*_
"""
Author: Pagliacii
Copyright © 2020-Pagliacii-MIT License
"""
import math
from struct import unpack
@Pagliacii
Pagliacii / convert.sh
Created Apr 28, 2020
Use gnash and ffmpeg to convert *.swf to *.mp4
View convert.sh
#!/bin/bash
trap cleanup EXIT
set -eux
set -o pipefail
SWFFILE="$1"
MP4FILE="${SWFFILE%.*}.mp4"
RAWFILE=$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 32 | head -n 1).raw
WAVFILE=$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 32 | head -n 1).wav
@Pagliacii
Pagliacii / rust.json
Last active Apr 28, 2020
Useful snippets for Rust in VSCode.
View rust.json
{
// Place your snippets for rust here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@Pagliacii
Pagliacii / main.py
Last active Jul 30, 2019
Find the default open command by file extension on Windows
View main.py
# _*_ coding:utf-8 _*_
from subprocess import Popen, PIPE
class AssociationNotFound(Exception):
# means: File association not found for extension .ext
pass
@Pagliacii
Pagliacii / install-ext.sh
Last active Apr 26, 2019
This script is used to install the vscode extension manually. Or to install an extension to the code-server.
View install-ext.sh
#!/usr/bin/env bash
#===============================================================================
# This script is used to install the vscode extension manually.
# Or to install an extension to the code-server.
# Inspire by https://github.com/codercom/code-server/issues/171#issuecomment-473690326
#
# It has two way to install the extension:
# 1. by the extension ID
# 2. by the local vsix file
View minimal-analytics-snippet.js
(function (history, trackingId, options) {
const generateId = () => {
return '_' + Math.random().toString(36).substr(2, 9);
};
const getId = () => {
if (!localStorage.cid) {
localStorage.cid = generateId()
}
return localStorage.cid;
};
@Pagliacii
Pagliacii / iterm2-solarized.md
Created Dec 7, 2018 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel9k

Powerlevel9k

@Pagliacii
Pagliacii / README-Template.md
Created Dec 7, 2018 — forked from PurpleBooth/README-Template.md
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@Pagliacii
Pagliacii / cipher.go
Last active Dec 8, 2018
Caesor Cipher by Golang
View cipher.go
package main
import (
"flag"
"fmt"
"os"
"strings"
"unicode"
)
You can’t perform that action at this time.