Skip to content

Instantly share code, notes, and snippets.

@uemuraj
uemuraj / aws-route53-change-resource-record-sets.sh
Last active April 24, 2019 23:07
aws route53 change-resource-record-sets をラップする簡単なシェルスクリプト
#!/bin/bash
DOMAIN=$1
ZONE_ID=$(aws route53 list-hosted-zones-by-name --dns-name ${DOMAIN:?} --output text | grep -o -P "/hostedzone/[A-Z0-9]+")
CHANGE_ID=$(aws route53 change-resource-record-sets --hosted-zone-id ${ZONE_ID:?} --change-batch file:///dev/stdin --output text | grep -o -P "/change/[A-Z0-9]+")
if [ -z $CHANGE_ID ]; then
exit 1
fi
@dexterlabora
dexterlabora / Code.gs
Last active April 8, 2024 19:46
Meraki Webooks Demo with Google Sheets
/*
Copy this function over the existing Code.gs file in a Google Sheet
Save the Sheet/Script
Publish App
- Execute as You
- Avaiable to Anyone (including anonymous)
Authorize App when prompted
The URL will act as the Webhook URL for Meraki to send alerts
*/
@29satnam
29satnam / SSLPinningSwift3.swift
Created September 9, 2017 10:18
SSL Pinning Swift 3
// Step 1: class ViewController: ..... URLSessionDelegate, URLSessionTaskDelegate
// Step 2: Usage
if let url = NSURL(string: "https://example.com") {
let session = URLSession(
configuration: URLSessionConfiguration.ephemeral,
delegate: NSURLSessionPinningDelegate(),
delegateQueue: nil)
@daniel-rueda
daniel-rueda / CertificatePinningURLSessionDelegate.swift
Last active April 5, 2024 05:52
Certificate and Public Key Pinning for URLSession using Swift
// Based on https://code.tutsplus.com/articles/securing-communications-on-ios--cms-28529
import Foundation
import Security
struct Certificate {
let certificate: SecCertificate
let data: Data
}
@Brainiarc7
Brainiarc7 / build-tensorflow-from-source.md
Last active July 29, 2023 21:28
Build Tensorflow from source, for better performance on Ubuntu.

Building Tensorflow from source on Ubuntu 16.04LTS for maximum performance:

TensorFlow is now distributed under an Apache v2 open source license on GitHub.

On Ubuntu 16.04LTS+:

Step 1. Install NVIDIA CUDA:

To use TensorFlow with NVIDIA GPUs, the first step is to install the CUDA Toolkit as shown:

@jesselucas
jesselucas / changroup.go
Last active April 17, 2024 14:33
Simple solution for using a WaitGroup with select{}
package main
import (
"fmt"
"sync"
"time"
)
func main() {
// Create a wait group of any size
@johnbuhay
johnbuhay / Jenkins
Last active September 27, 2021 10:05
Jenkins | Configurations done via init.groovy.d
This file used to name this gist.
@germanviscuso
germanviscuso / sync.sh
Last active November 18, 2021 22:15
Mirror/Sync Github Organization Repos locally
#!/bin/bash
# Clone all org repos (via ssh)
curl -s https://api.github.com/orgs/<organization>/repos?per_page=200 | python -c $'import json, sys, os\nfor repo in json.load(sys.stdin): os.system("git clone " + repo["ssh_url"])'
# Later pull from each repo
back=`pwd`; for d in `find . -type d -name .git` ; do cd "$d/.."; git pull origin; cd $back ; done
@grrywlsn
grrywlsn / coreos-efs-zone-aware
Created October 27, 2016 21:42
Mounting EFS to CoreOS instances with the matching zone DNS endpoint automatically
#cloud-config
write_files:
- path: /etc/conf.d/nfs
permissions: '0644'
content: |
OPTS_RPC_MOUNTD=""
coreos:
units:
- name: rpc-statd.service
command: start
@kandelvijaya
kandelvijaya / PrecisionTimer.swift
Created October 24, 2016 20:41
Precision Timing in iOS/OSX/Swift
//: Playground - noun: a place where code can play
import UIKit
//Most precise time keeper
// for more information on the benchmarks go to www.kandelvijaya.com
func timeBlockWithMach(_ block: () -> Void) -> TimeInterval {
var info = mach_timebase_info()
guard mach_timebase_info(&info) == KERN_SUCCESS else { return -1 }