Skip to content

Instantly share code, notes, and snippets.

@yoghi
yoghi / gist:4277504
Created December 13, 2012 16:10
RestKit connect to rest service behind basic autentication
NSString *url = @"http://rest.local/test";
NSURL *baseURL = [NSURL URLWithString:url];
AFHTTPClient* client = [[AFHTTPClient alloc] initWithBaseURL:baseURL];
[client setAuthorizationHeaderWithUsername:@"demo" password:@"demo"];
[client setDefaultHeader:@"Accept" value:RKMIMETypeJSON];
#!/usr/bin/env php
<?php
/**
* Generates a naturally sortable UUID in a distributed environment.
* UUID's are 120-bit represented in base62 as 20 in length and are composed of:
* - a time stamp in microseconds (from 1970-01-01 until 3180-01-01; ~1,200 years if using a custom epoch)
* - the machine's MAC address
* - the running process' id
*/
class UniqueId {
@yoghi
yoghi / osx-for-hackers.sh
Created January 8, 2016 22:46 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
Verifying that +stefanotamagnini is my blockchain ID. https://onename.com/stefanotamagnini
#!/bin/sh
git shortlog -sn | cut -f2 | sort --ignore-case > CONTRIBUTORS
@yoghi
yoghi / OverEncrypt.md
Last active December 16, 2016 16:17 — forked from mapmeld/OverEncrypt.md
OverEncrypt - paranoid HTTPS

OverEncrypt

This is a guide that I wrote to improve the default security of my website https://fortran.io , which has a certificate from LetsEncrypt. I'm choosing to improve HTTPS security and transparency without consideration for legacy browser support.

WARNING: if you mess up settings, lose your certificates, or decide to no longer maintain HTTPS certs, these steps can and will make your domain inaccessible.

I would recommend these steps only if you have a specific need for information security, privacy, and trust with your users, and/or maintain a separate secure.example.com domain which won't mess up your main site. If you've been thinking about hosting a site on Tor, then this might be a good option, too.

The best resources that I've found for explaining these steps are https://https.cio.gov , https://certificate-transparency.org , and https://twitter.com/konklone

@yoghi
yoghi / trim_pfsense2.2.4.md
Created October 18, 2017 22:21 — forked from mdouchement/trim_pfsense2.2.4.md
Enable TRIM on pfsense 2.2.4

Installation

Use memstick-licecd to install pfsense on your SSD.

Enable TRIM

  • Initialize fstab:
[2.2.4-RELEASE][[email protected]]/root: /usr/local/sbin/ufslabels.sh

It may do nothing because all is already initialize but it's only in a case of

@yoghi
yoghi / vpn.md
Created February 14, 2018 08:38 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

(A Russian translation of this article can be found here, contributed by Timur Demin.)

Why not?

=============== MYSQL/MARIADB ===============
#!/bin/bash
echo "Waiting for mysql"
until mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" &> /dev/null
do
printf "."
sleep 1
done
@yoghi
yoghi / download-frozen-image-v2-custom.sh
Created July 27, 2018 10:58
Download docker images without docker
#!/usr/bin/env bash
set -eo pipefail
# hello-world latest ef872312fe1b 3 months ago 910 B
# hello-world latest ef872312fe1bbc5e05aae626791a47ee9b032efa8f3bda39cc0be7b56bfe59b9 3 months ago 910 B
# debian latest f6fab3b798be 10 weeks ago 85.1 MB
# debian latest f6fab3b798be3174f45aa1eb731f8182705555f89c9026d8c1ef230cbf8301dd 10 weeks ago 85.1 MB
if ! command -v curl &> /dev/null; then
echo >&2 'error: "curl" not found!'