This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"": [ | |
{ | |
"35d59488-4077-4565-85df-d56c5c36c1a1": [ | |
{ | |
"id": "f675bfb0-b1cb-4cab-a424-b418889aa886", | |
"user_type": "pro", | |
"first_name": "User", | |
"last_name": "01", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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 =" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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!"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |