Skip to content

Instantly share code, notes, and snippets.

View jainmickey's full-sized avatar

Mayank Jain jainmickey

View GitHub Profile
# Standard Library
import re
# Third Party Stuff
from django.db import models
from django.contrib.postgres.indexes import GinIndex
from django.contrib.postgres.search import (
SearchQuery,
SearchRank,
SearchVector,
[
{
"": [
{
"35d59488-4077-4565-85df-d56c5c36c1a1": [
{
"id": "f675bfb0-b1cb-4cab-a424-b418889aa886",
"user_type": "pro",
"first_name": "User",
"last_name": "01",
# Displays all current connections
def list_connections():
db = sqlite3.connect(r'C:\Users\Administrator\Desktop\Raspi\mysite\newdb.db')
cursor = db.cursor()
results = ''
messages = []
for i, conn in enumerate(all_connections):
try:
conn.send(str.encode(' '))
conn.recv(4096)
views.py
```
from django.shortcuts import render
from django.http import JSONResponse
from server import list_connections, get_target, send_target_commands
def get_output(request):
cmd = request.GET.get('command')
msg = 'Command not recognized'
--Haskell Quine
--Implementation 1
import Control.Monad
import Control.Monad.Instances
main = (putStr . ap (++) show)
"--Haskell Quine\n--Implementation 1\nimport Control.Monad\nimport Control.Monad.Instances\nmain = (putStr . ap (++) show) "
--Implementation 2
--main = putStrLn (s ++ show s) where s =
-- "--Haskell Quine\n--Implementation 2\nmain = putStrLn (s ++ show s) where s ="
@jainmickey
jainmickey / TypeCast.java
Created September 18, 2012 15:25
A simple program on how to do type cast in Java.
/* Example of using type cast in java */
class TypeCast{
public static void main(String args[]){
int myInt = 123;
double myDouble = 123.0;
String myStr = "123";
String txtStr = "Hello, World!";
@jainmickey
jainmickey / StringExample.java
Created September 18, 2012 15:19
Manipulation of strings in Java
/* Use of Strings and substrings */
class StringExample{
public static void main(String args[]){
String str = "Hello, World!"; //String is a inbuilt class which we can use through objects or instance variable
System.out.println("str is :- " + str);
/* substring is a method inside string class to manipulate strings. This will print the string in str from position 7 to 12 */
System.out.println("substring is :- " + str.substring(7, 12));
@jainmickey
jainmickey / OpEquals.java
Created September 11, 2012 17:46
Use of Operator-Equals
class OpEquals{
public static void main(String args[]){
int a=1, b=2, c=3;
a += 5;
b *= 4;
c += a*b;
c %= 6;
System.out.println("a = "+a);
System.out.println("b = "+b);