Skip to content

Instantly share code, notes, and snippets.

View dbolkensteyn's full-sized avatar

Dinesh Bolkensteyn dbolkensteyn

View GitHub Profile
@verigak
verigak / amplify.py
Created October 30, 2017 13:16
Git delta amplification
#!/usr/bin/env python3
import hashlib
import os
import struct
import sys
import zlib
def blob_id(blob):
@guitarrapc
guitarrapc / ComputeGithubWebhookSha1WithSecret.cs
Last active July 15, 2020 22:27
Compute Github Webhook SHA1 from github secret for PowerShell / C#.
var target = "YOUR GITHUB WEBHOOK JSON";
var key = "GITHUB WEBHOOK SECRET";
var data = System.Text.Encoding.UTF8.GetBytes(target);
var keyData = System.Text.Encoding.UTF8.GetBytes(key);
using (var hmac = new System.Security.Cryptography.HMACSHA1(keyData))
{
var bs = hmac.ComputeHash(data);
var sha1 = System.BitConverter.ToString(bs).ToLower().Replace("-","");
Console.WriteLine($"YOUR WEBHOOK JSON HASH (SHA1) is : {sha1}");
@rethink-imcmahon
rethink-imcmahon / ros_image_saver.py
Last active April 17, 2024 08:09
ROS Image Subscriber / JPEG Saver
#! /usr/bin/python
# Copyright (c) 2015, Rethink Robotics, Inc.
# Using this CvBridge Tutorial for converting
# ROS images to OpenCV2 images
# http://wiki.ros.org/cv_bridge/Tutorials/ConvertingBetweenROSImagesAndOpenCVImagesPython
# Using this OpenCV2 tutorial for saving Images:
# http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_image_display/py_image_display.html
@domenic
domenic / 0-github-actions.md
Last active April 8, 2024 23:35
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@caarmen
caarmen / ramdisk.md
Last active June 10, 2022 14:49
Create a 1G case-sensitive ram disk on Mac OS
@jboner
jboner / latency.txt
Last active May 22, 2024 22:32
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD