Skip to content

Instantly share code, notes, and snippets.

View codekaust's full-sized avatar

Kaustubh Trivedi codekaust

View GitHub Profile
@codekaust
codekaust / GitCommitEmoji.md
Created August 5, 2021 23:23 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
# place it in folder where */*.mp4 is video
import requests, glob, json, os
admin_token = str(input("Enter your token: "))
backend = str(input("Enter backend (backend/api): "))
url = f"https://{backend}.mypathshala.net/study_material/admin_user/recording/"
print(admin_token,backend,url)
for vid_file in glob.glob('*/*.mp4'):
a = {
"start_time": "22:59:25",
"end_time": "23:59:25",
"date": "2020-09-13",
"location": "null",
"is_cancelled": "False",
"teacher": 1,
"subject": 1,
"batches": [
1,
@codekaust
codekaust / base_view.py
Last active September 13, 2020 17:03
Custom serializer to process passed fields recursively (field of form a__b__c) and return nested data. Base View working with serializer to process fields for get and custom authorisation controls over post and patch.
from django.db.models import Q
from rest_framework.views import APIView
from rest_framework import serializers
from rest_framework.response import Response
from rest_framework import status
import json
from .serializers import get_model_serializer
from .utils import flatten_dict, simplify_ser_data
[codephile@ip-10-0-0-42 bot]$ docker run --env-file .env --name bot_cont -p 127.0.0.1:9998:80 bot
> webworker-threads@0.7.17 install /home/hubot/node_modules/webworker-threads
> node-gyp rebuild
make: Entering directory '/home/hubot/node_modules/webworker-threads/build'
CXX(target) Release/obj.target/WebWorkerThreads/src/WebWorkerThreads.o
In file included from ../src/bson.cc:41:0,
from ../src/WebWorkerThreads.cc:17:
../src/bson.h: In member function 'void CountStream::WriteLengthPrefixedString(const v8::Local<v8::String>&)':
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y sudo wget openvswitch-testcontroller && cp /usr/bin/ovs-testcontroller /usr/bin/ovs-controller && wget https://gist.githubusercontent.com/codekaust/99bd949de44c765948fa1e7cc94afd9a/raw/fa65cd49c49c78fc033fd07ff38ff330ef53f799/mininet_install.sh
RUN chmod +x mininet_install.sh && mkdir my_mininet
RUN cd my_mininet && ../mininet_install.sh
ENTRYPOINT /bin/bash
sudo apt-get update
sudo apt-get install -y mininet git sudo
# sudo mn -c
git clone git://github.com/mininet/mininet
cd mininet
# Echo server program
import socket
HOST = '' # Symbolic name meaning all available interfaces
PORT = 3001 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
print ('Connected by', addr)
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <iostream>
#include <string>
#include <fstream>
#include <chrono>
#include <thread>
#include <functional>
#include <queue>
#include <vector>
#include <iostream>
bool cmpa(int l, int r){
return l>r;
}
template<typename T> void print_queue(T& q) {