Skip to content

Instantly share code, notes, and snippets.

Avatar

Mayne mayneyao

View GitHub Profile
@ahmed-musallam
ahmed-musallam / Circular.js
Created January 25, 2018 22:11
A simple circular javascript data structure (backed by an array)
View Circular.js
/**
* A simple circular data structure
*/
function Circular(arr, startIntex){
this.arr = arr;
this.currentIndex = startIntex || 0;
}
Circular.prototype.next = function(){
var i = this.currentIndex, arr = this.arr;
@LawJolla
LawJolla / gatsby-node.js
Created September 18, 2017 05:15
Gatsby Create pages from API
View gatsby-node.js
// Lightweight GraphQL generic client
const GraphQLClient = require('graphql-request').GraphQLClient;
const crypto = require('crypto');
const path = require('path');
const api = require('./api_constants');
//GraphQL query string to get all inventory, filtering by a specific dealer
const vehicles = `
{
allDealerships(filter:{ name:"Wheel Kinetics"}) {
@PurpleBooth
PurpleBooth / README-Template.md
Last active February 7, 2023 04:16
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

@protrolium
protrolium / ffmpeg.md
Last active February 5, 2023 17:21
ffmpeg guide
View ffmpeg.md

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@felixjones
felixjones / pmx21.md
Last active January 15, 2023 10:01
PMX (Polygon Model eXtended) 2.0, 2.1 File Format Specifications
View pmx21.md

PMX (Polygon Model eXtended) 2.1

This is an English description of the .PMX file format used in Miku Miku Dance (MMD).

PMX is the successor to the .PMD format (Polygon Model Data).

This is work-in-progress! Please leave feedback in the comments.

Todo

@dreispt
dreispt / odoo-sh.py
Created November 19, 2014 11:04
Odoo Shell: run Odoo commands without a server RPC connection
View odoo-sh.py
"""
Setup:
Assuming Odoo 8.0 sources at ~/odoo:
$ cp odoo-sh.py ~/odoo
$ cd ~/odoo
$ python -i odoo-sh.py
Usage example:
>>> env = connect('my-db-name')
>>> Users = env['res.users']
@zer4tul
zer4tul / 提问的智慧.md
Last active February 3, 2023 06:24
Simplified Chinese edition of "How To Ask Questions The Smart Way"
View 提问的智慧.md
@thomasfr
thomasfr / autossh.service
Last active January 10, 2023 00:08
Systemd service for autossh
View autossh.service
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@Nagyman
Nagyman / workflows-in-django.md
Last active December 23, 2022 23:00
Workflows in Django
View workflows-in-django.md

Workflows (States) in Django

I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.

Common Software Uses

  • Publishing (Draft->Approved->Published->Expired->Deleted)
@jo
jo / js-crypto-libraries.md
Last active February 4, 2023 04:24
List of JavaScript Crypto libraries.
View js-crypto-libraries.md

JavaScript Crypto Libraries

List some crypto libraries for JavaScript out there. Might be a bit out dated. Scroll to the bottom.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.