Skip to content

Instantly share code, notes, and snippets.

View nampdn's full-sized avatar
🌓
New creation in Christ!

Nam Pham nampdn

🌓
New creation in Christ!
  • Somewhere on Earth
View GitHub Profile
@nampdn
nampdn / contracts...vgm-tracker...DeviceNFT.sol
Created September 10, 2021 08:03
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.3/contracts/token/ERC721/ERC721.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.3/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.3/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.3/contracts/access/AccessControl.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.3/contracts/utils/Counters.sol";
#! /bin/bash
declare -a IPS=(10.131.79.220 10.131.78.219)
for ip in ${IPS[@]}; do
echo "Syncing to server: $ip"
rsync -avz /etc/nginx/sites-available/lb* root@${ip}:/etc/nginx/sites-available/
ssh root@${ip} sudo ln -s /etc/nginx/sites-available/lb* /etc/nginx/sites-enabled/
ssh root@${ip} sudo service nginx reload
done
@nampdn
nampdn / clean.sh
Created October 15, 2020 02:14 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@nampdn
nampdn / add-remove-public-read-s3.txt
Created September 22, 2020 01:21 — forked from anuragmathur1/add-remove-public-read-s3.txt
s3cmd examples to add and remove public-read access for s3 buckets, folders and objects within.
## You may choose to remove --recursive if is required only for the bucket or folder and not for objects within.
s3cmd setacl --acl-private --recursive s3://mybucket-name
s3cmd setacl --acl-private --recursive s3://mybucket-name/folder-name
s3cmd setacl --acl-private --recursive s3://mybucket-name/folder-name/object-name
s3cmd setacl --acl-public --recursive s3://mybucket-name
s3cmd setacl --acl-public --recursive s3://mybucket-name/folder-name
s3cmd setacl --acl-public --recursive s3://mybucket-name/folder-name/object-name
@nampdn
nampdn / s3_set_object_public.sh
Created September 17, 2020 16:44 — forked from alexclifford/s3_set_object_public.sh
Make S3 object public and private via s3cmd command line
s3cmd setacl s3://bucket/path/to/file --acl-public
s3cmd info s3://bucket/path/to/file
s3cmd setacl s3://bucket/path/to/file --acl-private
var StrippedString = OriginalString.replace(/(<([^>]+)>)/ig,"");
//From http://css-tricks.com/snippets/javascript/strip-html-tags-in-javascript/
@nampdn
nampdn / m3u8-to-mp4.md
Created February 6, 2020 02:09 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@nampdn
nampdn / machine.js
Last active October 29, 2019 07:54
Generated by XState Viz: https://xstate.js.org/viz
const windowMachine = Machine({
initial: "loading",
context: {
title: "GI 3:16",
type: "BIBLE"
},
states: {
idle: {
on: {
{
"site": "https://vgm.tv",
"tracker": "https://tracker.vgm.tv",
"api": "QmQchefFmvEwsssrKS7aqDoT7hCnBoU6QdsRx5vAtLqGph",
"thumbnails": "QmQeeJQE8sGosq82TaW6an89Z7eHeBPzWmGAmNL6cg8tJW",
"version": 1566,
"nodes": [
{
"id": "QmQjUXFjp9PnD4oyEHpj2ChJThtTjQjuQFVJiEs5BFqFrd",
"gateway": "https://vn.gateway.vgm.tv",
Verifying my Blockstack ID is secured with the address 1DDF1GN4Mf1573HZBMZPwEjwmgDVEEEaRk https://explorer.blockstack.org/address/1DDF1GN4Mf1573HZBMZPwEjwmgDVEEEaRk