Skip to content

Instantly share code, notes, and snippets.

View cjoshmartin's full-sized avatar

Josh Martin cjoshmartin

View GitHub Profile
import hid
def button_check(report):
button_press = report[8]
# print("{:08b}".format(button_press))
if button_press == 0:
return
a = button_press & 0b00000001
if a:
{
"version": 1,
"notes": "",
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n",
"keyboard": "reviung/reviung41",
"keymap": "reviung_reviung41_layout_reviung41_mine",
"layout": "LAYOUT_reviung41",
"layers": [
[
"KC_LSFT",
# Download file and have python version 3.8 or newer installed
# run "python main.py"
from pathlib import Path
import collections
import re
def top_n_words(input_file: str, common_words: str, n: int) -> None:
input_data = Path(input_file).read_text()
#include <iostream>
using namespace std;
int main() {
std::cout << "Hello, World!" << std::endl;
string input;
string output="";
cout<< endl;
int i=0;
8.125,B4 (7,2)
8.25,E4 (7,2)
9.375,D5 (7,2)
9.625,E5 (7,2)
9.75,E4 (7,2)
9.875,D4 (7,2)
10,B1 (8,4)
10,A4 (7,2)
11.5,B4 (7,2)
11.75,A4 (7,2)
@cjoshmartin
cjoshmartin / main.asm
Created December 4, 2017 02:22
backup
INCLUDE 'derivative.inc'
XDEF _Startup, MAIN_2, stateofelevator
; we use export 'Entry' as symbol. This allows us to
; reference 'Entry' either in the linker .prm file
; or from C/C++ later on
XDEF WAIT, CARRY, CRGINT, RTICTL, stateofelevator, NEXT_FLOOR
XDEF NEXT_FLOOR
XDEF INTERUPT, flag
xdef direction
@cjoshmartin
cjoshmartin / ngrok.sh
Created June 19, 2017 15:37
use ngrok global in terminal
#add this to your .bashrc or .zshrc
# download ngrok https://ngrok.com/download
# I have it downloaded in my root directory
ngrok(){
ngrok $*
}
# thats it pretty easy
shopt -s extglob
alias ll='ls -la'
alias redis='cd ~; redis-server /usr/local/etc/redis.conf'
alias ll_bower='ls -la bower_components'
# gits!
alias gfa="git fetch --all; gs"
# alias grh='git reset --hard; gl 10; gs'
@cjoshmartin
cjoshmartin / firebaseApi.py
Created June 16, 2017 01:58
Example of using firebase's RESTful API in python.
import requests ## you need to do a pip install requests
class database(object):
def __init__(self):
object.__init__(self)
self.baseUrl= "https://{YourDatabaseHere}.firebaseio.com/cars/"
# utilities
def urlBuilder(self,name="",color="",make="",year=0,parm=""):
car= self.makeTitle(name.lower(),color.lower(),make.lower(),year).replace(" ","%20")
@cjoshmartin
cjoshmartin / synchronousFileReadIn.js
Created May 23, 2017 20:34
reading in a file synchronous
var fs = require('fs');
var file ="./nasty.json"
var nastystring;
exports.command = function () {
try {
var data = fs.readFileSync(require('path').resolve(__dirname + "/nasty.json"), 'utf8');
nastystring =JSON.parse(data);
} catch(e) {
console.log('Error:', e.stack);