Skip to content

Instantly share code, notes, and snippets.

@jeb2239
jeb2239 / code.py
Last active November 12, 2020 15:38
medhi/code.py
‎‎​
UP=3
LEFT=2
DOWN=1
RIGHT=0
DIRS = [(0,1),(1,0),(0,-1),(-1,0)]
def spiral_copy(inputMatrix):
class Solution:
# you need startIdx for this prob
def countVowelStrings(self, n: int) -> int:
vowels = ['a','e','i','o','u']
result=[]
def cvs(curr,n,startIdx):
if n==1:
result.append(curr)
return 1
@jeb2239
jeb2239 / ac.py
Created November 4, 2020 19:56
mehdi
#!/bin/python3
import math
import os
import random
import re
import sys
import functools
#
# Complete the 'passwordCracker' function below.
@jeb2239
jeb2239 / lesson.py
Last active November 4, 2020 16:24
lesson
‎‎​
@jeb2239
jeb2239 / main.cc
Created October 31, 2020 20:00
read binary file in c
#include <stdio.h>
/* random record description - could be anything */
struct rec
{
int x,y,z;
};
/* writes and then reads 10 arbitrary records
from the file "junk". */
@jeb2239
jeb2239 / EventDispatcher.cpp
Created October 21, 2020 23:51 — forked from sansumbrella/EventDispatcher.cpp
C++ observer pattern for event handling.
#include "EventDispatcher.h"
void EventDispatcher::addListener( Listener *l )
{
mListeners.push_back(l);
}
void EventDispatcher::removeListener( Listener *l )
{
mListeners.erase( std::remove( mListeners.begin(), mListeners.end(), l ), mListeners.end() );
@jeb2239
jeb2239 / main.cpp
Created September 20, 2020 15:58 — forked from wangyangkobe/main.cpp
Akuna Capital (Shanghai) C++ Coding Challenge For Regular Program
#include <iostream>
#include <fstream>
#include <stdint.h>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#pragma pack(push)
@jeb2239
jeb2239 / IP2Hex.py
Created July 2, 2020 20:04 — forked from LuoZijun/IP2Hex.py
IPv4 Address to a 32-bit integer value
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
IPv4 addresses to a 32-bit integer value
Document: https://en.wikipedia.org/wiki/IPv4#Address_representations
IPv4 addresses may be in any notation expressing a 32-bit integer value,
barriosj@ThinkPad-W530 [03:07:27 PM] [~/go_bazel_project] [master *]
-> % bazel coverage -s //src/...
INFO: Using default value for --instrumentation_filter: "//src".
INFO: Override the above default with --instrumentation_filter
INFO: Analysed 3 targets (21 packages loaded).
INFO: Found 2 targets and 1 test target...
SUBCOMMAND: # //src:go_default_test [action 'Creating runfiles tree bazel-out/k8-fastbuild/bin/src/linux_amd64_stripped/go_default_test.runfiles']
(cd /home/barriosj/.cache/bazel/_bazel_barriosj/b790a967df273339965ace6e27b0005e/execroot/__main__ && \
exec env - \
_bin/build-runfiles bazel-out/k8-fastbuild/bin/src/linux_amd64_stripped/go_default_test.runfiles_manifest bazel-out/k8-fastbuild/bin/src/linux_amd64_stripped/go_default_test.runfiles)