Skip to content

Instantly share code, notes, and snippets.

@vanwagonet
vanwagonet / FlowStack.swift
Created March 4, 2022 20:33
Simple flow layout in SwiftUI
import SwiftUI
/// A view that arranges its children in horizontal lines
///
/// FlowStack {
/// ForEach(1..<100) { num in
/// Text(String(num))
/// .padding(8)
/// .background(Circle().fill(Color.red))
/// }
@swiftui-lab
swiftui-lab / SwiftUI-view-to-UIImage.swift
Created July 5, 2020 19:43
A method for converting a SwiftUI into a UIImage
//
// ContentView.swift
// Grabber
//
// SwiftUI-Lab
//
// For more information on the techniques used in this example, check
// The Power of the Hosting+Representable Combo (https://swiftui-lab.com/a-powerful-combo/)
import SwiftUI
@mecid
mecid / Calendar.swift
Last active May 5, 2024 08:43
SwiftUI Calendar view using LazyVGrid
import SwiftUI
extension Calendar {
func generateDates(
inside interval: DateInterval,
matching components: DateComponents
) -> [Date] {
var dates: [Date] = []
dates.append(interval.start)
@samuelsmal
samuelsmal / how-to-enable-notes-export-from-kobo.md
Last active March 21, 2024 09:54
how to export notes and highlights from kobo

steps

  1. connect kobo to your device
  2. open a file browser and navigate to the mounted kobo folder
  3. navigate to the hidden folder .kobo/Kobo
  4. open the file Kobo eReader.conf
  5. navigate to the section [FeatureSettings], if it doesn't exist, create it.
  6. add the line ExportHighlights=true and save
  7. disconnect the device
  8. now you can long press on a book and export the note file into a .txt file which will be saved alongside your books. to get it connect your ereader.
@stupidpupil
stupidpupil / GalliumOS on Edgar.markdown
Last active April 19, 2024 17:09
Guide to installing GalliumOS on an Acer Chromebook 14" (CB3-431) 'Edgar'

GalliumOS on Edgar

This document sets out how I installed GalliumOS 2.1 on a new Acer Chromebook 14" (CB3-431) 'Edgar' in April 2017. I installed GalliumOS on the internal eMMC storage, but left Chrome OS in place (allowing dual-booting).

It is meant to be an easy-to-follow and particularly thorough (if repetitive) guide, but I make no warranty that it will work correctly for you. It will wipe all data on your Edgar.

I have tried to provide references for each section; see the GalliumOS wiki guide to chrx installation for an overview of the general process.

⚠ Caution: There have been reports of Edgars' speakers overheating, due to a malfunction of the audio hardware, when booted into anything other than Chrome OS. I have not experienced this, and it seems to be believed that this will not now occur under GalliumOS. More information can be found in the comments for the [GalliumOS Braswell Platform Validation

@goyalankit
goyalankit / two-hour.service
Last active February 24, 2024 19:27
Systemd unit files to restart service every two hours.
[Unit]
Description=Service that restarts my spread_goodness.service every two hours.
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl try-restart spread_goodness.service
@andrewmusselman
andrewmusselman / data-sci-eng.md
Last active March 7, 2016 19:23
Data Scientist and Engineer Job Descriptions

Job title – Data Scientist

Basic Qualifications

  1. Bachelor’s Degree in Mathematics, Technical Science, Computer Science (or equivalent) or Engineering
  2. Minimum 1 year programming experience in at least one item from each:
  • R, SAS,Mathematica, MATLAB, Sagemath
  • Python, Ruby, Perl, Java, Scala
  • Linux
  • Bash scripting including sed, awk, cut, uniq, sort, tr
@mplewis
mplewis / flask-uwsgi-nginx-primer.md
Last active October 24, 2022 19:20
Flask + uWSGI + nginx Primer. I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

Flask + uWSGI + nginx Primer

I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

How this shit works

  • Flask is managed by uWSGI.
  • uWSGI talks to nginx.
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 6, 2024 12:37
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@ksafranski
ksafranski / Common-Currency.json
Last active April 22, 2024 15:16
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},