Skip to content

Instantly share code, notes, and snippets.

View ssg's full-sized avatar
💾
restoring

Sedat Kapanoğlu ssg

💾
restoring
View GitHub Profile
@fay59
fay59 / Quirks of C.md
Last active January 23, 2024 04:24
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
@sinclairtarget
sinclairtarget / bernoulli.c
Created August 17, 2018 20:22
Lovelace's Note G Program in C
#include <stdio.h>
/*
* Calculates what Ada Lovelace labeled "B7", which today we would call the 8th
* Bernoulli number.
*/
int main(int argc, char* argv[])
{
// ------------------------------------------------------------------------
// Data
@davidfowl
davidfowl / Global.asax.cs
Last active May 8, 2023 12:42
ASP.NET MVC and ServiceCollection sample
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Microsoft.Extensions.DependencyInjection;
using WebApplication16;
using WebApplication16.Controllers;
@cbmeeks
cbmeeks / sid.txt
Last active April 17, 2024 14:00
SID File Format
===========================
SID FILE FORMAT DESCRIPTION
===========================
AUTHORS:
Michael Schwendt (PSID v1 and v2)
Simon White (PSID v2NG, RSID)
Dag Lem (PSID v2NG)
Wilfred Bos (PSID v3, RSID v3, PSID v4, RSID v4)
@atesgoral
atesgoral / validate.js
Last active March 28, 2016 09:26
Turkish Citizenship ID Validator
n=>{a=[].slice.call(n,0,9);a.push(a.reduce((s,d,i)=>{return s+d*(((i+1&1)*8)-1)},0)%10,a.reduce((s,d)=>{return s+1*d},0)%10);return n==a.join('')}
@Keith-S-Thompson
Keith-S-Thompson / README.md
Last active March 22, 2023 03:06
Discussion of korn.c, 1987 IOCCC entry, mentioned in http://stackoverflow.com/a/19214007/827263

korn.c is the "Best One Liner" winner of the 1987 International Obfuscated C Code Contest, by David Korn (yes, the author of the Korn Shell).

korn.hint, as the name implies, offers some hints.

A commenter on Stack Overflow asked for some clarification. I didn't want to post spoilers on the site, so I'm posting them here instead. If you haven't already (and if you're familiar with the rules of C) I encourage you to study the program for a while first.

=====

Here's the code:

@ssg
ssg / Microsoft.PowerShell_profile.ps1
Last active November 17, 2022 04:42
Git/Mercurial PowerShell prompt.
# ssg's powershell profile - latest version is at https://gist.github.com/ssg/5195412
# only feature is to show hg/git current branch on the prompt
$vcTypes = @(
@{
Name = "hg"
Directory = ".hg"
BranchScript = { Get-Content ".hg\branch" }
},
@ssg
ssg / boot.asm
Created August 24, 2010 00:22
My own operating system bootloader
; ESCape Bootstrap-Loader v0.04 beta - (c) 1994 SSG
; This is a bootstrap loader I coded for one of my own "operating system" projects.
; It didn't go much farther than the loader and some init code anyways.
model tiny
.386
cseg segment use16
org 7c00h