Skip to content

Instantly share code, notes, and snippets.

View udoyen's full-sized avatar

george udosen udoyen

View GitHub Profile
@udoyen
udoyen / monitor.sh
Created December 24, 2019 09:27
Bash script to use and monitor wifi hotspot connections on linux systems
#!/usr/bin/env bash
# how_wifi_clients.sh
# Shows MAC, IP address and any hostname info for all connected wifi devices
# written for openwrt 12.09 Attitude Adjustment
# modified by romano@rgtti.com from http://wiki.openwrt.org/doc/faq/faq.wireless#how.to.get.a.list.of.connected.clients
function mon () {
echo "# All connected wifi devices, with IP address,"
@udoyen
udoyen / merger.sh
Last active June 28, 2019 13:34
How to merge pdf files using the pdfunite tool on linux
#!/usr/bin/env bash
set -e # Quit on first error
count=0
for i in ./*/*
do
my_array["$count"]="$i" # Creates an array with the filenames
((++count)) # Increase the array index
echo ${my_array[@]} # Echo the contents of the array
done
@udoyen
udoyen / vscode-ubuntu
Created June 15, 2019 16:36
vscode-ubuntu
[
{
"metadata": {
"id": "850c6bb1-4a81-4f83-a81f-835d651a211c",
"publisherId": "Mikael.Angular-BeastCode",
"publisherDisplayName": "Mikael"
},
"name": "Angular-BeastCode",
"publisher": "Mikael",
"version": "8.0.7"
@udoyen
udoyen / iptables-round-robin.sh
Created June 5, 2019 07:44 — forked from apparentlymart/iptables-round-robin.sh
round robin to three ports on the same host with iptables
# The following example shows a way to use iptables for basic round-robin load balancing, by redirecting
# packets two one of three ports based on a statistic counter.
#
# TCP packets for new sessions arriving on port 9000 will rotate between ports 9001, 9002 and 9003, where
# three identical copies of some application are expected to be listening.
#
# Packets that aren't TCP or that related to an already-established connection are left untouched, letting
# the standard iptables connection tracking machinery send it to the appropriate port.
#
# For this to work well, connections need to be relatively short. Ideally there would be an extra layer
Java Paramter Type Names
E – Element (used extensively by the Java Collections Framework, for example ArrayList, Set etc.)
K – Key (Used in Map)
N – Number
T – Type
V – Value (Used in Map)
S,U,V etc. – 2nd, 3rd, 4th types
@udoyen
udoyen / JavaKeys.java
Created January 26, 2019 08:59
Java explicit key creation example
public class Person {
private final Object key = new Object();
public String init() {
synchronized(key) {
// Do stuff
}
}
}
@udoyen
udoyen / mysql_storedprocedure.sql
Last active January 24, 2019 11:28
StoredProcedure for Mysql
DELIMITER //
DROP PROCEDURE IF EXISTS addnewemployee //
CREATE PROCEDURE addnewemployee
(
IN eno int(11),
IN ebdate date,
IN efname varchar(14),
IN elname varchar(16),
IN egender enum('M', 'F'),
IN ehdate date
@udoyen
udoyen / sample_storedprocedure.txt
Last active January 19, 2019 14:09
Sample of StoredProcedure
CallableStatement cstmt = conn.prepareCall(
"{call StoredProcedureName ( [Parameter Definition] ) }"
)
Types of parameters allowed include:
1) Input(Default)
2) Output
3) Input Output
To Set the Parameters we use:
// create a java calendar instance
Calendar calendar = Calendar.getInstance();
// get a java date (java.util.Date) from the Calendar instance.
// this java date will represent the current date, or "now".
java.util.Date currentDate = calendar.getTime();
// now, create a java.sql.Date from the java.util.Date
java.sql.Date date = new java.sql.Date(currentDate.getTime());