Skip to content

Instantly share code, notes, and snippets.

View ThinhPhan's full-sized avatar
🎯
Focusing

Thinh Phan ThinhPhan

🎯
Focusing
View GitHub Profile
@ThinhPhan
ThinhPhan / curl.md
Created April 5, 2019 16:14 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@ThinhPhan
ThinhPhan / chmod.md
Last active February 21, 2019 06:56
Linux - chmod for dummy

What is the difference between “chmod +x” and “chmod 755”?

Motivate from this question and answer https://askubuntu.com/a/932719/927010

Short version:

To be able to compare them, we should look at them from the same perspective, so:

chmod +x is equal to chmod ugo+x (Based on umask value) chmod 755 is equal to chmod u=rwx,go=rx

@ThinhPhan
ThinhPhan / README.md
Created September 18, 2018 13:41
Demo npx

Hello World

This is how npx work. Enjoy yourself.

Copy the URL above on your browser's address npx [YOUR-AWESOME-GIST-URL]

@ThinhPhan
ThinhPhan / keybase.md
Created September 10, 2018 10:52
Keybase.io Public key

Keybase proof

I hereby claim:

  • I am ThinhPhan on github.
  • I am vincentphan (https://keybase.io/vincentphan) on keybase.
  • I have a public key whose fingerprint is DD84 89C3 55B3 FDD0 201E 4E48 E6B6 FB5E 0726 1456

To claim this, I am signing this object:

@ThinhPhan
ThinhPhan / cmdline.txt
Created July 30, 2018 20:11
Raspi config.txt full description from Resin.io
dwc_otg.lpm_enable=0 console=null root=LABEL=resin-rootA rootfstype=ext4 rootwait vt.global_cursor_default=0

WPE Issues

OpenGL

Read more OpenGL Error

  • glGetError 0x502 : means invalid operation
  • glGetError 0x505 : means out-of-memory reported by the opengl gpu driver --> Solution: Share more memory to GPU
@ThinhPhan
ThinhPhan / Makefile
Created July 12, 2018 21:30
Setup Electron Kiosk App On Ubuntu 18.04
.PHONY: install uninstall test set-default
test:
sudo apt install plymouth-x11
sudo plymouthd ; sudo plymouth --show-splash ; for ((I=0; I<10; I++)); do sleep 1 ; sudo plymouth --update=test$I ; done ; sudo plymouth --quit
uninstall:
rm -rv /usr/share/plymouth/themes/first || true
install: uninstall
@ThinhPhan
ThinhPhan / Install Node Raspi3.md
Last active June 6, 2019 05:42
Install Node on Raspi3

Opt 1: From Nodesource

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Opt 2: Download & Install

wget https://nodejs.org/dist/v4.3.2/node-v4.3.2-linux-armv6l.tar.gz 
@ThinhPhan
ThinhPhan / Instructions.md
Created October 17, 2017 10:24 — forked from mcfadden/Instructions.md
Making an IP camera with the Raspberry Pi Including on-board motion detection, and a password protected web server for viewing the camera stream

Making an IP camera with the Raspberry Pi

Including on-board motion detection

Requirements

  • Raspberry Pi (512MB rev2 recommended)
  • Raspberry Pi Camera board
  • SD Card (min 2BG, 8GB recommended for good measure. Class 10)

Optionally, a wifi adapter verified to work with raspberry pi ( I used Edimax Wireless Nano USB Adapter - http://www.amazon.com/gp/product/B005CLMJLU/ )

@ThinhPhan
ThinhPhan / TextFieldAllowNumberOnly.m
Last active October 29, 2015 05:16
UITextField should allow only numbers.
#define ACCEPTABLE_CHARACTERS @"0123456789"
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if (!string.length)
return YES;
if (textField == self.quantityTextField) {
NSCharacterSet *numbersOnly = [[NSCharacterSet characterSetWithCharactersInString:ACCEPTABLE_CHARACTERS] invertedSet];
NSString *filtered = [[string componentsSeparatedByCharactersInSet:numbersOnly] componentsJoinedByString:@""];
BOOL stringIsValid = [string isEqualToString:filtered];