Skip to content

Instantly share code, notes, and snippets.

View Ajay-Raj-S's full-sized avatar
👋
W0rking with Django

Ajay Raj Ajay-Raj-S

👋
W0rking with Django
View GitHub Profile
@kevinSuttle
kevinSuttle / meta-tags.md
Last active May 1, 2025 21:56 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@CrookedNumber
CrookedNumber / gist:8964442
Created February 12, 2014 21:02
git: Removing the last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.

@amatellanes
amatellanes / celery.sh
Last active April 28, 2025 03:31
Celery handy commands
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
@bradmontgomery
bradmontgomery / example.py
Created August 16, 2016 16:57
Example of setting a choices value for django ArrayField
# Here's your list of choices that would be displayed in a drop-down
# element on the web. It needs to be a tuple, and we define this
# as a variable just for readability/convenience.
#
# This example has 3 choices, each of which consists of two parts:
# 1. the thing that get strored in your database
# 2. the thing that you see in a dropdown list
LABEL_CHOICES = (
('this gets stored in your database', 'This item is what you see in the drop-down'),
('django', 'Django'),
@majackson
majackson / migrations.md
Last active May 2, 2025 17:50
Django migrations without downtime

Django Migrations without Downtime

The following instructions describe a set of processes allowing you to run Django database migrations against a production database without having to bring the web service down.

Note that in the below instructions, migrations are all run manually at explicit points, and are not an automatic part of the deployment process.

Adding Fields or Tables

Adding a (nullable) field or a new table

  1. Make the model or column addition in your code.
@Ajay-Raj-S
Ajay-Raj-S / singly-linked-list.c
Last active September 17, 2019 16:19
A simple and explained code on singly linked list.
#include<stdio.h>
#include<stdlib.h>
struct list {
int value;
struct list* next;
};
struct list* root = NULL;
struct list* lastNodeAddr = NULL;
@Ajay-Raj-S
Ajay-Raj-S / doubly-linked-list.c
Last active September 17, 2019 16:05
A simple Doubly Linked List.
#include<stdio.h>
#include<stdlib.h>
struct doubly {
struct doubly* prev;
int value;
struct doubly* next;
};
typedef struct doubly* node;
@Ajay-Raj-S
Ajay-Raj-S / circular-linked-list.c
Last active September 22, 2019 02:50
Circular Linked List Implementation
#include<stdio.h>
#include<stdlib.h>
// circular linked list using Singly Linked list
struct circular {
int value;
struct circular* next;
};
@Ajay-Raj-S
Ajay-Raj-S / stack-using-array.c
Created September 18, 2019 18:22
Stack using Array C Program.
#include<stdio.h>
#include<stdlib.h>
#define MAX 10
int top = -1;
int stack[MAX];
void push(int val) {
stack[++top] = val;
printf("Value Pushed!\n");
@Ajay-Raj-S
Ajay-Raj-S / queue-using-array.c
Created September 18, 2019 18:22
Queue using Array in C program.
#include<stdio.h>
#include<stdlib.h>
#define MAX 5
int front = 0;
int last = 0;
int queue[MAX];
void enqueue(int val) {
queue[last++] = val;