Skip to content

Instantly share code, notes, and snippets.

View segabor's full-sized avatar

Gábor Sebestyén segabor

View GitHub Profile
@segabor
segabor / whisper_reader.swift
Created March 26, 2020 20:16
Sample Swift code to read out data points from Whisper database file
import Foundation
guard let handler = InputStream(fileAtPath: "./measurement/temperature/0.wsp") else {
exit(1)
}
handler.open()
func readInt(_ handler: InputStream) -> UInt32 {
let uint8Pointer = UnsafeMutablePointer<UInt8>.allocate(capacity: 4)
@segabor
segabor / lorinc_ogimet.csv
Created January 7, 2020 16:45
Transform time series data saved into csv file to influxdb import
datumsec T Td Tmin12 Tmax12 p pmsl pch ptend rr6 rr12 rr24 VV ww W1 W2 sun sunday N dd ff ffx ffmin6 ffmean6 ffmax6 ff6 ffx6
1561939200 190 162 10029 10194 1 2 0 12 10
1561942800 182 158 10026 10191 -1 7 11 20
1561946400 175 155 10023 10188 -6 7 11 20
1561950000 172 154 10020 10186 -9 7 11 20
1561953600 181 154 10017 10182 -9 7 12 20
1561957200 203 159 10015 10179 -8 7 12 20
1561960800 230 163 172 10014 10176 -6 7 0 51480 16 20
1561964400 256 170 10016 10177 -1 7 16 10
1561968000 268 170 10016 10176 1 2 20 20
@segabor
segabor / CFSystemDirectories.c.o
Last active June 12, 2019 20:28
Pre-compiled swift-corelibs-foundation/CoreFoundation/Base.subproj/CFSystemDirectories.c
This file has been truncated, but you can view the full file.
# 1 "/home/segabor/Workspace/swift-dev/swift-corelibs-foundation/CoreFoundation/Base.subproj/CFSystemDirectories.c"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
#define __llvm__ 1
#define __clang__ 1
#define __clang_major__ 7
#define __clang_minor__ 0
#define __clang_patchlevel__ 0
#define __clang_version__ "7.0.0 (git@github.com:apple/swift-clang.git 076cdf40b84865779fabfe0c492a92cd9a5b3b93) (git@github.com:apple/swift-llvm.git 606965a6c87fbff74ee6700657ae5901c76c109c)"
#define __GNUC_MINOR__ 2
#!/bin/bash
today=$(date +%Y%m%d)
stopId='BKK_F04217'
curl -s "http://futar.bkk.hu/bkk-utvonaltervezo-api/ws/otp/api/where/schedule-for-stop.json?key=apaiary-test&version=3&ap
pVersion=apiary-1.0&includeReferences=false&stopId=${stopId}&onlyDepartures=true&date=${today}" \
| jq -e '.data.entry.schedules[] | .directions[] | select(.directionId == "1") | .stopTimes[]'
@segabor
segabor / build_sourcekit_lsp.sh
Created January 7, 2019 11:56
Build SourceKit_LSP on Arch Linux
#!/bin/bash
SWIFT_HOME=${HOME}/.swiftenv/versions/swift-5.0-DEVELOPMENT-SNAPSHOT-2019-01-04-a
env CCC_OVERRIDE_OPTIONS="#x-fmodules s/-fmodules-cache-path.*//" \
${SWIFT_HOME}/usr/bin/swift build \
-Xcxx -I${SWIFT_HOME}/usr/lib/swift
@segabor
segabor / buid_swift_snapshot.sh
Last active September 26, 2019 12:19
Build Swift 5.x snapshot on Arch Linux
#!/bin/bash
# SNAPSHOT=5.1-DEVELOPMENT-SNAPSHOT-2019-09-16-a
SNAPSHOT=5.1-RELEASE
if [ ! -d swift ]
then
echo Please clone Swift language source
echo run
echo git clone https://github.com/apple/swift.git
echo or
@segabor
segabor / gist:cd08eae2ce8717a1e4f8476687d98221
Created September 4, 2018 08:59
Build Swift 4.2-dev on Arch Linux
#!/bin/bash
# Build Swift on Arch Linux
# Original post I followed https://akrabat.com/compiling-swift-on-linux/.
# [1] Checking out repo
mkdir swift-dev
cd swift-dev/
git clone git@github.com:apple/swift.git
@segabor
segabor / fcgi_app.swift
Last active September 25, 2015 06:32
A simple FastCGI PoC written in Swift
/***
Swift can say hello to your browser!
Requirements
------------
* OSX Yosemite or newer
* Xcode 7, Swift 2
* Homebrew
@segabor
segabor / main.swift
Created September 13, 2015 06:57
An UDP Server implementation in Swift
//
// main.swift
// UDP Server example
//
// Created by Sebestyén Gábor on 2015. 09. 12..
//
// Original source: http://www.cs.ucsb.edu/~almeroth/classes/W01.176B/hw2/examples/udp-server.c
import Foundation