Skip to content

Instantly share code, notes, and snippets.

@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active May 11, 2024 17:43
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@ericallam
ericallam / RotateKeynoteDocumentDroplet
Created July 31, 2014 11:12
Rotate Keynote Document for use as an app Prototype
// Open Script Editor and Export this as an Application
//
// Then drop a keynote file on it in the Finder and it will properly resize
// and rotate everything so the Keynote file becomes usable as a prototype
// in the iPhone keynote app
// rotateDocument exported function
//
// Accepts a Keynote document and will rotate
// all the slides and elements in the slide 90 degrees
@P7h
P7h / jdk_download.sh
Last active May 5, 2025 10:36
Script to download JDK / JRE / Java binaries from Oracle website from terminal / shell / command line / command prompt
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget.
### You can download all the binaries one-shot by just giving the BASE_URL.
### Script might be useful if you need Oracle JDK on Amazon EC2 env.
### Script is updated for every JDK release.
### Features:-
# 1. Resumes a broken / interrupted [previous] download, if any.
# 2. Renames the file to a proper name with including platform info.
@MotionDesignStudio
MotionDesignStudio / ascii_movie_image_ver_1.py
Last active January 23, 2025 08:37
Python ASCII Video And ASCII Image Creator
#!/usr/bin/env python
import sys
import cv2
import subprocess
from subprocess import call
import aalib
import Image
@sofish
sofish / shift.js
Created August 5, 2013 13:34
顺延执行: 顺延函数:如果上一个动作完成,则当前动作替换上一个 (如自动完成插件的远程获取)
// 顺延函数:如果上一个动作完成,则当前动作替换上一个
function shift(fn, time) {
time = time || 50;
var queue = this._shift_fn, current;
queue ? queue.concat([fn, time]) : (queue = [[fn, time]]);
current = queue.pop();
clearTimeout(this._shift_timeout);
this._shift_timeout = setTimeout(function() {
[
{
name:"HTML5",
uri:"http://www.w3.org/TR/html5/single-page.html",
category:"markup"
},
{
name:"HTML 5.1",
uri:"http://www.w3.org/TR/html51/single-page.html",
category:"markup"
@kaiserama
kaiserama / DataTables.py
Last active March 16, 2022 14:52
Jquery DataTables class implementation in Flask with MySQL. There was an example of using DataTables with MongoDB + Flask, but nothing for using MySQL + Flask. Be sure you install Flask-MySQL extension first!
from MySQLdb import cursors
from flask import request
class DataTablesServer(object):
def __init__( self, request, columns, index, table, cursor):
self.columns = columns
self.index = index
self.table = table
# values specified by the datatable for filtering, sorting, paging
@yu-lu
yu-lu / LuYU426.Games.Snake.py
Last active December 15, 2015 01:39
This is a 99 lines snake game written upon IronPython. This simple game is tested with both MacOS and Windows, code is slightly different, see comment inline. This is intended to fit in 99 lines, so code is neither well formatted nor well read, please don't blame me on this :P
import os, time, random
from collections import defaultdict
from System import Console, ConsoleColor, ConsoleKey
from System.Threading import Thread, ThreadStart
class Screen(object):
red = ConsoleColor.Red; green = ConsoleColor.Green; blue = ConsoleColor.Blue;black = ConsoleColor.Black
dimension = (21,39)
def __update_input(self):
mapping = defaultdict(lambda: None,