Skip to content

Instantly share code, notes, and snippets.

@fnicastri
fnicastri / gist:ac81380666d9fbe18681e21bfab527ac
Created January 19, 2022 11:20 — forked from Luoyayu/gist:3c5f099dd1a453f049fced1df7bc7964
extract Xcode.xip to a customed volume
By default, when extracts the Xcode.zip,
macos will create tmp file in `/private/var/folders/v2/tbmrn60d2910x3w23ys5fgs00000gn/T/com.apple.AUHelperService`.
Sometimes, the /private has no ehough space to hold 19GB Xcode.app.
Thus we can create a soft link named `com.apple.AUHelperService` in the tmp dir.
Steps:
1. BACKUP `com.apple.AUHelperService` in `/private/var/folders/v2/tbmrn60d2910x3w23ys5fgs00000gn/T/` to `com.apple.AUHelperService_BACKUP`
2. mkdir named `com.apple.AUHelperService` wherever you have enough space,
3. ln -s /your/absolute/path/com.apple.AUHelperService /private/var/folders/v2/tbmrn60d2910x3w23ys5fgs00000gn/T
4. double click the Xcode.xip
@fnicastri
fnicastri / appify.sh
Created June 28, 2020 10:45 — forked from oubiwann/appify.sh
appify — create the simplest possible Mac app from a shell script (adds an application icon)
#!/usr/bin/env bash
VERSION=4.0.1
SCRIPT=`basename "$0"`
APPNAME="My App"
APPICONS="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns"
OSX_VERSION=`sw_vers -productVersion`
PWD=`pwd`
function usage {
@fnicastri
fnicastri / article_dao.dart
Created May 10, 2020 21:14 — forked from ForceTower/article_dao.dart
Fetch relations using floor
@Query('SELECT * FROM article ORDER BY publishedAt DESC')
Stream<List<Article>> getAllArticles();
@Query('SELECT Author.*, _junction.articleId as articleId FROM ArticleAuthor AS _junction inner join Author ON (_junction.authorId = Author.id) WHERE _junction.articleId IN (:ids)')
Future<List<AuthorArticleId>> getAuthorsFromArticles(List<int> ids);
Stream<List<ArticleWithAuthor>> getAllArticlesWithAuthors() {
final stream = getAllArticles();
final controller = StreamController<List<ArticleWithAuthor>>.broadcast();
@fnicastri
fnicastri / wordpress-change-domain-migration.sql
Created April 24, 2018 10:30 — forked from chuckreynolds/wordpress-change-domain-migration.sql
Use this SQL script when changing domains on a WordPress site. Whether you’re moving from an old domain to a new domain or you’re changing from a development domain to a production domain this will work. __STEP1: always backup your database. __STEP2: change the ‘oldsite.com’ and ‘newsite.com’ variables to your own. __STEP3: make sure your databa…
SET @oldsite='http://oldsite.com';
SET @newsite='http://newsite.com';
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite);
UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite);
/* only uncomment next line if you want all your current posts to post to RSS again as new */
#UPDATE wp_posts SET guid = replace(guid, @oldsite, @newsite);
@fnicastri
fnicastri / demo.htm
Created October 26, 2017 12:57 — forked from bennadel/demo.htm
Using Underscore.js Templates To Render HTML Partials
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Looking At Underscore.js Templates</title>
</head>
<body>
<h1>
Looking At Underscore.js Templates
@fnicastri
fnicastri / tmux-cheat-sheet.md
Created October 9, 2017 10:04 — forked from michaellihs/tmux-cheat-sheet.md
tmux Cheat Sheet
@fnicastri
fnicastri / .lftp.mockup.rc
Created July 13, 2017 10:25 — forked from gaubert/.lftp.mockup.rc
~/.lftp.rc parameters detailed
########## SETTINGS
# On startup, lftp executes ~/.lftprc and ~/.lftp/rc. You can place aliases and 'set' commands
# there. Some people prefer to see full protocol debug, use 'debug' to turn the debug on.
# Certain commands and settings take a time interval parameter. It has the format Nx[Nx...], where N is time amount
# (floating point) and x is time unit: d - days, h - hours, m - minutes, s - seconds. Default unit is second. E.g.
# 5h30m or 5.5h. Also the interval can be 'infinity', 'inf', 'never', 'forever' - it means infinite interval. E.g.
# 'sleep forever' or 'set dns:cache-expire never'.
@fnicastri
fnicastri / loop_files_folders_recursively.go
Created June 7, 2017 21:54 — forked from francoishill/loop_files_folders_recursively.go
Loop through files and folders recursively in golang
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() ([]string, error) {
searchDir := "c:/path/to/dir"
@fnicastri
fnicastri / copy.lua
Created May 23, 2017 09:39 — forked from tylerneylon/copy.lua
How to deep copy Lua values.
-- copy.lua
--
-- Functions of varying complexity levels to achieve
-- a deep copy in Lua.
--
-- 1. The Problem.
--
-- Here's an example to see why deep copies are useful.
@fnicastri
fnicastri / instagram-scraper.php
Created May 22, 2017 08:11 — forked from dboutote/instagram-scraper.php
Quick and dirty Instagram scraper
<?php
/**
* Instagram scraper
*
* Quick and dirty Instragram scraper for displaying a Instagram feed.
*
* Based on : https://gist.github.com/cosmocatalano/4544576
*
* @param string $username Instagram user account