Skip to content

Instantly share code, notes, and snippets.

View sakthiinfotec's full-sized avatar

Sakthivel Murugasamy sakthiinfotec

View GitHub Profile
@sakthiinfotec
sakthiinfotec / DownloadFileComponent.ts
Created November 28, 2024 09:45 — forked from DamienBraillard/DownloadFileComponent.ts
Angular 2+ Download file from API
import { Http, ResponseContentType } from '@angular/http';
...
constructor(
private http: Http,
) { }
downloadFile() {
return this.http
.get('https://jslim.net/path/to/file/download', {
@sakthiinfotec
sakthiinfotec / latency.txt
Created April 23, 2023 14:06 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@sakthiinfotec
sakthiinfotec / position-tracker.js
Last active July 1, 2019 22:55
Leaflet / OSM - Marker creation and tracking it
var map = L.map('map').setView([13.08, 80.27], 10);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
function createMarkers(latlng) {
console.log('Create markers ...');
var imgMarker = L.marker(latlng, {icon: L.icon({
iconUrl: "/images/blue-baloon.png",
@sakthiinfotec
sakthiinfotec / TCPServer.java
Created April 6, 2016 11:38
A Simple TCP Server
package com.sakthiinfotec.server;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@sakthiinfotec
sakthiinfotec / HBaseTableList.java
Created April 6, 2016 11:36
List all the tables from HBase using HBaseAdmin API
package com.sakthiinfotec.hbase;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.client.Result;
@sakthiinfotec
sakthiinfotec / HBaseConnectionTest.java
Created April 6, 2016 11:33
Test Connectivity with HBase from HBase Java API
package com.sakthiinfotec.hbase;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.client.HBaseAdmin;
public class HBaseConnectionTest {
public static void main(String[] args) {
@sakthiinfotec
sakthiinfotec / pom.xml
Created March 1, 2016 07:44
Copying & Packing dependent jar files into target/classes/lib folder
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hbase-batch</groupId>
<artifactId>hadoop-hbase-batch</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>HBase - Batch</name>
<description>HBase - Batch Job</description>
<dependencies>
@sakthiinfotec
sakthiinfotec / README.md
Created February 25, 2016 08:11 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

server {
# Redirect any subdomain to the root domain
# to be captured by next server block
server_name *.example.com;
return 301 $scheme://example.com$request_uri;
}
server {
root /var/www;
index index.html index.htm;
On my Ubuntu machine I located the GeoIP.dat file. If not available then download/intall the same.
root@localhost:~# locate GeoIP.dat
/usr/share/GeoIP/GeoIP.dat
Open Nginx configuration (/etc/nginx/nginx.conf) and specify <geoip_country> <path to GeoIP.dat>
line under the "http" block. Example block:
http {
# SS - meant to find country code from the client IP