Skip to content

Instantly share code, notes, and snippets.

@tanaikech
tanaikech / submit.md
Created September 22, 2021 07:04
Executing Function with Minutes timer in Specific Times using Google Apps Script

Executing Function with Minutes timer in Specific Times using Google Apps Script

This is a sample script for executing a function with the minutes timer in the specific times using Google Apps Script. For example, when this sample script is used, the following situation can be achieved.

  • Execute a function every 10 minutes only in 09:00 - 12:00 and 15:00 - 18:00 for the weekday.

When the above situation is shown as an image, it becomes as follows.

@IAmStoxe
IAmStoxe / loop-json.sh
Last active March 7, 2024 14:00
This example shows you how to utilize jq to loop bash script through an array of JSON values.
jsonData='[{"name": "name#1","value": "value#1"},{"name": "name#2","value": "value#2"}]'
for row in $(echo "${jsonData}" | jq -r '.[] | @base64'); do
_jq() {
echo "${row}" | base64 --decode | jq -r "${1}"
}
# OPTIONAL
# Set each property of the row to a variable
name=$(_jq '.name')
value=$(_jq '.value')
@plindberg
plindberg / README.md
Created August 5, 2017 16:46
How to set up an AWS Lambda function for returning S3 pre-signed URLs for uploading files.

README

Granted, this is little more than an obfuscated way of having a publicly writable S3 bucket, but if you don’t have a server which can pre-sign URLs for you, this might be an acceptable solution.

For this to work, you take the following steps:

  1. Create a Lambda func, along with a new IAM role, keeping the default code.
  2. Create an API in the API Gateway.

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

@em-piguet
em-piguet / wp_changeLoginUrl.php
Last active May 3, 2022 22:06 — forked from tazeverywhere/wp_changeLoginUrl.php
WP - change login/admin URL
<?php
//////////////////////
// SECURE WP_ADMIN //
//////////////////////
// ---- 1. edit wp-config.php
/* tells wordpress what the new directory is, and updates the cookie path.
define( 'WP_ADMIN_DIR', 'manager' );
define( 'ADMIN_COOKIE_PATH', '/' );
*/
@daurnimator
daurnimator / webrtc.js
Last active November 7, 2023 07:10
Playing with WebAudio and WebRTC
// Browser compat
window.AudioContext = window.AudioContext || window.webkitAudioContext;
window.RTCPeerConnection = window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection;
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
var key = window.location.hash.substring(1);
var audio_context = new AudioContext();
var local_output = audio_context.createMediaStreamDestination();
@christianberg
christianberg / create-docker-droplet.sh
Last active April 14, 2024 17:25
Shell script to create a Digital Ocean Droplet and install docker
#!/bin/bash
set -e
SECRETFILE=~/.digitalocean
if [[ -z $DIGOCEAN_ID ]] || [[ -z $DIGOCEAN_KEY ]]; then
if [ -e $SECRETFILE ]; then
. $SECRETFILE
fi
fi