Skip to content

Instantly share code, notes, and snippets.

@dafma
dafma / Faceswap
Created April 29, 2016 21:00 — forked from smeschke/Faceswap
#import necessary libraries
import cv2
import numpy as np
#capture video from the webcam
cap = cv2.VideoCapture(0)
#load the face finder
face_cascade = cv2.CascadeClassifier('/home/sm/Desktop/haarcascade_frontalface_default.xml')
"""
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array A = [1,1,1,2,2,3],
Your function should return length = 5, and A is now [1,1,2,2,3].
"""
@dafma
dafma / servers-python
Created August 19, 2016 19:17 — forked from solidfounds/servers-python
execute server with python
#python 2.7*
python -m SimpleHTTPServer 8000
#python 3.*
python -m http.server 8000
@dafma
dafma / .gitignore-global
Created August 19, 2016 19:17 — forked from solidfounds/.gitignore-global
Global .gitignore file focused on PyCharm
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc
@dafma
dafma / django-jquery-demo.py
Created August 29, 2017 21:33 — forked from pebreo/django-jquery-demo.py
jQuery AJAX + Django SIMPLE DEMO
# views.py - django app called ajx
from django.shortcuts import render, get_object_or_404, redirect, HttpResponse, render_to_response, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth import authenticate, login
import json
def mygetview(request):
if request.method == 'GET':
@dafma
dafma / main.dart
Created August 31, 2020 01:49 — forked from ffeu/main.dart
Flutter Main Example with StreamBuilder
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(