Skip to content

Instantly share code, notes, and snippets.

View HBenzaoui's full-sized avatar
⌨️
Coding...

Hamza BENZAOUI HBenzaoui

⌨️
Coding...
View GitHub Profile
@pamelafox
pamelafox / top_movies.sql
Last active November 13, 2024 06:22
Top 100 Movies
/* Source: http://www.boxofficemojo.com/alltime/world/ */
CREATE TABLE topmovies(
Rank INTEGER,
Title TEXT,
Studio TEXT,
Worldwide REAL,
Domestic REAL,
DomesticPct REAL,
Overseas REAL,
OverseasPct REAL,
@zulhfreelancer
zulhfreelancer / heroku_pg_db_reset.md
Last active June 17, 2024 11:44
How to reset PG Database on Heroku (for Rails app)?

It's important to note that running this reset will drop any existing data you have in the application

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

@abdulateef
abdulateef / binary.java
Last active November 23, 2017 19:39
Given a base- 10 integer, n , convert it to binary (base-2). Then find and print the base- 10 integer denoting the maximum number of consecutive 1's in n's binary representation.
import java.util.Scanner;
public class Binary
{
public static String convertToBinary(int decnumber)
{
String binaryString = " ";
if (decnumber > 0)
{
binaryString = Integer.toBinaryString(decnumber);

Visa requirements for UK conferences.

First you'll want to check if you need a visa to enter the UK.

  • Nationals of the EU, Switzerland, and EEA countries will not need a visa, and are free to work and conduct business in the UK.
  • Nationals from some designated countries such as USA may travel for tourist or business purposes under a visa exemption. The link above will detail what documents you need to provide in order to travel under a visa exemption.
  • Other nationals will need a visa.

The rules for allowable business travel under a visa exemption are covered by the same rules as those travelling under a vistor visa. If you will be travelling under a visa-exemption and the conference is covering your costs in any way you should make sure to read the relevant section below.

@oleg-koval
oleg-koval / f_truncate_tables.sql
Last active October 1, 2022 22:44
Script to cleanup (truncate tables) data from Postgresql
CREATE OR REPLACE FUNCTION public.truncate_tables(username character varying)
RETURNS void
LANGUAGE plpgsql
AS $function$
DECLARE
statements CURSOR FOR
SELECT tablename FROM pg_tables
WHERE tableowner = username AND schemaname = 'public';
BEGIN
FOR stmt IN statements LOOP
@samoshkin
samoshkin / postman_vs_insomnia_comparison.md
Created November 6, 2018 17:42
Comparison of API development environments: Postman vs Insomnia

Postman vs Insomnia comparison

Postman | API Development Environment https://www.getpostman.com
Insomnia REST Client - https://insomnia.rest/

Features                                        Insomnia Postman Notes
Create and send HTTP requests x x
Authorization header helpers x x Can create "Authorization" header for you for different authentication schemes: Basic, Digest, OAuth, Bearer Token, HAWK, AWS
@byk0t
byk0t / docker-compose.yml
Last active January 26, 2024 16:08
Docker compose for odoo:14 and PostgreSQL:13
version: '3'
services:
db:
image: postgres:13
volumes:
- db-data:/var/lib/postgresql/data/pgdata
ports:
- 5432:5432/tcp
environment:
- POSTGRES_PASSWORD=odoo