Skip to content

Instantly share code, notes, and snippets.

View gist:84d22001d98d83eec1bd
$ cat test1.c
int main() {
return *(int*)0;
}
$ clang -c test1.c -O3 -o test1
test1.c:2:12: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
return *(int*)0;
^~~~~~~~
test1.c:2:12: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
1 warning generated.
@main--
main-- / Eaterator.cs
Created Sep 8, 2015
Emulate iterators using async/await
View Eaterator.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace Eaterator
{
class Program
{
View Ice.dll.nuspec
<?xml version="1.0" encoding="utf-8"?>
<package >
<metadata>
<id>Ice</id>
<title>Internet Communications Engine</title>
<version>3.5.1.0</version>
<authors>ZeroC</authors>
<owners>ZeroC</owners>
<licenseUrl>https://zeroc.com/licensing.html</licenseUrl>
<projectUrl>https://zeroc.com/icedotnet.html</projectUrl>
@main--
main-- / gist:c8aeafe30170e28d5ec1
Last active Aug 29, 2015
ArrayList vs LinkedList
View gist:c8aeafe30170e28d5ec1
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
namespace katzenjammer
{
class MainClass
{
public static void Main(string[] args)
View gist:dd7d8f81654789a977d9
Restoring packages for /home/noah/aspnet/Home/samples/HelloMvc/project.json
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Reflection'.
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Text.Encoding'.
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.IO'.
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Globalization'.
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Runtime.Extensions'.
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Runtime'.
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Threading.Tasks'.
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Collections'.
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Xml.ReaderWriter'.
View Unsafe.cs
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Unsafe
{
[StructLayout(LayoutKind.Explicit)]
public struct Union
{
[FieldOffset(0)]
View gist:59e6b71d21783bad9c36
$ clang++-3.5 -O3 -c look_boy_why_you_so_mad.cpp -o lbwysm.o
$ objdump -CdMintel lbwysm.o
lbwysm.o: Dateiformat elf64-x86-64
Disassembly of section .text:
0000000000000000 <findStuff(int)>:
0: 89 f8 mov eax,edi
View gist:98d2b09d779b548443d9
$ cat Obviously.java
public class Obviously {
public static void main(String[] args) {
/* a */ System.out.println("I am evil.");
/* b */ int a, b, c;
/* c */ a = b = 42;
/* d */ c = a + b;
/* e‮ ;7331 = c ‭ */
/* f */ System.out.println(c);
}
View turnarray.py
"""
Turn arrays like this:
+-0°/360° just print normally
90°/-270° swap X and Z offsets and reverse iteration direction of inner loop
180°/-180° reverse both X and Z iteration direction (downwards; start from high corner)
270°/-90° swap X and Z offsets and reverse iteration direction of outer loop
"""
data = [['0', '1', '2', '3'], ['4', '5', '6', '7'], ['8', '9', 'a', 'b']]
@main--
main-- / Awesomeness.cs
Last active Aug 29, 2015
BestBitstreamEUW
View Awesomeness.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BestBitstreamEUW
{
public static class Awesomeness