This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
//maybe works on posix not working for me on windows (S_ISCHR not defined) | |
//https://comp.os.os2.programmer.porting.narkive.com/s5n0plkf/how-to-set-stdin-stdout-stderr-to-binary-mode | |
// #include <io.h> // setmode() | |
// #include <fcntl.h> // O_BINARY | |
// #include <stdio.h> // FILE, fileno() | |
// #include <sys/stat.h> // struct stat, fstat(), S_ISCHR() | |
// static inline void set_bin_mode(FILE *stream) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "postgres.h" | |
#include <string.h> | |
#include "fmgr.h" | |
#include "utils/geo_decls.h" | |
PG_MODULE_MAGIC; | |
/* by value */ | |
PG_FUNCTION_INFO_V1(upc_checkdigit); | |
Datum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// give.a.dollar.rs, from julia, from tiny-c: | |
// http://primepuzzle.com/not.just.tiny.c/give.a.dollar.try.tc?fbclid=IwAR2p5YBQgJJDY3-g3lN3rRHw7v7cA0VB0BcNWv4dHybH-XCCgxQQIrbF6sY | |
// ref: https://www.facebook.com/groups/299317782048/posts/10160467717107049/ | |
use std::io; | |
use rand::prelude::*; | |
use timed::timed; //https://y2kappa.github.io/blog/posts/timing-your-function-execution/ | |
fn gn() -> i32 { | |
let mut input = String::new(); | |
match io::stdin().read_line(&mut input) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# give.a.dollar.jl | |
# from tc: | |
# http://primepuzzle.com/not.just.tiny.c/give.a.dollar.try.tc?fbclid=IwAR2p5YBQgJJDY3-g3lN3rRHw7v7cA0VB0BcNWv4dHybH-XCCgxQQIrbF6sY | |
# ref: https://www.facebook.com/groups/299317782048/posts/10160467717107049/ | |
# give.a.dollar.tc - lrb | |
# tc give.a.dollar.tc -r "give(lim,sd)" | |
using Random | |
using Printf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Pangram (isPangram) where | |
import Data.Char | |
import Data.Bits | |
charToBit :: Char -> Int | |
charToBit c = let bit = (fromEnum c .|. 32) - 97 in | |
if bit >=0 && bit < 26 then 2 ^ bit else 0 | |
bitsum :: String -> Int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fixedWidthToCSV | |
// output is short by 545 lines | |
// wc c:\Users\tallp\Downloads\SFA8 c:\temp\sfa8.txt | |
// 1167801 12474922 411065952 c:\Users\tallp\Downloads\SFA8 | |
// 1167256 40205289 449393560 c:\temp\sfa8.txt | |
// 2335057 52680211 860459512 total | |
// https://www.youtube.com/watch?v=lLWchWTUFOQ | |
// Ryan Levick | |
// oxide.computer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.nio.charset.StandardCharsets; | |
import java.util.ArrayList; | |
import java.util.Calendar; | |
import java.util.zip.GZIPInputStream; | |
public final class Superfile { | |
public static String SuperfileToTSV(String inputFileName, String outputFileName) { | |
try { | |
FileInputStream instream = new FileInputStream(inputFileName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Problem: iPhone created some files that are all 0s (NUL bytes) | |
// Solution: chksum each file, delete those which are all 0 | |
// eg: | |
// cd "/Users/aaron/Pictures/Photos Library.photoslibrary/originals" | |
// find . -name "*.jp*g" -exec sh -c 'cat {} | chksum ; if [ $? -eq 0 ]; then echo {}; rm {} ; fi' \; | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from morse.tc - 9/29/2012, 7/20/19, 8/21,22/21 - tag, sbg, lrb | |
#include <string.h> | |
#include <stdio.h> | |
// https://kb8ojh.net/msp430/morse_encoding.html | |
#define NUL 0 | |
//#define FULLTABLE | |
const unsigned char morse_ascii[] = { | |
#ifdef FULLTABLE | |
NUL, NUL, NUL, NUL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zio.App | |
import zio.console._ | |
object HelloWorld extends App { | |
def decodeBindigits(bindigits : String) : String = { | |
var decoded = "" | |
var c = 1 | |
for (ch <- bindigits) { | |
if (ch == '0' || ch == '1') { | |
c = c + c + (ch & 1) |