Skip to content

Instantly share code, notes, and snippets.

View geekykant's full-sized avatar

Sreekant Shenoy geekykant

View GitHub Profile
@geekykant
geekykant / example-virtual-host.ssl.test.conf
Created March 28, 2020 08:51 — forked from ankurk91/example-virtual-host.ssl.test.conf
Sample virtual host .conf file for Apache2 on Ubuntu
# This to be used when you need to implement SSL
# Make sure that apache mod_ssl is on
# You can generate self signed certificates for development
# http://www.selfsignedcertificate.com/
<VirtualHost *:443>
ServerName yourapp.test
#ServerAlias www.yourapp.test
//prevents listening from other domains pointed to our IP
server {
listen 80 default_server;
server_name _;
return 404;
}
server {
server_name paavam.com;
@geekykant
geekykant / oops_assignment_series_1.cpp
Last active March 21, 2020 08:02
Group 14 (50,52,54,56)
/*
Group 14 (50,52,54,56)
Create a class to hold a point containing member variable to store x and y co-ordinates. Add
necessary member functions to initialize, set and to get values.
Create a class to represent rectangle that contains member variables to hold two instances of point
(top left and bottom right point).Add necessary member function to handle rectangle instance.
Implement a main() to create as many instances of rectangle as per user’s choice dynamically.
Then calculate the perimeter of those rectangles.
@geekykant
geekykant / firebaseFCM.java
Last active March 15, 2020 07:08
Firebase FCM Notification (Big Image & Normal Normal Notification)
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = MyFirebaseMessagingService.class.getSimpleName();
@Override
public void onNewToken(String token) {
Log.d(TAG, "Refreshed token: " + token);
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
@geekykant
geekykant / balance.py
Created January 30, 2020 13:57
Python code to balance brackets
def doBalance(expression):
stack = []
if(len(expression)%2!=0 or expression[0]==")" or expression[-1] == "("):
return False
for ex in expression:
if(ex == "("):
stack.append(1)
else:
stack.pop()
@geekykant
geekykant / authentication_with_express_postgres.md
Created November 28, 2019 15:46 — forked from laurenfazah/authentication_with_express_postgres.md
Authentication with an Express API and Postgres

Authentication with an Express API and Postgres

Setting Up

Let's make sure our Express app has the required base modules:

# within root of API
npm install --save express pg knex bcrypt
npm install --save-dev nodemon
@geekykant
geekykant / intent_to_wp.java
Created November 28, 2019 08:03
Intent to Whatsapp with Image & Text
int resID = mContext.getResources().getIdentifier(category.getFile_name(), "drawable", mContext.getPackageName());
// create file from drawable image
Bitmap bm = BitmapFactory.decodeResource(mContext.getResources(), resID);
File filesDir = mContext.getFilesDir();
File imageFile = new File(filesDir, category.getFile_name() + ".jpeg");
OutputStream os;
try {
Navigate.java
package com.diyandroid.beacon;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.util.Log;
import android.view.View;
import android.widget.Button;
# Web streaming example
# Source code from the official PiCamera package
# http://picamera.readthedocs.io/en/latest/recipes2.html#web-streaming
import io
import picamera
import logging
import socketserver
from threading import Condition
from http import server
{
"statuses": [
{
"created_at": "Mon May 06 20:01:29 +0000 2019",
"id": 1125490788736032770,
"id_str": "1125490788736032770",
"text": "Today's new update means that you can finally add Pizza Cat to your Retweet with comments! Learn more about this ne… https://t.co/Rbc9TF2s5X",
"truncated": true,
"entities": {
"hashtags": [],