This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.12 | |
import json | |
from dataclasses import dataclass | |
from subprocess import PIPE, Popen | |
SUPER = 64 | |
ALT = 8 | |
CTRL = 4 | |
SHIFT = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
import json | |
# Returns a python dictionary given a file containing a JSON-based | |
# component definition. Every definition *must* contain a 'type' | |
# and 'schema' field inside a top-level dictionary. Here is an | |
# example of a simple schema file that defines a 'meta' component | |
# containing a 'name' field. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//with JQuery | |
function clickOutsideClose(element, callback) { | |
$(document).mouseup(function(e) { | |
let container = $(element) | |
if (!container.is(e.target) && container.has(e.target).length === 0) { | |
container.hide() | |
if (typeof callback === 'function') { | |
callback() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _create_html(inner_html, attributes = {}, data_attr = {}, self_closing = false, tag = null) { | |
let html = '<' + tag | |
if (!is_array(inner_html) && is_object(inner_html)) { | |
attributes = inner_html | |
inner_html = null | |
} | |
for (let key in attributes) { | |
html = html + ' ' + key + '="' + attributes[key] + '"' | |
} | |
for (let key in data_attr) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from decimal import Decimal | |
from datetime import timedelta | |
def duration(duration_string): #example: '5d3h2m1s' | |
duration_string = duration_string.lower() | |
total_seconds = Decimal('0') | |
prev_num = [] | |
for character in duration_string: | |
if character.isalpha(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
autopep=$(autopep8 -dr .) | |
if [[ -z $autopep ]] | |
then | |
echo "> PEP8 passed !" | |
else | |
echo "> PEP8 DID NOT pass !" | |
echo "$autopep" | colordiff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Linked list implementation | |
;; I compile it like this on Mac OS X: | |
; | |
; llvm-as linked-list.ll | |
; llc linked-list.bc | |
; as linked-list.s -o linked-list.o | |
; ld /usr/lib/crt1.o linked-list.o -o linked-list -lSystem -macosx_version_min 10.6 | |
;; Type aliases | |
%free_func = type void (i8*)* |