This file contains 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
CREATE TABLE customer ( | |
customer_id serial PRIMARY KEY, | |
first_name VARCHAR ( 50 ) NOT NULL, | |
last_name VARCHAR ( 50 ) NOT NULL, | |
address VARCHAR ( 50 ) NOT NULL | |
) | |
INSERT INTO customer (first_name, last_name, address) values ('John', 'B', 'x Avenue'); | |
INSERT INTO customer (first_name, last_name, address) values ('John', 'B', 'x Avenue'); | |
INSERT INTO customer (first_name, last_name, address) values ('Maria', 'Pena', 'Cal St.'); |
This file contains 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
-- Get Max ID from table | |
SELECT MAX(id) FROM table; | |
-- Get Next ID from table | |
SELECT nextval('table_id_seq'); | |
-- Set Next ID Value to MAX ID | |
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table)); |
This file contains 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
#!/usr/bin/env python3 | |
from abc import ABC, abstractmethod | |
class AbstractEdgeBuilder(ABC): | |
@abstractmethod | |
def build_edge(self): | |
pass |
This file contains 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
#!/usr/bin/env python3 | |
from abc import ABC, abstractmethod | |
class AbstractFunction(ABC): | |
@abstractmethod | |
def install_function(self): | |
pass |
This file contains 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
from django.conf import settings | |
class OverrideSetting(object): | |
""" | |
Enable the temporary change of a setting. Useful for disabling settings when testing or creating fixtures on dev | |
environment. | |
CAUTION: Do not use it to change production settings. | |
""" |
This file contains 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
#include <iostream> | |
#include <algorithm> // std::sort | |
#include <map> | |
using namespace std; | |
void printKMax(int arr[], int n, int k){ | |
vector<pair<int,int> > d; | |
for(int i=0; i<n;i++){ | |
d.push_back(make_pair(arr[i],i)); | |
} | |
sort(d.rbegin(),d.rend()); |
This file contains 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
import java.util.Random; | |
class MyMonitor { | |
private int data = 0; | |
private int turn = 1; | |
public synchronized void update(int id) throws InterruptedException { | |
while(turn != id) |
This file contains 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
#include <stdio.h> | |
#include <algorithm> | |
#include <stdlib.h> | |
#include <iostream> | |
#include <cstdlib> | |
using namespace std; | |
const int MAX = 120; | |
struct position {double x,y;}; |
This file contains 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
#include<stdio.h> | |
#include<stdlib.h> | |
#include<iostream> | |
#include<cmath> | |
#include <iomanip> | |
#define PI 3.14159265 | |
using namespace std; |
This file contains 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
HASh_NODE *makeTemp(void) | |
{ | |
static int nextTemp = 0; | |
static char tempName[256]; | |
sprintf(tempName,"myStrangeeTemp%d", nextTemp++); | |
return hashInsert(HASH_VARIABLE, tempName); | |
} | |
HASh_NODE *makeLabel(void) |
NewerOlder