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
# Read the input from the file | |
with open("input.txt") as f: | |
rucksacks = f.readlines() | |
# Initialize the sum of priorities to 0 | |
sum_of_priorities = 0 | |
# Loop over each rucksack | |
for rucksack in rucksacks: | |
# Split the rucksack into two compartments |
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 Foundation | |
import ShellOut | |
do { | |
try shellOut(to: "SwitchAudioSource -a") | |
} catch { | |
print("Couldn't find SwitchAudioSource.") | |
print("Please install switchaudio-osx via homebrew.") | |
exit(1) | |
} |
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 SwiftUI | |
struct MapView: UIViewRepresentable { | |
var coordinate: CLLocationCoordinate2D | |
func makeUIView(context: Context) -> MKMapView { | |
MKMapView(frame: .zero) | |
} | |
func updateUIView(_ view: MKMapView, context: Context) { |
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 | |
import csv | |
import re | |
import datetime | |
from time import mktime | |
from tweepy import OAuthHandler | |
from tweepy import API |
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/sh | |
# Supported desktop environments | |
# 1. Aqua (MacOS) | |
# 2. Gnome | |
# 3. Unity | |
# 4. Feh | |
# 5. xfce4 | |
# 6. KDE |
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
enum TestErr { | |
MuchFatalSuchWow, | |
} | |
fn return_result() -> Result<String, TestErr> { | |
// String::new() // doesn't work | |
// TestErr::MuchFatalSuchWow // doesn't work | |
Err(TestErr::MuchFatalSuchWow) | |
} |
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
POST http://webapi.vvo-online.de/dm?format=json | |
Accept: application/json, text/plain, */* | |
{ | |
"stopid": "33000037", | |
"time": "2016-11-13T16:01:12Z", | |
"isarrival": false, | |
"limit": 30, | |
"shorttermchanges": true, |
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
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"html" | |
"io/ioutil" | |
"net/http" | |
"os" |
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 <Foundation/Foundation.h> | |
@interface Person : NSObject | |
{ | |
@private char *name; | |
} | |
@property (readwrite, assign) char *name; | |
- (void)sayHello; | |
@end |
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 xcrun swift | |
import Foundation | |
struct Pod { | |
let source: String | |
let name: String | |
let version: String | |
let platforms: String |
NewerOlder