Skip to content

Instantly share code, notes, and snippets.

@spoonyfork
spoonyfork / tumblr-likes-downloader.py
Last active June 22, 2020 08:27 — forked from jeffaudi/tumblr-likes-downloader.py
Instructions in the comments. This python script downloads all the photos liked of your tumblr account. This is usually more useful than downloading the photos from a specfic blog. Updated to also download videos and store content is folders. Please, note that currently the Tumblr API only returns the first 1000 likes (https://groups.google.com/…
import pytumblr
import os
import code
import oauth2 as oauth
from pprint import pprint
import json
import urllib.request
import codecs
import sys
@dalexsoto
dalexsoto / HttpClientProgressExtensions.cs
Last active February 25, 2026 17:56
Add Progress reporting to capabilities to HttpClient
using System;
using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace HttpClientProgress {
public static class HttpClientProgressExtensions {
public static async Task DownloadDataAsync (this HttpClient client, string requestUrl, Stream destination, IProgress<float> progress = null, CancellationToken cancellationToken = default (CancellationToken))
{
@julesx
julesx / AndroidDocumentViewer.cs
Last active October 4, 2018 07:43
Xamarin Forms file opener
using Android.Content;
using Mobile.Core.Droid.NativeImplementations;
using Mobile.Core.Interfaces;
using Xamarin.Forms;
[assembly: Xamarin.Forms.Dependency(typeof(DocumentViewer))]
namespace Mobile.Core.Droid.NativeImplementations
{
public class DocumentViewer : IDocumentViewer
{
@eruffaldi
eruffaldi / sharedmemory.hpp
Created March 6, 2017 12:54
Cross Platform Shared Memory and Mutex (alternative to using boost/interprocess
/**
* Emanuele Ruffaldi 2009-2015
*
* C++ Shared Memory Class Cross Platform
*
* Windows: files and named shared memories + named mutex
* Linux: N/A
* OSX: N/A
*
*/
public interface IMaybe<T>
{
IMaybe<U> Map<U>(Func<T, U> func);
IMaybe<U> Bind<U>(Func<T, IMaybe<U>> func);
IMaybe<T> Filter(Func<T, bool> predicate);
IMaybe<T> Do(Action<T> just, Action nothing);
IMaybe<U> Do(Func<T, U> just, Action<U> nothing);
}
class Just<T> : IMaybe<T>
@tommyready
tommyready / NetworkAdaptersUtility.cs
Last active April 18, 2024 15:01
Using C# to Disable and Enable a Network Adapter
using System;
using System.Diagnostics;
using System.Threading.Tasks;
namespace NetworkAdaptersUtility
{
class Program
{
static void Main(string[] args)
{
@define-private-public
define-private-public / HttpServer.cs
Last active February 17, 2026 09:04
A Simple HTTP server in C#
// Filename: HttpServer.cs
// Author: Benjamin N. Summerton <define-private-public>
// License: Unlicense (http://unlicense.org/)
using System;
using System.IO;
using System.Text;
using System.Net;
using System.Threading.Tasks;
@JonathanPorta
JonathanPorta / dd-examples.md
Last active June 1, 2025 15:30
DD Backup, Compress, and Restore

Backup/Image

Make sure the if value is correct! If doing this over SSH then open a TMUX session first... or else...

dd if=/dev/YOUR-DEVICE conv=sync,noerror bs=64K | gzip -c  > /home/portaj/macbook.img.gz

NOTE: You might not want to compress the image. It just means you have to uncompress it later to mount it. If you're planning to access the data soon, or frequently, don't compress it.

Saving a copy of the drive geometry

Save it in the same directory as the compressed image so later on if you decide you want to mount or extract data from the image you can see the partition structure without having to decompress the whole image. There might be some other ways to mount a compressed image.

@caverna
caverna / StringExtension.cs
Last active August 1, 2017 14:36
General 'String 2 Value' conversion
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
[DebuggerStepThrough]
public static class StringExtensions
{
public static T To<T>(this string text)
{
@r-lyeh-archived
r-lyeh-archived / gc.cpp
Last active September 24, 2024 15:10
C++ Garbage Collection
/*/
C++ Garbage Collection Library
==============================
This is a library to manage memory in C++ programs using a garbage
collector. It uses a mark and sweep algorithm.
All objects that are to be managed by the collector should be derived
from GCObject: