Skip to content

Instantly share code, notes, and snippets.

@Ch3shireDev
Ch3shireDev / httpd.asm
Created October 23, 2017 18:53 — forked from xenomuta/httpd.asm
httpd.asm: Arguably the world smallest web server. ( for GNU/Linux i386. Compile with nasm )
section .text
global _start
_start:
xor eax, eax
xor ebx, ebx
xor esi, esi
jmp _socket
_socket_call:
@Ch3shireDev
Ch3shireDev / primes.fs
Last active September 18, 2019 21:57
My first F# program - Primes
let prime n =
if n = 2 then true
else
let arr = [for i in 2..n-1 -> n%i=0]
List.contains true arr |> not
//let choiser elem = if elem > 0 then Some(elem) else None
//let f x = List.choose choiser x
let primes = List.choose (fun i -> if (prime i) then Some(i) else None) [2..500]
@Ch3shireDev
Ch3shireDev / main.cs
Created November 8, 2019 23:23
WPF C# - Wait for finish
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace BrokenLoader
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
@Ch3shireDev
Ch3shireDev / list_class_structure.cs
Created November 19, 2019 08:57
Reflections - class structure
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using FrPluginImporter.SadUe;
using SAD;
namespace XMLStructure
{
@Ch3shireDev
Ch3shireDev / grammar.ebnf
Created December 1, 2019 19:45
grammar.ebnf
@@grammar::Something
start = expression $ ;
expression = term [or ~ expression];
term = factor [and ~ term];
factor
=
@Ch3shireDev
Ch3shireDev / points.py
Last active December 15, 2019 23:14
Keras neural network example
# standard libraries in Anaconda Python
import numpy as np
import matplotlib.pyplot as plt
#keras imports - requires keras and tensorflow
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.optimizers import RMSprop
@Ch3shireDev
Ch3shireDev / tatsu.py
Created December 19, 2019 07:06
TatSu grammar
from pprint import pprint
from tatsu import parse
grammar = '''
@@grammar::Grammar
start = 'if' ['happens that'] expression ['then'] ['return'] ['error']$ ;
expression = condition [and condition];
@Ch3shireDev
Ch3shireDev / index.html
Created January 6, 2020 12:18
Simple Brython usage
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>BrytPage</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
@Ch3shireDev
Ch3shireDev / main.ts
Created January 13, 2020 14:56
Angular OAuth2 connection
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { AuthConfig, OAuthModule } from 'angular-oauth2-oidc';
import { InitialAuthService } from './initial-auth.service';
const origin = 'http://localhost:4200';
const issuer = 'https://dev-09ixy5yn.auth0.com';
const clientId = 'FuDdsYDpESTGjE4BWcAE4l0F8Ebc8SjI';
// const issuer = 'https://philly-vanilly.auth0.com';
// const clientId = 'r4gL1ntxR2lnodnu81WFnWNOWdO5SFuV';
@Ch3shireDev
Ch3shireDev / main2.ts
Last active January 13, 2020 14:57
Angular OAuth2 connection
import { Injectable } from '@angular/core';
import { AuthConfig, JwksValidationHandler, OAuthService, LoginOptions } from 'angular-oauth2-oidc';
import { JwtHelperService } from '@auth0/angular-jwt';
import { filter } from 'rxjs/operators';
import { HttpHeaders } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class InitialAuthService {