Skip to content

Instantly share code, notes, and snippets.

View slow-is-fast's full-sized avatar

slow-is-fast slow-is-fast

View GitHub Profile
@slow-is-fast
slow-is-fast / ArcUtils.java
Created July 10, 2020 02:44 — forked from Takhion/ArcUtils.java
Collection of methods to achieve better circular arc drawing, as Canvas.drawArc() is unreliable. See the related article: https://medium.com/p/9155f49166b8
/**
* ArcUtils.java
*
* Copyright (c) 2014 BioWink GmbH.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@slow-is-fast
slow-is-fast / osx_install.sh
Created October 18, 2019 02:57 — forked from canering/osx_install.sh
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@slow-is-fast
slow-is-fast / gist:b3d6fba9218d36e318d116836035bb5f
Created April 26, 2019 00:48 — forked from andphe/gist:3232343
Export your links from Safari reading list
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'
function removeEmoji($text)
{
$cleanText = "";
// Match Emoticons
$regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u';
$cleanText = preg_replace($regexEmoticons, '', $text);
// Match Miscellaneous Symbols and Pictographs
$regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u';
@slow-is-fast
slow-is-fast / __upload_file.md
Created August 16, 2018 09:58 — forked from maxivak/__upload_file.md
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.


// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");;
@slow-is-fast
slow-is-fast / MultiPartFromStrings.php
Created August 16, 2018 09:58 — forked from iansltx/MultiPartFromStrings.php
Multipart file uploads in PHP from strings
<?php
/**
* PHP's curl extension won't let you pass in strings as multipart file upload bodies; you
* have to direct it at an existing file (either with deprecated @ syntax or the CURLFile
* type). You can use php://temp to get around this for one file, but if you want to upload
* multiple files then you've got a bit more work.
*
* This function manually constructs the multipart request body from strings and injects it
* into the supplied curl handle, with no need to touch the file system.
@slow-is-fast
slow-is-fast / redis_key_sizes.sh
Last active December 20, 2017 02:46 — forked from epicserve/redis_key_sizes.sh
A simple script to print the size of all your Redis keys. #redis
#!/usr/bin/env bash
# This script prints out all of your Redis keys and their size in a human readable format
# Copyright 2013 Brent O'Connor
# License: http://www.apache.org/licenses/LICENSE-2.0
human_size() {
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } '
}
@slow-is-fast
slow-is-fast / pg-running-queries.sql
Created November 22, 2017 08:40 — forked from JoshuaGross/pg-running-queries.sql
List running queries in PostGres
select * from pg_stat_activity;
@slow-is-fast
slow-is-fast / webdev_tools.md
Created November 14, 2016 10:20 — forked from ctkjose/webdev_tools.md
Web Development Tools
@slow-is-fast
slow-is-fast / gist:e0581ccb10af9d606f4838261b152d52
Created November 14, 2016 10:19 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat