Skip to content

Instantly share code, notes, and snippets.

@lethern
lethern / sql.sql
Created January 29, 2019 18:50
sqlsql
create table #CHANNEL(
pk [int] IDENTITY(1,1) NOT NULL,
ChannelNumber nvarchar(10) NULL,
DisplayName nvarchar(10) NULL,
ChannelID int NOT NULL,
PRIMARY KEY CLUSTERED (pk ASC)
)
#include <list>
using namespace std;
list<int> A ={ 3,7 };
list<int>::iterator elf1 = A.begin();
list<int>::iterator elf2 = ++A.begin();
void move_A_iterator( list<int>::iterator & it, int steps ) {
while( steps-- ) {
var fs = require('fs');
var diff = 'a'.codePointAt(0) - 'A'.codePointAt(0);
var N = 'z'.codePointAt(0) - 'a'.codePointAt(0);
fs.readFile('E:\\javascript\\AdventOfCode\\13_input', 'utf8', function (err, _contents)
{
let contents = _contents.split`\n`.map(c=>c.split``);
#include <iostream>
const int ArrSize = 44;
struct ArrNode{
int size;
ArrNode* prev;
ArrNode* next;
int arr[ArrSize] = { 0 };
fs.readFile('07_input', 'utf8', function (err, _contents) {
let contents = _contents.split`\n`;
contents.splice(-1, 1);
let nodes = new Map();
for (row of contents) {
let from = row[5];
let to = row[36];
if (!nodes.get(from)) nodes.set(from, { edges: new Map() } );
@lethern
lethern / day5.js
Last active December 5, 2018 05:42
var diff = 'a'.codePointAt(0) - 'A'.codePointAt(0);
var N = 'z'.codePointAt(0) - 'a'.codePointAt(0);
fs.readFile('05_input', 'utf8', function (err, _contents)
{
max = 1111111;
for (aa = 0; aa < N; ++aa) {
l = String.fromCodePoint(aa + 'a'.codePointAt(0));
l2 = String.fromCodePoint(aa + 'A'.codePointAt(0));
contents = _contents.replace(new RegExp(l, 'g'), '');
// might work with compiler optimilization turned on, but better when disabled
#include <thread>
#include <iostream>
#include <string>
#include <Windows.h> // for Sleep()
typedef unsigned long long uint64;
constexpr int CPU_N = 4; // the more the longer it will wait (reduce n), 99+ will break the array