Skip to content

Instantly share code, notes, and snippets.

View watersb's full-sized avatar

Boyd Waters watersb

  • 35.9,-106.3
  • 13:44 (UTC -07:00)
View GitHub Profile
@tvwerkhoven
tvwerkhoven / dedupe.sh
Last active September 4, 2024 08:50
De-duplicate using APFS clonefile(2) and jdupes in zsh
#!/usr/bin/env zsh
#
# # About
#
# Since APFS supports de-duplication on block-level, it can be useful to
# manually de-duplicate your files if you've migrated/upgrade to APFS not
# using a fresh install.
#
# I've written this simple script with the aim to:
# - Be simple, easy to read and understand (for users to check)
@hishma
hishma / CLLocation+Encodable.swift
Created January 16, 2019 23:57
CoreLocation and Codable
extension CLLocation: Encodable {
public enum CodingKeys: String, CodingKey {
case latitude
case longitude
case altitude
case horizontalAccuracy
case verticalAccuracy
case speed
case course
case timestamp
@charliememory
charliememory / pdm.py
Last active December 19, 2020 14:20
Tensorflow implement of Point Distribution Model && coord2channel function in CVPR 2018 paper "Natural and effective obfuscation by head inpainting"
#################### Point Distribution Model #####################
## ref to OpenFace PDM model https://github.com/TadasBaltrusaitis/OpenFace/tree/79d7116dae7f6b5335016dcb0e9ea64e1f931287/model_training/pdm_generation
def tf_Euler2Rot(euler):
batch_size = euler.get_shape().as_list()[0]
rx, ry, rz = tf.split(euler, 3, axis=1)
Rx_0 = tf.cast(tf.tile(tf.expand_dims([1.0, 0.0, 0.0],0), [batch_size,1]), tf.float64)
Rx_1 = tf.concat([tf.zeros_like(rx, tf.float64), tf.cos(rx), -tf.sin(rx)], axis=1)
Rx_2 = tf.concat([tf.zeros_like(rx, tf.float64), tf.sin(rx), tf.cos(rx)], axis=1)
Rx = tf.concat([tf.expand_dims(Rx_0,1), tf.expand_dims(Rx_1,1), tf.expand_dims(Rx_2,1)], axis=1)
@miniupnp
miniupnp / spectre.c
Last active September 1, 2018 05:11 — forked from jedisct1/spectre.c
Spectre example code - x86 / x86_64 and PowerPC
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#if defined(__POWERPC__)
#include <ppc_intrinsics.h>
#else
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
@miracles1315
miracles1315 / New-CodeSigningCertificate.ps1
Last active December 20, 2018 11:04
This script creates a self-signed code signing certificate that can be used for testing purposes to to sign scripts.
<#
.SYNOPSIS
This script creates a self-signed certificate, exports it, and re-imports it into the Trusted Root Certification Authorities store.
.DESCRIPTION
This script creates a self-signed code signing certificate, valid for one year from the date/time created, that can be used for testing purposes to sign scripts. After the certificate is created, the issuer is untrusted. So, the script then exports the certificate into a .cer file and re-imports it into the Trusted Root Certification Authorities store for the current user (i.e. Cert:\CurrentUser\Root).
.PARAMETER DnsName
Specify one, or more, DNS names to put into the subject alternative name (SAN) extension of the certificate. The first DNS name is also saved as the subject name, issuer name (i.e. Issued By), and common name (i.e. Issued To). Default is the local computer name (i.e. $Env:ComputerName). This parameter has aliases of SubjectAlternativeName and SAN.
@WebReflection
WebReflection / csp
Last active November 11, 2020 00:08
Generates the right sha1 and sha256 for Content Security Policy aware scripts
#!/usr/bin/env bash
echo ''
if [ "$1" = "" ]; then
echo 'csp sha1 and sha256 generatoor'
echo 'csp "code"'
echo 'csp /file-name'
else
if [ -f "$1" ]; then
CONTENT=$(cat $1)