Skip to content

Instantly share code, notes, and snippets.

View lionello's full-sized avatar
🇭🇰

Lio李歐 lionello

🇭🇰
View GitHub Profile
@carlgieringer
carlgieringer / integration-request.vtl
Last active June 14, 2022 05:30
AWS API Gateway Integration Request Lambda Proxy (LAMBDA_PROXY) Velocity Template Language (VTL)
## MIT License
##
## Copyright (c) 2017 Carl Gieringer
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
@joepie91
joepie91 / .md
Last active March 13, 2024 18:47
A *complete* listing of operators in Nix, and their predence.

Lower precedence means a stronger binding; ie. this list is sorted from strongest to weakest binding, and in the case of equal precedence between two operators, the associativity decides the binding.

Prec Abbreviation Example Assoc Description
1 SELECT e . attrpath [or def] none Select attribute denoted by the attribute path attrpath from set e. (An attribute path is a dot-separated list of attribute names.) If the attribute doesn’t exist, return default if provided, otherwise abort evaluation.
2 APP e1 e2 left Call function e1 with argument e2.
3 NEG -e none Numeric negation.
4 HAS_ATTR e ? attrpath none Test whether set e contains the attribute denoted by attrpath; return true or false.
5 CONCAT e1 ++ e2 right List concatenation.
6 MUL e1 * e2 le
@kilink
kilink / OkHttpCompletableFuture.kt
Created February 11, 2017 07:26
OkHttp Java 8 CompletableFuture extension method
import okhttp3.Call
import okhttp3.Callback
import okhttp3.Response
import java.io.IOException
import java.util.concurrent.CompletableFuture
fun Call.executeAsync(): CompletableFuture<Response> {
val future = CompletableFuture<Response>()
enqueue(object : Callback {
override fun onResponse(call: Call, response: Response) {
@paperdigits
paperdigits / default.nix
Created January 10, 2017 06:15
nix-shell environment for middleman
# nix-shell -p bundler bundix
# bundler lock && bundler package --path vendor/cache --no-install && bundix && exit
# nix-shell
with (import <nixpkgs> {});
let
env = bundlerEnv {
name = "test-package";
inherit ruby;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
#include <SoftwareSerial.h>
#include <Wire.h>
#include <SparkFunHTU21D.h>
#include<stdlib.h>
#include "DHT.h"
#define SSID "XinCheJian"//your network name
@ArthurYidi
ArthurYidi / translatekeycodes.swift
Created April 6, 2016 02:57
virtual key codes to unicode characters
func keyCodeToString(keyCode: CGKeyCode) -> String {
let curKeyboard = TISCopyCurrentKeyboardInputSource().takeRetainedValue()
let ptr = TISGetInputSourceProperty(curKeyboard, kTISPropertyUnicodeKeyLayoutData)
let keyboardLayoutPtr = UnsafePointer<UCKeyboardLayout>(ptr)
var deadKeyState: UInt32 = 0
var actualStringLength = 0
var unicodeString = [UniChar](count: 255, repeatedValue: 0)
let status = UCKeyTranslate(keyboardLayoutPtr,
@madhikarma
madhikarma / build_framework.sh
Created October 13, 2015 12:26
Script to build a framework for multiple architectures
# Merge Script
# http://code.hootsuite.com/an-introduction-to-creating-and-distributing-embedded-frameworks-in-ios/
# 1
# Set bash script to exit immediately if any commands fail.
set -e
# 2
# Setup some constants for use later on.
@colinvh
colinvh / aws.md
Last active April 23, 2024 09:15
AWS Region Names

Alternative naming schemes for AWS regions

Purpose

The intent is to define terse, standards-supported names for AWS regions.

Schemes

@neilco
neilco / RSASHA1.swift
Created April 27, 2015 09:07
RSA-SHA1 signing with a PKCS#12 private key
//
// RSASHA1.swift
//
// Copyright (c) 2015 Neil Cowburn. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@woutgg
woutgg / dhcp
Created March 6, 2014 21:09
openwrt ap+sta configuration
config dnsmasq
option domainneeded '1'
option boguspriv '1'
option filterwin2k '0'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'