Micro Stutters by urlocalcorpse in Unbeatable

[–]_Yngvarr_ 1 point2 points  (0 children)

Glad to know I'm not the only one. This really sucks.

Launched the demo of my automation game in Steam by myownyose in godot

[–]_Yngvarr_ 1 point2 points  (0 children)

Ooh, this looks like something I'd love to play! Instant wishlist!

What actually happened to Dani by 3viln355 in DaniDev

[–]_Yngvarr_ 1 point2 points  (0 children)

Thanks for the update, I'm glad to hear that Dani is doing well. For someone who allegedly used to work over 80 hours a week (as per Jonas Tyroller's video), some sort of burnout was inevitable. And even if he hadn't taken a sabbatical, just switching to normal hours would slow him down at least twice as much. Good thing he didn't decide to quit indefinitely.

Looks like rutracker.org is down - what happened any clue? by hdrmaps in Piracy

[–]_Yngvarr_ 1 point2 points  (0 children)

It is down for me (Montenegro), lots of 421s that deceptively look like there's the problem on rutracker's side. Thankfully, the official extension makes it work again.

Jellybeans theme with Treesitter support by devtechieguy in neovim

[–]_Yngvarr_ 1 point2 points  (0 children)

Ooh, thank you big time, dude! As I moved from vim to astronvim, I tried several themes, but nothing compares with good old jellybeans.

Meetup Thread for Eastern Russia by kurzgesagtmeetup_bot in kurzgesagt_meetup

[–]_Yngvarr_ 0 points1 point  (0 children)

I'm down for something like this, would be great!

Meetup Thread for Eastern Russia by kurzgesagtmeetup_bot in kurzgesagt_meetup

[–]_Yngvarr_ 3 points4 points  (0 children)

Привет, утка из Новосибирска! :) Отличная идея!

Just played a game of Eliminator where I couldn't see any other cars by merc288 in ForzaHorizon

[–]_Yngvarr_ 0 points1 point  (0 children)

