Skip to content

Instantly share code, notes, and snippets.

View nyinyithann's full-sized avatar
🍍

Nyi Nyi nyinyithann

🍍
  • ahrefs
  • Singapore
  • 22:40 (UTC -12:00)
View GitHub Profile
@nyinyithann
nyinyithann / setup_cursor_ubuntu.md
Created May 30, 2025 02:53 — forked from evgenyneu/setup_cursor_ubuntu.md
Install Cursor AI code editor on Ubuntu 24.04 LTS

Install Cursor AI editor on Ubuntu 24.04

  1. Use the Download button on www.cursor.com web site. It will download the NAME.AppImage file.

  2. Copy the .AppImage file to your Applications directory

cd ~/Downloads
mkdir -p ~/Applications
mv NAME.AppImage ~/Applications/cursor.AppImage
@nyinyithann
nyinyithann / macos-app-icon.md
Created January 20, 2025 13:06 — forked from ansarizafar/macos-app-icon.md
How to create an .icns macOS app icon
@nyinyithann
nyinyithann / gadt.res
Created November 26, 2022 19:56
GADT ReScript
%%raw(
"/*
* this js function will work under both [string] and [float]
*/
function add (x,y){
return x + y;
}")
type rec t<_> = | String : t<string> | Float : t<float>
@nyinyithann
nyinyithann / gist:072077a9ab67f62c4df2ae6e2728a74f
Created January 20, 2022 16:14
TailwindColor Hex Value to RGB
const tailwindColors = {
foo: {
50: '#f9fafb',
100: '#f3f4f6',
200: '#e5e7eb',
300: '#d1d5db',
400: '#9ca3af',
500: '#6b7280',
600: '#4b5563',
700: '#374151',
@nyinyithann
nyinyithann / DataTableToExpandoObjects.cs
Created November 22, 2019 02:39
DataTable To ExpandoObjects C#
public static class DataTableExtensions
{
public static IEnumerable<dynamic> ToExpandoObjectList(this DataTable self)
{
var result = new List<dynamic>(self.Rows.Count);
foreach (var row in self.Rows.OfType<DataRow>())
{
var expando = new ExpandoObject() as IDictionary<string, object>;
foreach (var col in row.Table.Columns.OfType<DataColumn>())
{
@nyinyithann
nyinyithann / async_download_with_thread_pool.rs
Created March 11, 2019 07:32
Async Download with ThreadPool
#![feature(result_map_or_else)]
extern crate num_cpus;
extern crate reqwest;
extern crate threadpool;
use std::error::Error;
use std::thread;
use threadpool::ThreadPool;
@nyinyithann
nyinyithann / box_t_to_ref_t_with_unsafe.rs
Last active March 11, 2019 07:18
Convert Box<Trait> To concrete type with unsafe
trait Animal {
fn speak(&self);
}
#[derive(Debug)]
struct Dog {
name: String,
age: u8,
}
@nyinyithann
nyinyithann / unsafe_freestanding.rs
Created February 13, 2019 15:52
A simple freestanding program using libc
#![feature(start)]
#![no_std]
extern crate libc;
use core::panic::PanicInfo;
use libc::{c_char, c_int, c_void, size_t};
extern "C" {
fn malloc(size: size_t) -> *mut c_void;
fn free(p: *mut c_void);
@nyinyithann
nyinyithann / option_ext.rs
Last active February 6, 2019 13:17
add fold method to Option<T>
use std::borrow::BorrowMut;
pub trait OptionExt<T> {
fn fold<S, F>(&self, state: S, folder: F) -> S
where
F: FnOnce(S, &T) -> S;
}
impl<T> OptionExt<T> for Option<T> {
fn fold<S, F>(&self, state: S, folder: F) -> S
@nyinyithann
nyinyithann / semi_monad_function_of_result_type.rs
Last active February 8, 2019 18:45
composition of functions of Result<T,E>
use std::io;
use std::io::prelude::*;
fn main() {
loop {
let r = get_input("Enter the first number: ")
.and_then(|x| get_input("Enter the second number: ")
.and_then(|y| get_input("Enter the third number: ")
.and_then(|z| Ok(x + y + z))));