Skip to content

Instantly share code, notes, and snippets.

View gootik's full-sized avatar

Sasan Hezarkhani gootik

View GitHub Profile
uid=0(root) gid=0(wheel) groups=0(wheel),1(daemon),2(kmem),3(sys),4(tty),5(operator),8(procview),9(procmod),12(everyone),20(staff),29(certusers),61(localaccounts),80(admin),33(_appstore),98(_lpadmin),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),701(com.apple.sharepoint.group.1)
rm -f ../String.o ../StringImpl.o ../StringBuilder.o ../StringView.o ../LogStream.o ../JsonArray.o ../JsonObject.o ../JsonValue.o ../JsonParser.o ../FileSystemPath.o ../URL.o ../Utf8View.o
rm -f TestString TestQueue TestVector TestHashMap TestJSON TestWeakPtr TestNonnullRefPtr TestRefPtr TestFixedArray TestFileSystemPath TestURL TestStringView TestUtf8
rm -f ../String.o ../StringImpl.o ../StringBuilder.o ../StringView.o ../LogStream.o ../JsonArray.o ../JsonObject.o ../JsonValue.o ../JsonParser.o ../FileSystemPath.o ../URL.o ../Utf8View.o
rm -f TestString TestQueue TestVector TestHashMap TestJSON TestWeakPtr TestNonnullRefPtr TestRefPtr Test
# getMissingNo takes list as argument
def getMissingNo(A):
n = len(A)
total = (n+1)*(n+2)/2
sum_of_A = sum(A)
return total - sum_of_A
# Driver program to test above function
A = [1, 2, 4, 5, 6]
miss = getMissingNo(A)
@gootik
gootik / test.erl
Last active October 6, 2017 14:27
Testing map timing
-module(test).
-compile([export_all]).
map_time() ->
Map = #{a => true,
b => true,
c => true,
p => true,
e => true,
Courtesy of Mike Duffy, owner and head trainer at Mike Duffy's Personal Training Studio.
Round One:
> Burpees
> Mountain Climbers
> Jumping Jacks
Three circuits: 10 reps first round, 15 reps second round and 20 reps third round. Non-stop no rests.
> Jump rope 3 minutes
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0013)http://cb.vu/ -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>[www@cb.vu]~&gt;</title>
<link rel="icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AOBfLwBbX14AWxgYABg8RwC/g14AGBgYAL9OJAB8KhgAfHFeAOCDUgC/g0cAGCo7AOCDXgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
import random
import requests
import shutil
# Get the number of the latest xkcd
current_xkcd_num = int(requests.get('http://xkcd.com/info.0.json').json()['num'])
# Generate a random number using rng.py (expecting a natural number)
# Mod it by current_xkcd_num to give us the number of a valid xkcd comic
## Get the URL of the image of the random comic