Skip to content

Instantly share code, notes, and snippets.

@imamhidayat92
imamhidayat92 / simple-server.c
Last active June 11, 2017 11:09
A simple server implementation that will send "Hello world!" message to every client that connects to it.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
@imamhidayat92
imamhidayat92 / simple-server.c
Created June 11, 2017 11:02
A simple server implementation that will send "Hello world!
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
@imamhidayat92
imamhidayat92 / get-all-comments-and-parse.js
Created October 16, 2016 11:26
This is a simple script used to read all comments from an Instagram account photo. Tested on this link: https://www.instagram.com/p/BLlhP-yDplV/
var container = $('._mo9iw._123ym');
var button = $('._l086v._ifrvy');
var scrollAndClick = () => {
container.scrollTop = 0;
button.click();
};
var startScrollAndClick = (finishCallback) => {
scrollAndClick();
@imamhidayat92
imamhidayat92 / convert.js
Created April 12, 2015 15:25
Convert RGB to Hex
var normalize = function(h) { return h.length == 1 ? '0' + h : h; };
var convert = function(r, g, b) { return '#' + normalize(r.toString(16)) + normalize(g.toString(16)) + normalize(b.toString(16)); };
@imamhidayat92
imamhidayat92 / Graph.java
Created December 30, 2014 22:49
A very simple undirected and unweighted graph implementation using Java. Vertices and edges information are stored in an adjacency map.
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
/**
* A simple undirected and unweighted graph implementation.
*
* @param <T> The type that would be used as vertex.
*/
public class Graph<T> {
@imamhidayat92
imamhidayat92 / morenite.tweet-feeder-client.js
Last active August 29, 2015 13:56
Mor(e)nite Tweet Feeder Client implemented using Javascript with jQuery.
(function( $ ) {
$.fn.feed = function(args) {
var URL = "http://apps.morenite.com/tweet-feeder/index.php?user=" + args.user + "&action=" + args.action;
$.getJSON(URL, function(data) {
});
}
/*
Author: Imam Hidayat (mokhamad.imam[at]students.paramadina.ac.id)
Universitas Paramadina
Source: https://gist.github.com/imamhidayat92/7728574
This helper class can be used to simplify report generation procedure using Jasper Report 5.5.0.
*/
import java.sql.*;
@imamhidayat92
imamhidayat92 / JTableHelper.java
Last active December 16, 2015 10:18
This helper class can be used to help java programmer dealing with JTable.
package helper;
/*
Author: Imam Hidayat (mokhamad.imam[at]students.paramadina.ac.id)
Universitas Paramadina
Source: https://gist.github.com/imamhidayat92/5418619
This helper class can be used to simplify JTable usage in Java.
*/
/*
Author: Imam Hidayat (mokhamad.imam[at]students.paramadina.ac.id)
Universitas Paramadina
Source: https://gist.github.com/imamhidayat92/5418582
This helper class can be used to simplify query execution using MySQL Database in Java.
*/
import java.sql.*;