Skip to content

Instantly share code, notes, and snippets.

@fdask
fdask / echo2tty.py
Created January 14, 2025 15:12
Send chars to CLI program
#!/usr/bin/python3
import termios
import fcntl
import sys
if __name__ != '__main__':
exit
if len(sys.argv) != 2:
#!/bin/bash
# Declare an array of string with type
declare -a Regions=(
"us-east-1"
"us-east-2"
"us-west-1"
"us-west-2"
#"af-south-1"
"ap-east-1"
@fdask
fdask / apiplayer.html
Last active August 29, 2015 14:01
A one page HTML/JS app to test API endpoints. Saves data to cookies or is.gd shortlinks.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>API Player</title>
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
<style>
textarea {
width: 500px;
height: 300px;
@fdask
fdask / gist:8939261
Created February 11, 2014 17:07
PHP - Sort multi-dimensional array by value
// call this
usort($myArray, function($a, $b) {
return $a['order'] - $b['order'];
});
// ends up sorting in reverse order, or
$myArray = array_reverse($myArray);