Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
havin a normal one

Dan Nguyen dannguyen

💭
havin a normal one
View GitHub Profile
View sample-aapl.tsv
date close
2-Jan-08 194.84
3-Jan-08 194.93
4-Jan-08 180.05
7-Jan-08 177.64
8-Jan-08 171.25
9-Jan-08 179.40
10-Jan-08 178.02
11-Jan-08 172.69
14-Jan-08 178.78
@dannguyen
dannguyen / _twitter-ad-impressions-dan-README.md
Last active Feb 6, 2020
Twitter's ad-impressions.js file, on how @mckinsey and @boba targeted their promoted tweets
View _twitter-ad-impressions-dan-README.md

Twitter's ad-impressions.js file, on how @mckinsey and @boba targeted their promoted tweets

The two JSON files in this gist are partial extracts from the ad-impressions.js file that Twitter gave me when I requested my personal data archive. This JSON file includes all the ads I expereinced on Twitter from December 8 2019 to Jan 8 2020.

I was just curious about ads from @McKinsey and @boba, particularly who they wanted to target, which is something that the ad-impressions.js file tells you.

tl;dr based on my personal data, I didn't really learn anything surprising. But read on for some details if you're kind of interested about social media data and ad targeting.

@dannguyen
dannguyen / cbg.sh
Last active Jun 13, 2022
cbg - a bash function (using AppleScript) to change the theme or background color of MacOS Terminal
View cbg.sh
# Helpful resources:
# https://superuser.com/questions/1188772/mac-command-to-change-the-background-color-in-a-terminal
# https://apple.stackexchange.com/questions/348762/how-to-have-a-random-background-color-in-terminal-app
# https://stackoverflow.com/questions/8063228/how-do-i-check-if-a-variable-exists-in-a-list-in-bash
cbg(){
local OCMD=""
local RED=0; local GRN=0; local BLU=0;
local THEMES="pro basic grass homebrew ocean" ## preset themes
local HELPMSG; read -r -d '' HELPMSG <<EOF
@dannguyen
dannguyen / _README.md
Last active Nov 30, 2019
hello.txt and world.txt, for dan's pydataproject-template to remotely collect
View PRODUCTION-READY-CODE.html
<!doctype html><title>PRODUCTION READY CODE MOTHAF KER!</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
View visualise.py
import matplotlib.pyplot as plt
from PyQt5 import QtCore
import numpy as np
import time
import math
class VisualiseFrequency(QtCore.QThread):
def __init__(self, song, canvas, player):
@dannguyen
dannguyen / spleeter-and-ffmpeg-quick-tutorial.md
Last active Nov 28, 2021
Example use of spleeter (Python+Tensorflow audio-extraction library and ffmpeg
View spleeter-and-ffmpeg-quick-tutorial.md
@dannguyen
dannguyen / nihao-excel-README.md
Last active Oct 25, 2019
ni hao world (testing unicode in Excel)
View nihao-excel-README.md

Does Excel correctly open utf8-encoded CSV files?

(using Office for Mac 16.16.15)

printf "hello,world\nNǐ hǎo,shìjiè\n你好,世界\n" > nihao.csv
# or:
# curl -o nihao.csv https://gist.githubusercontent.com/dannguyen/13d5c39d499e4bbec622e055283fbb19/raw/f1c50ced36033b9a3aed36ebbbf0cf8734a98809/nihao.csv
  
open -a 'Microsoft Excel' nihao.csv
@dannguyen
dannguyen / modern-cli.md
Last active Jun 23, 2022
my modern personal list of modern command-line utility replacements for macos bash
View modern-cli.md
View overview-wapo-dea-pain-pills-db.md