Skip to content

Instantly share code, notes, and snippets.

View betapcode's full-sized avatar

Phạm Ngọc Minh betapcode

  • tamtay.vn
  • Hà Nội - Việt Nam
View GitHub Profile
@betapcode
betapcode / google-img-resize.mdown
Created May 17, 2018 04:56
Google’s authentication-less on-the-fly image resizing service

Google's authentication-less on-the-fly image resizing service

I found it while poking around the Google+ HTML. Jotting down some notes felt like a good idea, so here goes. If you know more about this API, let me know, please!

(Word of warning: I spent ~30 minutes on both my experimentation and this here write-up, so it might not be the most thought-provoking, brilliant thing you read today.)

@betapcode
betapcode / pullJSON.js
Created July 14, 2018 06:29 — forked from varun-raj/pullJSON.js
Google App Script To Fetch Data From JSON Webservice and Write them to google spreadsheet.
function pullJSON() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
var sheet = ss.getActiveSheet();
var url="http://example.com/feeds?type=json"; // Paste your JSON URL here
var response = UrlFetchApp.fetch(url); // get feed
var dataAll = JSON.parse(response.getContentText()); //
@betapcode
betapcode / certbot-renew.sh
Last active September 4, 2018 02:36
Simple Certbot (Let's Encrypt) script for auto-renewal certificates
#!/bin/bash
# Source
# https://gist.github.com/betapcode/fb906d2757bad1c071cbf71e5586bfe8
# Make sure this is added to the crontab, ie:
# sudo crontab -e
# MAILTO="[email protected]"
# 30 2 * */3 * /opt/certbot-renew.sh
# Config
web_service="nginx";
@betapcode
betapcode / flutter_tabbar_example_01.dart
Last active December 21, 2018 08:07
[flutter] build tabbar example 01
import 'package:flutter/material.dart';
class AudioTabsScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return new _AudioTabsState();
}
}
@betapcode
betapcode / flutter_tabbar_example_02.dart
Created December 21, 2018 08:06
[flutter] tabber demo example 02
import 'package:flutter/material.dart';
class AudioTabsScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return new _AudioTabsState();
}
}
@betapcode
betapcode / bottom_sheet_fix.dart
Created January 2, 2019 08:19 — forked from crimsonsuv/bottom_sheet_fix.dart
Flutter Modal bottom sheet whith input fix and full screen sheet
//Flutter Modal Bottom Sheet
//Modified by Suvadeep Das
//Based on https://gist.github.com/andrelsmoraes/9e4af0133bff8960c1feeb0ead7fd749
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
const Duration _kBottomSheetDuration = const Duration(milliseconds: 200);
@betapcode
betapcode / rsync_trigger.md
Created January 24, 2019 09:58
trigger a script to run after the rsyncdaemon

I can trigger a script to run after the rsyncdaemon received file changes to a certain folder?

Step 1: open file config rsync

$ vi /etc/xinetd.d/rsync
service rsync
{
 disable = no
@betapcode
betapcode / gmond.init.ubuntu
Created April 6, 2019 08:25
Script gmond for Debian / Ubuntu
#! /bin/sh
### BEGIN INIT INFO
# Provides: ganglia-monitor
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@betapcode
betapcode / django-uwsgi.ini
Created April 18, 2019 07:09 — forked from robcowie/django-uwsgi.ini
Supervisord config examples
[program:uwsgi]
user=robdev
command=uwsgi --ini /path/to/config.uwsgi
autostart=false
@betapcode
betapcode / etc_init.d_supervisord
Last active August 14, 2019 08:23
[Centos] /etc/init.d/supervisord
#!/bin/sh
#
# supervisord init file for starting up the supervisord daemon
#
# chkconfig: - 20 80
# description: Starts and stops the supervisord daemon.
# AUTHOR : betapcode - [email protected]
# COMPANY: Tamtay JSC
# VERSION: 1.0
# CREATED: 04/11/2016 10:31:01 AM