Skip to content

Instantly share code, notes, and snippets.

View XavierChanth's full-sized avatar

Xavier Chanthavong XavierChanth

View GitHub Profile
@XavierChanth
XavierChanth / Atserver_quick_authentication.md
Last active November 27, 2024 15:42
atserver quick authentication script

AtServer quick authentication scripts

Requirements:

Scripts

atdirectory

@XavierChanth
XavierChanth / atserver.sh
Last active February 23, 2024 02:56
The magic atserver script.
atdirectory() {
head -n 1 < <(openssl s_client -connect root.atsign.org:64 -quiet -verify_quiet < <(echo "$1"; sleep 1; echo "@exit") 2>/dev/null)
}
atserver() {
pkam_command="at_pkam"
atsign="$1"
if [[ ${atsign:0:1} != "@" ]] ; then
atsign="@$atsign"
fi
@XavierChanth
XavierChanth / download
Created January 13, 2024 10:45 — forked from evanrelf/download
Offline Advent of Code
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'
if [ "$#" -ne 1 ]; then
echo "usage: ./download <year>" >&2
exit 1
fi
@XavierChanth
XavierChanth / http hello world one-shot server
Last active October 2, 2023 20:32 — forked from kevn-xyz/ncws
Simple netcat based one shot http file server
#!/bin/bash
{ echo -ne "HTTP/1.0 200 OK\r\nContent-Disposition: inline; filename=\"hello.txt\"\r\nContent-Length: 13\r\n\r\n"; echo \"Hello World\!\"; } | nc -l 8080
@XavierChanth
XavierChanth / main.dart
Created September 28, 2023 19:51
zealous-flash-8405
import 'dart:async';
void main() {
D().dispose();
}
abstract class A {
FutureOr<void> dispose();
}
@XavierChanth
XavierChanth / settings.json
Created June 26, 2023 16:39
My VSCode Settings
{
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "yzhang.markdown-all-in-one"
},
"[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml"
},
@XavierChanth
XavierChanth / rc
Created February 9, 2023 19:42
GitHub clone command
clone () {
REPO=$1
shift
if [[ $REPO =~ ^(git@github\.com:.*|https:\/\/github\.com\/.*)$ ]]
then
prefix=""
else
prefix="[email protected]:"
fi
git clone "$prefix$REPO" "$@"
@XavierChanth
XavierChanth / example.dart
Last active August 12, 2022 04:56
A nicer pattern for Dart beans.
import 'dart:io';
// Enum as status Pattern (Approach 1)
enum MyStatusEnum { one, two, three }
class SmellyBean {
MyStatusEnum myStatus;
final String? onlyOnOne;

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@XavierChanth
XavierChanth / home_screen.dart
Created March 5, 2022 23:58
Instant Onboarding Demo
import 'package:at_client_mobile/at_client_mobile.dart';
import 'package:flutter/material.dart';
// * Once the onboarding process is completed you will be taken to this screen
class HomeScreen extends StatelessWidget {
const HomeScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
// * Getting the AtClientManager instance to use below