Skip to content

Instantly share code, notes, and snippets.

--- C:/Users/User/Desktop/clang-8.0.1.txt Mon Sep 30 01:38:47 2019
+++ C:/Users/User/Desktop/clang-9.0.0.txt Mon Sep 30 01:38:57 2019
@@ -1,768 +1,808 @@
OVERVIEW: clang LLVM compiler
USAGE: clang.exe [options] file...
OPTIONS:
-### Print (but do not run) the commands to run for this compilation
--analyzer-output <value>
@udaken
udaken / vcproj90.xsd
Created August 18, 2019 12:55
Visual C++ 2008 Project File Schema
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="VisualStudioProject" type="VisualStudioProjectType" />
<xs:complexType name="ConfigurationType">
<xs:sequence>
<xs:element name="Tool" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="Name" type="xs:string" use="required" />
<!-- NOTE: all other attributes are properties of that particular tool object. -->
<!-- any unrecognized attribute will be ignored. -->
@udaken
udaken / vcproj70.xsd
Last active August 18, 2019 12:55
Visual C++ 2003 Project File Schema
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="VisualStudioProject" type="VisualStudioProjectType" />
<xs:complexType name="ConfigurationType">
<xs:sequence>
<xs:element name="Tool" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="Name" type="xs:string" use="required" />
<!-- NOTE: all other attributes are properties of that particular tool object. -->
<!-- any unrecognized attribute will be ignored. -->
@udaken
udaken / mirror_branches.sh
Last active October 25, 2021 00:10
特定のブランチをgitリポジトリ間でミラーリングするシェルスクリプト
#!/bin/bash
set -eu
source_repo=origin
dest_repo=old
# リモートからフェッチ
git fetch --prune $source_repo
# チェックアウトしているブランチを更新できなので、分離HEADをチェックアウト
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
namespace ProjectedFSLib
{
static class Native
{
public static T? PtrToStructure<T>(IntPtr ptr) where T : struct
=> ptr == IntPtr.Zero ? default : Marshal.PtrToStructure<T>(ptr);
@udaken
udaken / async_hash.c
Created March 4, 2019 13:12
[WindowsAPI]古典的非同期I/Oのサンプルコード
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0502
#endif
#include <windows.h>
#include <tchar.h>
#include <wincrypt.h>
#include <bcrypt.h>
#include <chrono>
#include <thread>
#include <process.h>
#include <Windows.h>
#include <winternl.h>
#include <ProcessSnapshot.h>
using namespace std::literals;
int main(int argc, char *argv[]) {
unsigned tid;
#include <stdio.h>
template <class T, void (T::* f)()>
struct Foo
{
void func(T& obj)
{
(obj.*f)();
}
};
#include <iterator>
#include <vector>
#ifndef _MSC_VER
#define __forceinline __attribute__((always_inline))
#endif
template <int N>
struct unit

「1行あたりの文字数が80文字より多いソースコードの行を見つける」ということを実現するためのスクリプトです。

スクリプト

Get-ChildItem -Filter "*.cpp" -Recurse | ForEach-Object { $filename = $_.Name; Get-Content $_.FullName | ForEach-Object { $i = 0 } { $i++; [PSCustomObject] @{ filename = $filename; location = $i; length = $_.Length} } } | Where-Object { $_.length -gt 80 } | Sort-Object -Property length

簡単な解説

ディレクトリ配下のファイルをワイルドカードで列挙し、