function encryptor($action, $string) {
$output = false;
$encrypt_method = "AES-256-CBC";
//pls set your unique hashing key
$secret_key = 'dj7oiop1mkdp251EnCrIt4QKq4988w6a';
$secret_iv = 'oeuGJW0cBI4ye998Z7435sj9EkGnDD34';
// hash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function translateError(msg) { | |
| var newErr = new Error(msg); // placed here to get correct stack | |
| return e => { | |
| newErr.originalError = e; | |
| throw newErr; | |
| } | |
| } | |
| async function asyncTask() { | |
| const user = await UserModel.findById(1).catch(translateError('No user found')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.springframework.http.HttpMethod | |
| import org.springframework.http.HttpStatus | |
| import org.springframework.stereotype.Component | |
| import org.springframework.web.server.ServerWebExchange | |
| import org.springframework.web.server.WebFilter | |
| import org.springframework.web.server.WebFilterChain | |
| import reactor.core.publisher.Mono | |
| @Component | |
| class CorsFilter : WebFilter { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Copyright 2016 Hartmut Armbruster <info@hartmut.co.uk> | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### AppleScript to shutdown / halt QNAP NAS | |
| # requires pub-key access to QNAP setup for current user... | |
| # [https://wiki.qnap.com/wiki/SSH:_How_To_Set_Up_Authorized_Keys] | |
| tell application "Terminal" | |
| set currentTab to do script ("ssh qnap halt;") | |
| end tell | |
| # Note: Using Mac OS 'Automator' it's easy to create a QHalt.app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div class="pagination"> | |
| <div class="inner"> | |
| <template v-if="showPrev"> | |
| <nuxt-link v-if="prev" :to="routeToPage(prev)" class="page previous">Previous</nuxt-link> | |
| <span v-else class="page previous disabled">Previous</span> | |
| </template> | |
| <template v-for="it in prevPages"> | |
| <nuxt-link v-if="it !== -1" :key="it" :to="routeToPage(it)" class="page">{{ it }}</nuxt-link> | |
| <span v-else :key="it" class="page more">...</span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ### Script to wakeup QNAP NAS (well not much script there.. mostly to use via Automator) | |
| # requires 'wakeonlan' (installed via Homebrew -> 'brew install wakeonlan') | |
| /usr/local/bin/wakeonlan {{NAS_MAC1}} | |
| ### optional: 2nd eth adapter.. | |
| #/usr/local/bin/wakeonlan {{NAS_MAC2}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class KMP: | |
| def partial(self, pattern): | |
| """ Calculate partial match table: String -> [Int]""" | |
| ret = [0] | |
| for i in range(1, len(pattern)): | |
| j = ret[i - 1] | |
| while j > 0 and pattern[j] != pattern[i]: | |
| j = ret[j - 1] | |
| ret.append(j + 1 if pattern[j] == pattern[i] else j) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Upload your files</title> | |
| </head> | |
| <body> | |
| <form enctype="multipart/form-data" action="upload.php" method="POST"> | |
| <p>Upload your file</p> | |
| <input type="file" name="uploaded_file"></input><br /> | |
| <input type="submit" value="Upload"></input> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python2 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| USAGE: | |
| morphagene_ableton.py -w <inputwavfile> -l <inputlabels> -o <outputfile>' | |
| Instructions in Ableton: | |
| Insert locators as splice markers in your project (Create > Add Locator) | |
| Export Audio/Video with | |
| Sample Rate: 48000 Hz |