Skip to content

Instantly share code, notes, and snippets.

View navinthenapster's full-sized avatar
💭
I may be slow to respond.

Navin Infant Raj navinthenapster

💭
I may be slow to respond.
View GitHub Profile
@navinthenapster
navinthenapster / sample_node_controller.js
Last active January 1, 2018 08:23
file example for node controller to send the JSON object
//GET PARAMETER IN url query (www.google.com?search='hi')
exports.weather = function (req, res) {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader('Content-Type', 'application/json');
var place= req.query.q;
//API Config
var url='http://ipapi.co/json';
@navinthenapster
navinthenapster / Http_to_node.java
Created January 1, 2018 08:30
Send ajax calls from java ( http protocol data to Node or server). It convert the Map object into JSON object and vice versa. It requires gson.jar and java-json.jar.
package com.controller;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
@navinthenapster
navinthenapster / JSP_ajax_to_controller.jsp
Created January 1, 2018 08:35
Perform Ajax Call from JSP pages to controller or servlet in request.getParameter and return a JSON object from controller.
$scope.sendmessage= function(from,to,msg,status){
$.ajax({
type: 'POST',
url: '<%=request.getContextPath()%>/MainController',
data: {
"from" : from,
"to" : to,
"message" : msg,
"action": "sendmsg",
@navinthenapster
navinthenapster / SequenceTrigger.sql
Last active January 6, 2018 05:40
Oracle Sql . proper Create table which can take default timestamp, condition and triggers a sequences
CREATE SEQUENCE notify_seq
INCREMENT BY 1
NOCACHE
NOCYCLE;
DROP SEQUENCE notify_seq
CREATE TABLE NOTIFICATIONS(
@navinthenapster
navinthenapster / SessionManagementScriplet.jsp
Last active January 17, 2018 09:50
Session redirect by navin
<%
response.setHeader("Cache-Control","no-cache,no-store,must-revalidate");//HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
if(session==null || session.getAttribute("user")==null){
response.sendRedirect(request.getContextPath()+"/MainController");
return;
}
%>
@navinthenapster
navinthenapster / import_certf_terminal.sh
Last active March 21, 2019 09:35
To import Proxy Certficate of an organization and to access website by importing authorized certifcates
sudo openssl x509 -inform DER -in certificate.cer -out certificate.crt
sudo mv certificate.crt /usr/share/ca-certificates/
sudo mv certificate.crt /usr/local/share/ca-certificates/
cd /usr/share/ca-certificates
sudo chmod 644 certificate.crt
sudo dpkg-reconfigure ca-certificates
@navinthenapster
navinthenapster / jupter_python3.sh
Created September 12, 2018 11:02
Installs the Python3 to the jupyter notebook
python3 -m pip install ipykernel
python3 -m ipykernel install --user
@navinthenapster
navinthenapster / USB Logs
Last active December 26, 2022 18:30
To remove the USB Logs files in Ubuntu
# Ubuntu
dmesg
sudo dmesg --clear
sudo cat /var/log/kern.log | grep usb
sudo rm -rf /var/log/kern*
#old log files
sudo zcat /var/log/kern.log.2.gz | grep usb
sudo cat /var/log/syslog | grep usb
@navinthenapster
navinthenapster / gist:d1a9da0c15df725c5a2bc117a43ffb07
Created November 29, 2018 12:13
Configuring behind company network proxy
https://www.jhipster.tech/configuring-a-corporate-proxy/
@navinthenapster
navinthenapster / client.html
Created February 20, 2019 13:25 — forked from ericremoreynolds/client.html
Flask-socket.io emit to specific clients
<html>
<body>
<h1>I feel lonely</h1>
<script type="text/javascript" src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>
<script type="text/javascript" charset="utf-8">
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on('connect', function() {
socket.emit('connected');