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 threading, logging, traceback | |
import sys, time | |
class LiveThread(threading.Thread): | |
def __init__(self, function_to_quit_the_process, thread_wait_in_seconds=1, | |
clean_up_wait_in_seconds=1, group=None, target=None, name="LiveThread", | |
args=(), kwargs={}, verbose=None, clean_up=None): | |
threading.Thread.__init__(self, group=group, target=target, name=name, | |
args=args, kwargs=kwargs, verbose=verbose) | |
self._function_to_quit_the_process = function_to_quit_the_process |
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 python | |
from os import listdir | |
from os.path import isfile, join | |
from subprocess import Popen, PIPE, STDOUT, call | |
import MySQLdb | |
import MySQLdb.cursors | |
import types | |
import warnings |
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
let fibonacci = { | |
[Symbol.iterator]() { | |
let pre = 0, cur = 1; | |
return { | |
next(p) { | |
console.log(p); | |
pre = cur | |
cur = pre + cur | |
//[pre, cur] = [cur, pre + cur]; | |
if (cur < 100) { |
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
var arr = [4,5,6,7,8,9]; | |
for (var v of arr) { | |
console.log( v ); | |
} | |
// 4 5 6 7 8 9 | |
// define iterator that only produces values | |
// from odd indexes | |
arr[Symbol.iterator] = function*() { | |
var idx = 1; | |
do { |
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
# well not sure how far u wanted that to go.. | |
# I had to google some quick info/docs. for ex forgot method notation meaning of ! | |
# Otherwise I think import stuff should be here. Relationships of models (which I am not 100% on but | |
# I would figure it out from docs if spent more time..), business logic, exceptions and | |
# transactions.. | |
# I havent used rails in a while so little rusty but I know I could always get back up to speed | |
# really quick.. Had to learn React this week for ex.. | |
# Hope its good enough, left a lot of comments to explain the craziness. Thanks for your time |
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
downloadEmbededVideos(); | |
/** | |
* Finds and downloads all embeded Vimeo videos. | |
*/ | |
function downloadEmbededVideos() { | |
// Find Vimeo embed frame | |
var embedFrames = document.querySelectorAll('iframe[src*="player.vimeo.com"]'); | |
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
/* Original is 1600px by 1200px */ | |
/* I want width of 900pxxso */ | |
/* (90x0/1600)*1200 = 675px */ | |
/* Surface area of back is then */ | |
/* 900 * 675 = 607500 */ | |
/* 607500 / ( 10 * 10) = */ | |
/* 6075 */ | |
/* 607500/50 = 12150 */ |
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
<canvas id="canvas" style="position:absolute; top:0; left:0;"></canvas> | |
<div id="buffer" style="display:none;"> |
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
<canvas id="canvas" style="position:absolute; top:0; left:0;"></canvas> | |
<div id="buffer" style="display:none;"> |
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
#!/bin/bash | |
# IMPORTANT: You will need to disable SIP aka Rootless in order to fully execute this script, you can reenable it after. | |
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars. | |
# Get active services: launchctl list | grep -v "\-\t0" | |
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents | |
# Agents to disable | |
TODISABLE=('com.apple.security.keychainsyncingoveridsproxy' 'com.apple.personad' 'com.apple.passd' 'com.apple.screensharing.MessagesAgent' 'com.apple.CommCenter-osx' 'com.apple.Maps.mapspushd' 'com.apple.Maps.pushdaemon' 'com.apple.photoanalysisd' 'com.apple.telephonyutilities.callservicesd' 'com.apple.AirPlayUIAgent' 'com.apple.AirPortBaseStationAgent' 'com.apple.CalendarAgent' 'com.apple.DictationIM' 'com.apple.iCloudUserNotifications' 'com.apple.familycircled' 'com.apple.familycontrols.useragent' 'com.apple.familynotificationd' 'com.apple.gamed' 'com.apple.icloud.findmydeviced.findmydevi |
OlderNewer