Skip to content

Instantly share code, notes, and snippets.

View segaz2002's full-sized avatar
🎯
Focusing

Gabriel segaz2002

🎯
Focusing
View GitHub Profile
@segaz2002
segaz2002 / countries.json
Created September 12, 2023 19:53 — forked from tiagodealmeida/countries.json
List of countries with country code, name, currency code, population, capital and continent name in JSON format
{
"countries": {
"country": [
{
"countryCode": "AD",
"countryName": "Andorra",
"currencyCode": "EUR",
"population": "84000",
"capital": "Andorra la Vella",
"continentName": "Europe"
version: "3"
volumes:
livebook:
services:
livebook:
image: ghcr.io/livebook-dev/livebook
working_dir: /livebook
environment:
@segaz2002
segaz2002 / balanced_braket_v2.js
Created December 7, 2021 14:09
Balanced Bracked solution v2
function isBalanced(s) {
// Write your code here
let agg = "";
let mapping = {"{": "}", "[": "]", "(": ")"};
let validBraces = ["()", "{}", "[]"];
for(let c of s){
//Check if opening
if(mapping[c]){
agg += c;
}else{
@segaz2002
segaz2002 / create_a_stack_with_queue.js
Created December 4, 2021 20:31
Create a stack with a Queue
var Node = function(data){
this.data = data;
this.next = null;
};
var Queue = function(){
this.head = null;
this.tail = null;
}
Queue.prototype.add = function(x) {
@segaz2002
segaz2002 / balanced_brackets.js
Last active December 5, 2021 09:03
Balanced Brackets Problem - Hackerrank
function Node(data) {
this.data = data;
this.next = null;
}
function Stack() {
this.top = null;
}
Stack.prototype.push = function(data){
let node = new Node(data);
if(this.top == null){
@segaz2002
segaz2002 / add_two_ln.js
Created November 27, 2021 20:15
Leet Code: Add Two Numbers
/**
* Definition for singly-linked list.
* function ListNode(val, next) {
* this.val = (val===undefined ? 0 : val)
* this.next = (next===undefined ? null : next)
* }
*/
/**
* @param {ListNode} l1
* @param {ListNode} l2
@segaz2002
segaz2002 / sleeping.py
Last active February 27, 2020 23:25
Sleeping Test
SCHEDULE_STRING = "Mon 01:00 - 23:00\nTue 01:00 - 23:00\nWed 01:00 - 23:00\nThu 01:00 - 23:00\nFri 01:00 - 23:00\nSat 01:00 - 23:00\nSun 01:00 - 21:00\n"
ONE_HOUR_IN_MINUTES = 60
def solution(s):
longest_time = 0
schedule_parts = [schedule for schedule in s.split("\n") if schedule != '']
for schedule in schedule_parts:
(day, allowance) = get_finish_time(schedule)
@segaz2002
segaz2002 / git-deployment.md
Created July 10, 2019 20:04 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@segaz2002
segaz2002 / delete_git_submodule.md
Created November 27, 2018 13:23 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
module HelloService {
const restify = require('restify');
const server = <any>restify.createServer({
name: 'hello-service',
version: '0.0.1'
});
const port = 4000;
server.use(restify.plugins.bodyParser());
server.use(decodeRequest);