Skip to content

Instantly share code, notes, and snippets.

View quanganhdo's full-sized avatar

Anh Do quanganhdo

View GitHub Profile
@quanganhdo
quanganhdo / breakpoint.png
Created November 1, 2023 13:26 — forked from mvnrc/breakpoint.png
Print current UIViewController class name on viewDidAppear in debug console in Xcode (Swift/Objective-C)
breakpoint.png
@quanganhdo
quanganhdo / decode.swift
Last active March 15, 2021 14:34
JSONDecoder
import Foundation
struct Response: Decodable {
var time: Date
}
let formatter = DateFormatter()
formatter.locale = Locale(identifier: "en_US_POSIX")
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"
@quanganhdo
quanganhdo / tweets.sh
Created October 3, 2019 03:07
Export tweets with locations to GPSVisualizer-compatible CSV
jq -r '["latitude", "longitude", "elevation", "name"], (.[] | select(.retweeted == false) | select(.geo != null) | [.geo.coordinates[0], .geo.coordinates[1], 0, .full_text + "\n\n" + .created_at]) | @csv' tweet.js > tweet.csv
<!DOCTYPE html>
<html>
<!--So long and thanks for all the fish-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Pocket Export</title>
</head>
<body>
<h1>History</h1>
<ul>
[
{
"title" : "Cortex Airport",
"starred" : 1,
"name" : "Cortex",
"lastPlayed" : 1564865481.72277,
"url" : "https:\/\/castro.fm\/episode\/MdiHr4"
},
{
"title" : "for 2019\/07\/31 at 10:00 EDT",
SELECT title, name, starred, lastPlayed, 'https://castro.fm/episode/' || e.shortId url
FROM supepisode e, suppodcast p
WHERE e.podcastId = p.id AND (lastplayed > 0 OR starred = 1) AND e.shortId != ''
ORDER BY lastPlayed DESC
require 'json'
puts <<HERE
<!DOCTYPE html>
<html>
<!--So long and thanks for all the fish-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Pocket Export</title>
</head>
@quanganhdo
quanganhdo / gist:c7cb3a14ec50778200512e77c678067d
Last active March 21, 2024 09:00
Install Vim 8 with Python, Python 3, Ruby and Lua support on Raspberry Pi (Raspbian Stretch)
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev libncurses5-dev libatk1.0-dev libx11-dev libxpm-dev libxt-dev
#Optional: so vim can be uninstalled again via `dpkg -r vim`
sudo apt-get install checkinstall
sudo rm -rf /usr/local/share/vim /usr/bin/vim
cd ~
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libimobiledevice.6.dylib
HOMEBREW_VERSION: 1.3.7-2-g2225feb
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2225febfb396f7db3ccf0c68feae6143128d9935
Last commit: 31 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: d28b74beea0bfe8aad8c29b7fd5741357e9f10a1
Core tap last commit: 33 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_GIT_CONFIG_FILE: /usr/local/Homebrew/.git/config