Skip to content

Instantly share code, notes, and snippets.

@alash3al
alash3al / main.dart
Created March 24, 2022 12:34
elnews.app ui spaghetti code
import 'package:async_builder/async_builder.dart';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:responsive_framework/responsive_framework.dart';
import 'package:url_launcher/url_launcher.dart';
@p7cq
p7cq / Arch_Linux_Root_On_ZFS.md
Last active April 6, 2025 11:07
Install Arch Linux with Root on ZFS

Arch Linux Root on ZFS

Installation steps for running Arch Linux with root on ZFS using UEFI and systemd-boot. All steps are run as root.

Requires an Arch Linux image with ZFS built-in (see References).

In live environment

If using KVM, add a Serial number for each virtual disk and reboot the VM. The disks should now be available in /dev/disk/by-id as virtio-<Serial>.

@kylefox
kylefox / attachment-utils.js
Created October 17, 2018 15:58
Convert Base64 data URLs to File objects for Trix attachments
window.AttachmentUtils = (function() {
var BASE64_MARKER = ';base64,';
var Utils = {
// Takes a file size (in bytes) and returns a human-friendly string representation.
humanFileSize: function(size) {
if(size < 1) return "0 bytes";
// http://stackoverflow.com/a/20732091
package main
import (
"os"
"log"
"crypto/tls"
"crypto/x509"
)
func vpc(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {
@MauricioMoraes
MauricioMoraes / access_postgresql_with_docker.md
Last active August 30, 2024 05:21
Allow Docker Container Access to Host's Postgres Database on linux (ubuntu)

You have to do 2 things in order to allow your container to access your host's postgresql database

  1. Make your postgresql listen to an external ip address
  2. Let this client ip (your docker container) access your postgresql database with a given user

Obs: By "Host" here I mean "the server where docker is running on".

Make your postgresql listen to an external ip address

Find your postgresql.conf (in case you don't know where it is)

$ sudo find / -type f -name postgresql.conf

@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 12, 2025 06:26
Hyperlinks in Terminal Emulators
@tkrajina
tkrajina / unmarshal_interface.go
Last active March 24, 2025 01:02
Unmarshal JSON to specific interface implementation
package main
import (
"encoding/json"
"fmt"
"reflect"
)
type Something interface{}
@anselm-helbig
anselm-helbig / caching.rb
Created August 25, 2016 14:38
memoize macro for ruby
module Caching
def cache(method)
mod = Module.new do
define_method(method) do |*args, &block|
instance_variable_get("@#{method}") ||
instance_variable_set("@#{method}", super(*args, &block))
end
end
prepend mod
end
@littlemove
littlemove / my-ruby.el
Created March 18, 2016 11:40
Spacemacs: Code folding for ruby-mode
;; Code folding
(add-hook 'ruby-mode-hook
(lambda () (hs-minor-mode)))
(eval-after-load "hideshow"
'(add-to-list 'hs-special-modes-alist
`(ruby-mode
,(rx (or "def" "class" "module" "do" "{" "[")) ; Block start
,(rx (or "}" "]" "end")) ; Block end
,(rx (or "#" "=begin")) ; Comment start
@ParthDesai
ParthDesai / generic_demo.go
Last active September 3, 2021 09:54
Generic map function in golang
package main
import (
"fmt"
"reflect"
)
func main() {
r := genericMap([]int{1, 2, 3, 4}, func(x int) string {
return "Hello"