Skip to content

Instantly share code, notes, and snippets.

View jglatts's full-sized avatar

John Glatts jglatts

View GitHub Profile
@jglatts
jglatts / lc_1404.cs
Created August 4, 2025 03:23
1404. Number of Steps to Reduce a Number in Binary Representation to One
public class Solution {
public BigInteger BinStrToInt(string s) {
BigInteger ret = 0;
for (int i = 0; i < s.Length; i++)
{
ret <<= 1;
if (s[i] == '1') ret += 1;
}
@jglatts
jglatts / ef-like-map.cs
Created June 27, 2025 21:06
simple ef-like mapper .net
using System;
public class Model {
public int id;
public string name;
}
public class ModelHelper : Model {
public void update(Model m) {
id = m.id;
@jglatts
jglatts / static_funcs.cpp
Created May 12, 2025 19:47
PoC showing static member functions being called as static vs instance
#include <iostream>
class A {
public:
static void p() {
std::cout<<"Hello World\n";
}
};
int main() {
@jglatts
jglatts / email_gen.py
Last active May 6, 2025 15:02
cold-email generation for ZIoT Systems
"""
Utils to generate cold-outreach emails for ZIoT Systems
"""
class KeyWords:
# implement this for better keyword replacing
pass
class EmailGen:
def __init__(self):
using System;
using System.Threading;
class ABigOne
{
public string someString;
public ABigOne(string s)
{
someString = s;
#include <stdio.h>
#include <stdlib.h>
#define VIRTUAL /* empty, used for read-ablilty */
#define IMPL /* empty, used for read-ablilty */
typedef void (*fp_callback)(void);
typedef struct Base {
#include <iostream>
#include <functional>
using namespace std;
void ff(int y) {
cout << y << endl;
}
int main() {
using System;
public class Config {
public string configStr = "";
}
public class ConfigBuilder {
public delegate void Init(Config conf);
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
typedef struct Node {
int data;
struct Node* left;
struct Node* right;
} Node;
@jglatts
jglatts / static_list_type.cpp
Last active January 25, 2025 03:40
Simple example of a list generation using static fields. Mimics FastLEDs list generation.
#include <iostream>
class Node {
public:
int data;
Node* next;
static Node* head;
Node(int d) {
this->data = d;