I hereby claim:
- I am nyg on github.
- I am ngaranis (https://keybase.io/ngaranis) on keybase.
- I have a public key ASB-F2fnOPuIOpWWLKsB-b8ZJ0MNhPoXSvSdblQLuYfBzQo
To claim this, I am signing this object:
// https://stackoverflow.com/a/45777692/5536516 | |
import Foundation | |
struct MemoryAddress<T>: CustomStringConvertible { | |
let intValue: Int | |
var description: String { | |
let length = 2 + 2 * MemoryLayout<UnsafeRawPointer>.size |
import Foundation | |
class MyClass: NSObject, NSCoding { | |
var name: String | |
var age: Int | |
init(name: String, age: Int) { | |
self.name = name | |
self.age = age |
// | |
// Inspired by wrjpgcom of libjpeg | |
// https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/wrjpgcom.c | |
// | |
// https://stackoverflow.com/a/46045524/5536516 | |
// | |
// Note: To add an EXIF UserComment go here: | |
// https://gist.github.com/nyg/c90f36abbd30f72c8b6681ef23db886b | |
import Foundation |
AsynchronousServerSocketChannel listener = AsynchronousServerSocketChannel.open().bind(new InetSocketAddress(ip, port)); | |
while (true) { | |
Future<AsynchronousSocketChannel> future = listener.accept(); | |
AsynchronousSocketChannel channel = future.get(); | |
ByteBuffer buffer = ByteBuffer.allocate(5000); | |
Future<Integer> byteCount = channel.read(buffer); | |
System.out.println("Bytes read: " + byteCount.get()); |
// Note: to add a JPEG COM marker go here: | |
// https://gist.github.com/nyg/bdeae8190a41b4b56bde8e13dd471ecc | |
import Foundation | |
import ImageIO | |
#if os(iOS) | |
import MobileCoreServices | |
#endif |
#include <stdio.h> | |
int main(int argc, const char** argv) { | |
unsigned int a = 0xDEADBEEF; | |
unsigned int b = 0xBABE; | |
unsigned int q = a / b; | |
unsigned int r = a % b; | |
printf("%u = %u * %u + %u\n", a, q, b, r); |
#!/usr/bin/env bash | |
# Usage: /absolute/path/to/script.sh /absolute/path/to/folder/with/archive | |
for file in $1/* ; do | |
if [ -f "$file" ] ; then | |
echo Found file: $file | |
info=$(file $file | tr '[:upper:]' '[:lower:]') |
I hereby claim:
To claim this, I am signing this object:
/* | |
This is free and unencumbered software released into the public domain. | |
Anyone is free to copy, modify, publish, use, compile, sell, or | |
distribute this software, either in source code form or as a compiled | |
binary, for any purpose, commercial or non-commercial, and by any | |
means. | |
In jurisdictions that recognize copyright laws, the author or authors | |
of this software dedicate any and all copyright interest in the |
import http from 'http' | |
const options = { | |
hostname: 'perdu.com', | |
method: 'GET', | |
} | |
const req = http.request(options, res => { | |
console.log(`Status: ${res.statusCode}`) |