Skip to content

Instantly share code, notes, and snippets.

View anuj9196's full-sized avatar
🎯
Focusing

Anuj Sharma anuj9196

🎯
Focusing
View GitHub Profile
@anuj9196
anuj9196 / getphoto_response.json
Created November 23, 2017 07:44
getphoto response
{
"status": "OK",
"result": {
"keyword": "cars",
"page": "3",
"result": [
{
"status": true,
"network": "flickr",
"count": 10,
@anuj9196
anuj9196 / captcha solve
Last active May 23, 2018 07:32
captcha solving error
# my function to solve the captcha
# here I'm passing the url of the image with captcha_image
# the url example: https://images-na.ssl-images-amazon.com/captcha/sargzmyv/Captcha_xhoxwckkdo.jpg
```
def solve_captcha(captcha_image):
print('--- called solve_captcha for captcha: '+str(captcha_image))
print('--- setting Death By Captcha credentials---')
client = deathbycaptcha.SocketClient('vega6dev', 'dev@1234')
@anuj9196
anuj9196 / django_country_fixture.py
Created June 6, 2018 02:24
Django country fixture data
# Generated by Django 2.0.5 on 2018-05-28 17:20
from django.db import migrations
def create_countries(apps, schema_editor):
Country = apps.get_model('address', 'Country')
db_alias = schema_editor.connection.alias
Country.objects.using(db_alias).bulk_create([
Country(name='Afghanistan', code='AF', isd_code=93, currency_name='Afghan afghani', currency_code='AFN',
@anuj9196
anuj9196 / anagram.py
Last active August 11, 2018 07:11
Program to count number of items to be deleted to make two strings anagrams.
"""
Given two strings, a and b, that may or may not be of same length,
determine the minimum number of character deletions required to make a and b anagrams.
Any characters can be deleted from either of the strings
NOTE: Anagram of a word is formed by arranging the letters of the word.
For eg. -> for the word RAM: RAM, AMR, MAR, etc are the anagrams
"""
attempts = int(input())
@anuj9196
anuj9196 / check_music_duration_and_create_music_loop.php
Created August 9, 2018 05:32
Check music duration and create music loop in PHP
/**
* prepare music loop
*
* requires: james-heinrich/getid3 package
* install using composer:
* `composer require james-heinrich/getid3`
*
* @param $music_path, Local Music file absolute path
* @param $total_media_count, Number of Images/Videos to add in the video
* @param $each_media_delay, Delay duration for each Image/Video
@anuj9196
anuj9196 / rest.py
Created August 14, 2018 17:09
rest py
class ContactViewSet(viewsets.ModelViewSet):
"""
This viewset automatically provides `list`, `create`, `retrieve`,
`update` and `destroy` actions.
Additionally we also provide an extra `favourite`action
"""
serializer_class = ContactSerializer
permission_classes = (IsAuthenticated, AdminAuthenticationPermission,)
@anuj9196
anuj9196 / serializer.py
Created August 14, 2018 17:20
serializer.py
class ContactSerializer(serializers.HyperlinkedModelSerializer):
phone_numbers = ContactPhoneNumberSerializer(
source='contactphonenumber_set',
many=True,
required=False
)
emails = ContactEmailSerializer(
source='contactemail_set',
many=True,
required=False
@anuj9196
anuj9196 / Graph of git log in terminal
Created March 15, 2019 09:36
Graph of git log in terminal
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative master..development
@anuj9196
anuj9196 / r.json
Created June 18, 2019 02:55
r.json
servicesDummy = [
{
id: 1,
serviceName: 'menicure',
subservices: [
{ id: 1, subserviceName: 'deluxe menicure', price: 45 },
{ id: 2, subserviceName: 'jelly menicure', price: 55 },
{ id: 3, subserviceName: 'classic menicure', price: 85 },
]
},
{
"serviceList": [
{
"technician": {
"firstName": "Anuj",
"id": 23,
"lastName": "Sharma",
"nickName": "sdsd",
"salonsId": 1,
"usersId": 1