Skip to content

Instantly share code, notes, and snippets.

@petez69
petez69 / adam6050.py
Last active October 23, 2021 11:53 — forked from hdo/adam6050.py
Emulate Advantech ADAM-6050 for Synology Surveillance Station
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import time
import RPi.GPIO as GPIO
#import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
for x in range(2, 7):
GPIO.setup(x, GPIO.OUT)
@mosluce
mosluce / NSObject.swift
Last active March 1, 2020 11:51
超惰性 extension 大全 + 默司微調
//
// NSObject.swift
// QBDemo01
//
// Created by 默司 on 2016/12/2.
// Copyright © 2016年 默司. All rights reserved.
//
import Foundation
@rtfpessoa
rtfpessoa / openvpn-client-key-gen.sh
Last active April 16, 2022 19:25
OpenVPN Client Key Generator
#!/bin/bash
#
# OpenVPN Client Key Generation Script
#
# Author: rtfpessoa
# Date: 03-09-2016
#
# Based on the guide:
# * https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-16-04
@crittermike
crittermike / xdebug_alpine.md
Last active October 1, 2020 12:49
Xdebug + PHPStorm for PHP 7 on Alpine Linux

First, install the Xdebug package from the testing repository.

$ apk add php7-xdebug --repository http://dl-3.alpinelinux.org/alpine/edge/testing/

Now edit the /etc/php7/php.ini file and add the following to the end of it:

zend_extension=/usr/lib/php7/modules/xdebug.so
#!/bin/bash
# This script will check an IPA and determine if the specified UDID is in the embedded provisioning profile
IPA=$1
UDID=$2
if [ $# -eq "1" ]
then
echo "Please specify a UDID to check for."
@lifuzu
lifuzu / unlock_keychain.sh
Created May 11, 2016 23:59
Unlock keychain for longer time
KEYCHAIN="/Users/jenkins/Library/Keychains/login.keychain"
echo "Unlock keychain"
security unlock-keychain -p secure $KEYCHAIN
echo "Increase keychain unlock timeout"
security set-keychain-settings -lut 7200 $KEYCHAIN
echo "Add keychain to keychain-list"
security list-keychains -s $KEYCHAIN
@polbins
polbins / README.md
Last active June 20, 2022 02:50
Android Studio as default Git Diff Tool

Create Android Studio Command-line Launcher

  1. Open Android Studio
  2. Go to: Tools > Create Command-line Launcher
  3. Leave as default, Press OK

Configure Git to use Android Studio as default Diff Tool

  1. Add the following lines to your .gitconfig
@mreschke
mreschke / nginx.conf
Last active February 18, 2024 04:41
Nginx config for multiple laravel sites based on /api/v1 url paths
# This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2...
# This also works perfectly for all static file content in all projects
# This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config.
# Example:
# http://example.com - Main Laravel site as usual
# http://example.com/about - Main Laravel site about page as usual
# http://example.com/robots.txt - Main Laravel site static content as usual
# http://example.com/api/v1 - Lumen v1 api default / route
# http://example.com/api/v1/ - Lumen v1 api default / route
@nickfrey
nickfrey / WFSimulate3DTouchPreview.m
Created September 22, 2015 20:13
Test 3D Touch peek/pop using private APIs
@interface UIPreviewForceInteractionProgress : NSObject
- (void)endInteraction:(BOOL)arg1;
@end
@interface UIPreviewInteractionController : NSObject
@property (nonatomic, readonly) UIPreviewForceInteractionProgress *interactionProgressForPresentation;
@fullybaked
fullybaked / usort.php
Created September 1, 2015 12:05
Usort with PHP7 Spaceship vs PHP5.6
<?php
// PHP 5.6
usort($array, function($a, $b) {
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
});