Skip to content

Instantly share code, notes, and snippets.

http://ardalis.com/feed
http://atrauzzi.blogspot.com/feeds/posts/default
http://bart-sokol.info//rss.xml
http://benfoster.io/blog/feed
http://bitoftech.net/feed
http://blog.devbot.net/feed.xml
http://blog.gaxion.com/feeds/posts/default
http://blog.nuget.org/feeds/atom.xml
http://blog.somewhatabstract.com/feed
http://cecilphillip.com/rss
@kuznero
kuznero / vdi-file-compacting.md
Last active March 22, 2024 22:49
How to compact VirtualBox's VDI file size?

Source: StackOverflow

1. Run defrag in the guest (Windows only)

2. Nullify free space:

With a Linux Guest run this:

sudo dd if=/dev/zero | pv | sudo dd of=/bigemptyfile bs=4096k
sudo rm -rf /bigemptyfile
@navin-mohan
navin-mohan / diff.py
Created August 9, 2016 15:38
Subtracting Two Images - OpenCV Python
import cv2
def diff(img,img1): # returns just the difference of the two images
return cv2.absdiff(img,img1)
def diff_remove_bg(img0,img,img1): # removes the background but requires three images
d1 = diff(img0,img)
d2 = diff(img,img1)
return cv2.bitwise_and(d1,d2)
@DerZyklop
DerZyklop / rotateBase64Image90Degree.js
Created February 3, 2016 10:34
rotateBase64Image90Degree()
function rotateBase64Image90Degree(base64data) {
var canvas = document.getElementById("c");
var ctx = canvas.getContext("2d");
var image = new Image();
image.src = base64data;
image.onload = function() {
canvas.width = image.height;
canvas.height = image.width;
ctx.rotate(90 * Math.PI / 180);
/**
* Lightweight script to convert touch handlers to mouse handlers
* credit: http://stackoverflow.com/a/6141093
*/
(function() {
function touchHandler(e) {
var touches = e.changedTouches;
var first = touches[0];
var type = "";
@HereChen
HereChen / convert-image-to-base64.js
Last active March 29, 2022 11:31
convert image to base64
/**
* version1: convert online image
* @param {String} url
* @param {Function} callback
* @param {String} [outputFormat='image/png']
* @author HaNdTriX
* @example
convertImgToBase64('http://goo.gl/AOxHAL', function(base64Img){
console.log('IMAGE:',base64Img);
})
@adilbaig
adilbaig / git-updater
Last active November 30, 2023 12:49
A bash script to update your git repos in the background. It also pops up a user notification when a repo is synced
#!/bin/bash
# This is required for `notify-send` to work from within a cron.
# http://askubuntu.com/questions/298608/notify-send-doesnt-work-from-crontab/346580#346580
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
# syncAndWink
#
# Syncs all remotely-tracked branches on a git repo passed as first argument ($1). It also pulls any new branches
# and tags attached to the repo.
@DanielSWolf
DanielSWolf / Program.cs
Last active May 2, 2024 18:33
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@Vestride
Vestride / encoding-video.md
Last active April 24, 2024 09:59
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@lewisd32
lewisd32 / iptableflip.sh
Created April 15, 2015 18:20
Snippet of Unbounce script for restarting HAProxy with zero downtime
echo "Flipping tables! (╯°□°)╯︵ ┻━┻"
num_rules=3
real=3 # exposed to the ELB as port 443
test=4 # used to install test certs for domain verification
health=5 # used by the ELB healthcheck
blue_prefix=855
green_prefix=866