Skip to content

Instantly share code, notes, and snippets.

View napcae's full-sized avatar

Trung Nguyen napcae

View GitHub Profile
@napcae
napcae / snapchat exporter
Last active October 24, 2022 16:35
Download Media from Snapchat Backup
# give your files a creation date so Photos on macOS sorts them correctly
find -f $FILE | xargs -I {} exiftool -CreateDate={} -MediaCreateDate={} {}
@napcae
napcae / mpd.log
Last active November 18, 2015 07:27
ncmpcpp/issues/55
napcae@butterfinger ~/Downloads> mpd --verbose --stdout --no-daemon
config_file: loading file /Users/napcae/.mpd/mpd.conf
server_socket: bind to '0.0.0.0:6600' failed: Address already in use (continuing anyway, because binding to '[::]:6600' succeeded)
path: SetFSCharset: fs charset is: UTF-8
libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator'
db: reading DB
curl: version 7.43.0
curl: with SecureTransport
state_file: Loading state file /Users/napcae/.mpd/mpdstate
config: inotify: auto_update was disabled. enable during compilation phase
@napcae
napcae / update_drop_dyn.sh
Created November 17, 2015 11:40
update dynamic dns IP for digital ocean
#!/bin/bash
# No Fallback, no error handling
# crontab -e
# hourly
# 0 * * * * <PATH-TO-SCRIPT>/update_drop_dyn.sh $api_key $domain $record > <PATH-TO-LOGFILE> 2>&1
#####
# note: don't forget to add a trailing colon(:) to the $api_key to avoid a password prompt from the api
api_key="$1"
domain="$2"
@napcae
napcae / keybase.md
Created June 18, 2014 09:18
keybase.md

Keybase proof

I hereby claim:

  • I am napcae on github.
  • I am napcae (https://keybase.io/napcae) on keybase.
  • I have a public key whose fingerprint is 9A12 9203 6D40 BE68 1E66 EAE8 6608 589A 4D08 2FE1

To claim this, I am signing this object:

@napcae
napcae / gist:cf1a333a9a14571a6e05
Created May 25, 2014 09:20
ampache democratic log
2014-05-25 09:19:24 [admin] (session) -> f6ccd44f6d270eed6874b13546f7768a has been extended to Mon, 26 May 2014 09:19:24 +0000 extension length 86400
2014-05-25 09:19:24 [admin] (Core) -> Registered post form create_democratic with SID 91f8cd1fb09a9c512a8080c03ceaf7f6 and expiration 1401013164 (3600 seconds from now)
2014-05-25 09:19:24 [ampache] (PHP) -> [Warning] You have not set a valid timezone (date.timezone) in your php.ini file. This may cause display issues with dates. This warning is non-critical and not caused by Ampache. in file /www/Sites/ampache/lib/class/session.class.php(340)
2014-05-25 09:19:24 [admin] (session) -> f6ccd44f6d270eed6874b13546f7768a has been extended to Mon, 26 May 2014 09:19:24 +0000 extension length 86400
2014-05-25 09:19:25 [ampache] (PHP) -> [Warning] You have not set a valid timezone (date.timezone) in your php.ini file. This may cause display issues with dates. This warning is non-critical and not caused by Ampache. in file /www/Sites/ampache/lib/class/session.class.php(34
@napcae
napcae / $brew doctor
Created March 5, 2014 14:49
ncmpcpp failed to build on 10.9.2 logfiles
napcae at butterfinger in ~
$ pbcopy < /Users/napcae/Library/Logs/Homebrew/ncmpcpp/config.log
napcae at butterfinger in ~
$ brew doctor
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
#!/bin/bash
function dateISO {
date -u +"%Y-%m-%dT%H:%M:%S";
}
function externalIP {
curl -s http://checkip.dyndns.org | sed 's/[a-zA-Z/<> :]//g' | tr -d '\r'
}
function geoIP {
@napcae
napcae / net.rutschle.sslh.plist
Last active December 26, 2015 20:59
net.rutschle.sslh.plist for launchd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.rutschle.sslh</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/sslh-fork</string>
<string>-f</string>
@napcae
napcae / count_user_of_group
Created October 28, 2013 07:41
count users of a unix user group
#!/usr/bin
#change usergroupname to the group which you are searching for
grep '^usergroupname' /etc/group | tr ',' '\n' | wc -l
@napcae
napcae / update_drop_dyn.sh
Created July 31, 2013 16:34
Script to update dyndns records for digital ocean automagically.
#!/bin/bash
#WTFPL 2013 "napcae" Chi Trung Nguyen
#
#just put in your values here
#You can find the client_id and api_key in your DO dashboard
#To get the domain_id and record_id use just paste this in a browser and copy the values:
#domain_id: https://api.digitalocean.com/domains?client_id=[your_client_id]&api_key=[your_api_key]
#record_id: https://api.digitalocean.com/domains/[domain_id]/records?client_id=[your_client_id]&api_key=[your_api_key]
#see https://api.digitalocean.com/ for more information
######################################################################################################################