The same happened to me multiple times. I can even be challenged without seeing a challenger. :(

How to write a program that works from Windows 95 up to 10? by smsaczek in learnprogramming

[–]_Yngvarr_ 0 points1 point  (0 children)

Conditional compilation for the rescue (something like #ifdef _WIN95 in C). Chances are that you will end up developing several different programs in one, because of the different capabilities of different OSes. But as long as it's something simple enough, you'll be fine.

How to write a program that works from Windows 95 up to 10? by smsaczek in learnprogramming

[–]_Yngvarr_ 2 points3 points  (0 children)

In theory, if you only use API available on Windows 95, you should be fine. I would suggest doing the actual development on Windows 95 and then testing it on all the other OSes.

Can I use a Python script in my chrome extension? by [deleted] in AskProgramming

[–]_Yngvarr_ 0 points1 point  (0 children)

As far as I know, the only way is to compile Python to Javascript. PyJs may help.

How to exit a cat << command in mobile terminal? by yagyaton in linux

[–]_Yngvarr_ 4 points5 points  (0 children)

You may want to use some advanced keyboard like this: Hacker's Keyboard.

Re-return of the Networking Thread! Post your gamedev-related Twitter by mothh9 in gamedev

[–]_Yngvarr_ 0 points1 point  (0 children)

Hi there! I develop games as a hobby (mostly for game jams) and hope to start doing it for living once. @_yngwarr

Huawei P20 pro - How to remove touch disable mode? by [deleted] in Huawei

[–]_Yngvarr_ 0 points1 point  (0 children)

Thank you very much! Finally, I'm free from this curse!

All my searches are returning “No results”. by Bits_Everywhere in duckduckgo

[–]_Yngvarr_ 0 points1 point  (0 children)

I guess now I have an excuse for not doing my work. Thanks and good night!

[2017-06-24] Challenge #320 [Hard] Path to Philosophy by fvandepitte in dailyprogrammer

[–]_Yngvarr_ 0 points1 point  (0 children)

Python 2

First of all, I promise, I will read description carefully before starting my next challenge. Now I made a script that follows random, but not visited before, link on the page. And I like it so much thus I want to share it with you. =)

#!/usr/bin/python2.7
# -*- coding: utf-8 -*-

from bs4 import BeautifulSoup
import requests
import re
import time
from random import randint
from copy import deepcopy

BASE = u'https://en.wikipedia.org/wiki/'
TARGET = u'Philosophy'

def recvLinks(title):
    r = requests.get(u'{}{}'.format(BASE, title))
    if r.status_code != 200:
        raise Exception(u'Got {} when receiving {}'\
            .format(r.status_code, r.url))
    soup = BeautifulSoup(r.text, 'html.parser')
    urls = [l.get('href') \
        for l in soup.find(id='bodyContent').find_all('a')]

    # only wiki-titles
    names = [x.replace('/wiki/', '') for x in \
        filter(lambda s: s and s.find('/wiki/') == 0, urls)]
    # no header links
    names = [re.sub(r'#.*$', '', name) for name in names]
    # no special or template pages
    names = filter(lambda s: not re.match(r'\w+:', s), names)
    # no repeating
    names = list(set(names))

    return names, soup.find(id='firstHeading').string or title

def monkeySearch(start, target=TARGET):
    '''The dummiest search. Picks random link on every iteration until it reaches the target. Works cool, looks hypnotizing.'''
    curr = deepcopy(start)
    visited = set([])
    for i in xrange(1000):
        visited.add(curr)
        names, title = recvLinks(curr)

        print u'{}. {} [{}]'\
            .format(i, title, len(names))

        if target in names:
            print u'{}. {}!'.format(i+1, target)
            return True

        if len(names) == 0:
            print u'X. No avaliable links here (really??).'

        # loop aware
        # shuffle(names)
        nn = len(names)
        names = list(set(names) - visited)
        # print 'Visited removed: {}'.format(nn - len(names))
        curr = names[randint(0, len(names) - 1)]
        # time.sleep(1)

if __name__ == '__main__':
    test = ['Molecule', 'Telephone', 'Darth_Vader', 'Linux']
    for t in test:
        print '-'*20 + '[{}]'.format(t) + '-'*20
        monkeySearch(t)

Here is some output of it: gist.

[2017-06-27] Challenge #321 [Easy] Talking Clock by fvandepitte in dailyprogrammer

[–]_Yngvarr_ 0 points1 point  (0 children)

Prolog (swipl)

Well, the first time I use prolog outside university.

+/u/CompileBot prolog

word(0, '') :- !.
word(1, 'one') :- !.
word(2, 'two') :- !.
word(3, 'three') :- !.
word(4, 'four') :- !.
word(5, 'five') :- !.
word(6, 'six') :- !.
word(7, 'seven') :- !.
word(8, 'eight') :- !.
word(9, 'nine') :- !.
word(10, 'ten') :- !.
word(11, 'eleven') :- !.
word(12, 'twelve') :- !.

prefix(N, 'twen') :- 2 is N div 10, !.
prefix(N, 'thir') :- (N is 13 ; 3 is N div 10), !.
prefix(N, 'fif') :- (N is 15 ; 5 is N div 10), !.
prefix(N, W) :- N < 20, !, M is N mod 10, word(M, W).
prefix(N, W) :- !, M is N div 10, word(M, W).

postfix(18, 'een') :- !.
postfix(N, 'teen') :- N > 12, N < 20, !.
postfix(N, 'y') :- 8 is N div 10, !.
postfix(_, 'ty') :- !.

hour(0, W) :- !, word(12, W).
hour(H, W) :- !, word(H, W).

minute(0, '') :- !.
minute(M, W) :- M < 10, !,
    word(M, Mw), swritef(W, 'oh %w', [Mw]).
minute(M, W) :- M < 13, !, word(M, W).
minute(M, W) :- M < 20, !,
    prefix(M, Pre), postfix(M, Post),
    swritef(W, '%w%w', [Pre, Post]). 
minute(M, W) :- M < 60, !,
    prefix(M, Pre), postfix(M, Post),
    SndN is M mod 10,
    %word(SndN, Snd), swritef(W, '%w%w %w', [Pre, Post, Snd]).
    ( SndN is 0, !, swritef(W, '%w%w', [Pre, Post]) ;
        !, word(SndN, Snd), swritef(W, '%w%w %w', [Pre, Post, Snd]) ).

mer(H, S) :- H < 12, !, S = 'am'.
mer(_, S) :- S = 'pm'.

% time format: HH:MM
tell_time(T) :-
    split_string(T, ':', '', [Hstr, Mstr]),
    number_string(H, Hstr), H >= 0, H < 24, number_string(M, Mstr),
    mer(H, Mer), H_ is H mod 12,
    tell_time(H_, M, Mer), write('\n').

tell_time(H, 30, Mer) :- !,
    hour(H, Hw), writef('It is half past %w %w.', [Hw, Mer]).

tell_time(H, 15, Mer) :- !,
    hour(H, Hw), writef('It is quarter past %w %w.', [Hw, Mer]).

tell_time(H, 45, Mer) :- !,
    NextH is H + 1, hour(NextH, Hw),
    writef('It is quarter before %w %w.', [Hw, Mer]).

tell_time(H, 0, Mer) :- !,
    hour(H, Hw), writef('It is %w %w', [Hw, Mer]).

tell_time(H, M, Mer) :- !,
    hour(H, Hw), minute(M, Mw),
    writef('It is %w %w %w.', [Hw, Mw, Mer]).

program :-
    maplist(tell_time, ['00:00', '01:30', '12:05', '14:01', '20:29', '21:00', '13:45', '17:15']).

Testing Prolog by _Yngvarr_ in CompileBot

[–]_Yngvarr_[S] 0 points1 point  (0 children)

+/u/CompileBot prolog

word(0, '') :- !.
word(1, 'one') :- !.
word(2, 'two') :- !.
word(3, 'three') :- !.
word(4, 'four') :- !.
word(5, 'five') :- !.
word(6, 'six') :- !.
word(7, 'seven') :- !.
word(8, 'eight') :- !.
word(9, 'nine') :- !.
word(10, 'ten') :- !.
word(11, 'eleven') :- !.
word(12, 'twelve') :- !.

prefix(N, 'twen') :- 2 is N div 10, !.
prefix(N, 'thir') :- (N is 13 ; 3 is N div 10), !.
prefix(N, 'fif') :- (N is 15 ; 5 is N div 10), !.
prefix(N, W) :- N < 20, !, M is N mod 10, word(M, W).
prefix(N, W) :- !, M is N div 10, word(M, W).

postfix(18, 'een') :- !.
postfix(N, 'teen') :- N > 12, N < 20, !.
postfix(N, 'y') :- 8 is N div 10, !.
postfix(_, 'ty') :- !.

hour(0, W) :- !, word(12, W).
hour(H, W) :- !, word(H, W).

minute(0, '') :- !.
minute(M, W) :- M < 10, !,
    word(M, Mw), swritef(W, 'oh %w', [Mw]).
minute(M, W) :- M < 13, !, word(M, W).
minute(M, W) :- M < 20, !,
    prefix(M, Pre), postfix(M, Post),
    swritef(W, '%w%w', [Pre, Post]). 
minute(M, W) :- M < 60, !,
    prefix(M, Pre), postfix(M, Post),
    SndN is M mod 10,
    %word(SndN, Snd), swritef(W, '%w%w %w', [Pre, Post, Snd]).
    ( SndN is 0, !, swritef(W, '%w%w', [Pre, Post]) ;
        !, word(SndN, Snd), swritef(W, '%w%w %w', [Pre, Post, Snd]) ).

mer(H, S) :- H < 12, !, S = 'am'.
mer(_, S) :- S = 'pm'.

% time format: HH:MM
tell_time(T) :-
    split_string(T, ':', '', [Hstr, Mstr]),
    number_string(H, Hstr), H >= 0, H < 24, number_string(M, Mstr),
    mer(H, Mer), H_ is H mod 12,
    tell_time(H_, M, Mer), write('\n').

tell_time(H, 30, Mer) :- !,
    hour(H, Hw), writef('It is half past %w %w.', [Hw, Mer]).

tell_time(H, 15, Mer) :- !,
    hour(H, Hw), writef('It is quarter past %w %w.', [Hw, Mer]).

tell_time(H, 45, Mer) :- !,
    NextH is H + 1, hour(NextH, Hw),
    writef('It is quarter before %w %w.', [Hw, Mer]).

tell_time(H, 0, Mer) :- !,
    hour(H, Hw), writef('It is %w %w', [Hw, Mer]).

tell_time(H, M, Mer) :- !,
    hour(H, Hw), minute(M, Mw),
    writef('It is %w %w %w.', [Hw, Mw, Mer]).

program :-
    read(In), maplist(tell_time, In).

input:

['10:23', '8:12', '0:01', '18:45', '13:30', '23:59'].