Skip to content

Instantly share code, notes, and snippets.

View itsfarseen's full-sized avatar

Farseen itsfarseen

View GitHub Profile
from peewee import MySQLDatabase, fn
from typing import (Optional, List)
import models
import bcrypt
from models import (OfflineRegAdmin, User, Hospitality, OfflineReg)
database = MySQLDatabase('nitcfest_test',
**{'charset': 'utf8', 'use_unicode': True,
'host': 'tathva.org',
'port': 3306,
.text
# S0 = 0xb8000
lui $s0, 0xb;
ori $s0, $s0, 0x8000
# S1 = 3937, ASCII codepoint: 'a', FG: white, BG: black, Blink: 0
ori $s1, $zero, 3937
# RAM[0xb8000] = 3937
sw $s1, 0($s0)
# infinite loop
extern fputs
extern stdout
section .data
hw: db "Hello World!", 10, 0
section .text
global main
main:
@itsfarseen
itsfarseen / bst_successor.py
Last active April 12, 2019 05:23
Inorder successor, recursive
class Node:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
def successor(node, x):
""" Return smallest node greater than x, if it exists,
in the subtree rooted at given node """
use chrono;
fn main() {
loop {
println!("The time is {}", chrono::Local::now().naive_local().format("%H:%M"));
std::thread::sleep_ms(1000);
}
}
use nix::fcntl;
use nix::sys::select;
use std::io::Read;
use std::os::unix::io::AsRawFd;
use std::process;
fn main() {
let mut path = std::env::current_exe().unwrap();
path.set_file_name("teller");
let mut proc = process::Command::new(&path)
use std::io::Read;
use std::process;
fn main() {
let cmdline_args: Vec<String> = std::env::args().collect();
let mut path = std::path::Path::new(&cmdline_args[1]).to_path_buf();
let args = &cmdline_args[2..];
let mut proc = process::Command::new(&path)
.args(args)
.stdout(process::Stdio::piped())
#include <stdio.h>
char buf[1024];
int main()
{
printf("Hello: \n");
while (1)
{
// If I comment this line, reader works as expected.
fgets(buf, 10, stdin);
@itsfarseen
itsfarseen / glxinfo.txt
Created December 2, 2019 01:52
glxinfo
name of display: :0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
GLX_ARB_create_context, GLX_ARB_create_context_no_error,
GLX_ARB_create_context_profile, GLX_ARB_create_context_robustness,
GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB, GLX_ARB_multisample,
GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
$ cabal v2-install vty
Wrote tarball sdist to
/home/farzeen/Projects/CHIP8_Haskell/dist-newstyle/sdist/CHIP8-Haskell-0.1.0.0.tar.gz
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
- microlens-mtl-0.2.0.1 (lib) (requires build)
- vty-5.26 (lib) (requires build)
- vty-5.26 (exe:vty-demo) (requires build)
- vty-5.26 (exe:vty-mode-demo) (requires build)