Skip to content

Instantly share code, notes, and snippets.

View kakopappa's full-sized avatar
🏠
Working from home

Aruna Tennakoon kakopappa

🏠
Working from home
View GitHub Profile
@kakopappa
kakopappa / AsyncTelnetServer.ino
Created May 29, 2017 00:20 — forked from me-no-dev/AsyncTelnetServer.ino
Single Client Telnet Server example
extern "C" {
enum sleep_type {
NONE_SLEEP_T = 0,
LIGHT_SLEEP_T,
MODEM_SLEEP_T
};
bool wifi_set_sleep_type(enum sleep_type type);
void system_set_os_print(uint8 onoff);
void ets_install_putc1(void* routine);
}
@kakopappa
kakopappa / CoinHive.java
Created January 9, 2018 15:06
Coinhive miner found in androidapk.world
package com.coinhiveminer;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.WindowManager.LayoutParams;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class CoinHive {
@kakopappa
kakopappa / asyncWidget.dart
Created July 21, 2018 05:31 — forked from mikemimik/asyncWidget.dart
Flutter: Async widget
import 'package:flutter/material.dart';
import 'loadScreen.dart';
class AsyncWidget extends StatefulWidget {
@override
_AsyncWidgetState createState() => _AsyncWidgetState();
}
class _AsyncWidgetState extends State<AsyncWidget> {
Widget currentComponent;
@kakopappa
kakopappa / AndroidDevLinux
Created October 16, 2018 04:11 — forked from venkateshshukla/AndroidDevLinux
Setting up your Linux for Android Application Development
Step 1. Preparation
--------------------
First take care of the dependencies for Android Application Development.
Dependencies are -
1. Java
2. ant
3. Eclipse and Android Development tools (IDE)
4. Android SDK and NDK
5. adb
@kakopappa
kakopappa / weather_screen_with_forecast.dart
Created December 24, 2018 10:01 — forked from xsokev/weather_screen_with_forecast.dart
Flutter Weather Screen Design with Current Temperature and Forecast
import 'dart:convert';
import 'package:intl/intl.dart';
import 'package:flutter/material.dart';
import 'package:fluids/plugins/weather/models/models.dart'; //custom data models
import 'package:fluids/utils/md_icons.dart'; //material design community icons
class CityForecast extends StatelessWidget {
final GlobalKey<AnimatedListState> _listKey = GlobalKey<AnimatedListState>();
final String city;
final String state;
@kakopappa
kakopappa / esp8266-smart-config.ino
Created January 12, 2019 02:52 — forked from anoochit/esp8266-smart-config.ino
esp8266-smart-config
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
void setup() {
int cnt = 0;
// set for STA mode
WiFi.mode(WIFI_STA);
// put your setup code here, to run once:
@kakopappa
kakopappa / rs-connect.js
Created February 13, 2019 07:03 — forked from chrisckchang/rs-connect.js
replica set connection with nodejs native
/**
* MongoDB NodeJS Driver Production Connection Example
*
* Copyright (c) 2015 ObjectLabs Corporation
* Distributed under the MIT license - http://opensource.org/licenses/MIT
*/
var MongoClient = require('mongodb').MongoClient;
/**
@kakopappa
kakopappa / mongo_backup.sh
Created February 13, 2019 18:09 — forked from sheharyarn/mongo_backup.sh
Mongodump Shell Script for Cronjob
#!/bin/bash
MONGO_DATABASE="your_db_name"
APP_NAME="your_app_name"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/home/username/backups/$APP_NAME"
@kakopappa
kakopappa / letsencrypt_2019.md
Created November 11, 2019 03:33 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@kakopappa
kakopappa / nginx.conf
Created December 20, 2019 03:30 — forked from kmjones1979/nginx.conf
This is an example NGINX configuration for the blog: Performing A/B Testing with NGINX - This demonstrates split_clients based routing on an argument named token
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
default_type text/html;
log_format main '$remote_addr -> $request $status $body_bytes_sent bytes -> $upstream_addr';
access_log /var/log/nginx/access.log main;