Skip to content

Instantly share code, notes, and snippets.

View blacksector's full-sized avatar

Omar Quazi blacksector

View GitHub Profile
@supermamon
supermamon / require-example.js
Last active January 10, 2022 19:41
port of node's `require` for Scriptable.app
const require = importModule('scriptable-require')
const moment = await require('moment', true)
log(moment().format('dddd'))
// These three lines demonstrate how this code works.
let img = await Photos.fromLibrary()
let newImg = await processImage(img)
QuickLook.present(newImg)
// This function takes an image and returns a processed image.
async function processImage(image) {
const imageId = "imageId"
const canvasId = "canvasId"
@simonw
simonw / redis-docker-for-mac.md
Last active August 11, 2022 16:10
How to run a redis server using Docker-for-Mac

How to run a redis server using Docker-for-Mac

This will work with other flavours of Docker as well.

Run the following command:

docker run --name my-redis -p 6379:6379 --restart always --detach redis

This will download and run redis, set to auto-restart when your machine starts and bound to port 6379 on your machine.

@aunyks
aunyks / snakecoin-server-full-code.py
Last active March 8, 2024 19:22
The code in this gist isn't as succinct as I'd like it to be. Please bare with me and ask plenty of questions that you may have about it.
from flask import Flask
from flask import request
import json
import requests
import hashlib as hasher
import datetime as date
node = Flask(__name__)
# Define what a Snakecoin block is
class Block:
@bugraoral
bugraoral / Contact.java
Created May 10, 2016 07:13
Loading contacts with thumbnail images faster. Normally, with any loader fetching 500 contacts with images can take up to 3 seconds. With this task you can load them in ~500ms.
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.IntDef;
import android.text.TextUtils;
import java.io.Serializable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
public class Contact {
@ykessler
ykessler / timezones
Created August 14, 2012 14:50
JSON list of time zones (Based on Olson tz database)
[
{"group":"US (Common)",
"zones":[
{"value":"America/Puerto_Rico","name":"Puerto Rico (Atlantic)"},
{"value":"America/New_York","name":"New York (Eastern)"},
{"value":"America/Chicago","name":"Chicago (Central)"},
{"value":"America/Denver","name":"Denver (Mountain)"},
{"value":"America/Phoenix","name":"Phoenix (MST)"},
{"value":"America/Los_Angeles","name":"Los Angeles (Pacific)"},
{"value":"America/Anchorage","name":"Anchorage (Alaska)"},