Skip to content

Instantly share code, notes, and snippets.

View progress44's full-sized avatar
Drinking coffee

Ani Sinanaj progress44

Drinking coffee
View GitHub Profile
@evgenius
evgenius / onchange.sh
Last active December 15, 2018 22:17 — forked from senko/onchange.sh
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <[email protected]>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)
@amowu
amowu / GetStreamingAssetsPath.cs
Created December 25, 2013 08:24
Get Unity StreamingAssets file path with Android and iOS.
// Put your file to "YOUR_UNITY_PROJ/Assets/StreamingAssets"
// example: "YOUR_UNITY_PROJ/Assets/StreamingAssets/db.bytes"
string dbPath = "";
if (Application.platform == RuntimePlatform.Android)
{
// Android
string oriPath = System.IO.Path.Combine(Application.streamingAssetsPath, "db.bytes");
@glnds
glnds / logstash.conf
Last active December 5, 2019 14:13
Logstash Glassfish server.log config
# Logstash config for Glassfish logs
# Used in combination with slf4j and logback
# Output:
# - application: glassfish
# - type: application or internal
# - categorie: technical or functional
input {
# If running logstash under a different user then check your permission to be sure that

Titanium reminders for boooooooring operations (OSX only)

Android

Generate the keystore

keytool -genkeypair -v -keystore keystore -keyalg RSA -sigalg SHA1withRSA -validity 10000
@lastguest
lastguest / parseStyle.js
Last active October 12, 2016 09:12
Parse Style Runs from HTML string
"use strict";
var test = '<b style="color:#fff; background: red">He<i>ll</i>o </b><u>Wo<i>rld</i></u>';
function parseStyle(text){
// Patterns and temp strings
var tags_rx = /<\s*(\/?\s*[^>]+)(\s+[^>]+)?\s*>/gm,
css_rx = /([\w-]+\s*:\s*[^\n;"']+)/gm,
partial, tag, css, temp_style;
@gtramontina
gtramontina / mac-functions
Created September 4, 2014 06:59
brew_cask_install
brew_cask_install() {
if ! brew_cask_is_installed "$1"; then
brew cask install "$@"
fi
}
brew_cask_is_installed() {
local NAME=$(brew_cask_expand_alias "$1")
brew cask list -1 | grep -Fqx "$NAME"
}
@aaronabentheuer
aaronabentheuer / Implementing Rounded Corners in iOS
Created September 15, 2014 12:00
Screens are Rounded Rectangles.
// AppDelegate.swift
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var activeCornerRadius : Int = 6
var incativeCornerRadius : Int = 0
@kopiro
kopiro / leap-xbox-rumble.js
Created December 10, 2014 08:43
Control XBOX controller vibration with LEAP motion
var Leap = require('leapjs');
var XboxController = require('xbox-controller');
var xbox = new XboxController;
Leap.loop(function (frame) {
if (frame.hands.length === 0) {
xbox.rumble(0, 0);
return;
}
frame.hands.forEach(function(hand) {
@rmondello
rmondello / gist:b933231b1fcc83a7db0b
Last active April 20, 2026 18:39
Exporting (iCloud) Keychain and Safari credentials to a CSV file

Exporting (iCloud) Keychain and Safari credentials to a CSV file

Update (October 2021)

Exporting password + one-time code data from iCloud Keychain is now officially supported in macOS Monterey and Safari 15 (for Monterey, Big Sur, and Catalina). You can access it in the Password Manager’s “gear” icon (System Preferences > Passwords on Monterey, and Safari > Passwords everywhere else), or via the File > Export > Passwords... menu item). You shouldn't need to hack up your own exporter anymore.

Original, Obsolete Content (2014)

After my dad died, I wanted to be able to have access any of his online accounts going forward. My dad was a Safari user and used iCloud Keychain to sync his credentials across his devices. I don’t want to have to keep an OS X user account around just to access his accounts, so I wanted to export his credentials to a portable file.