Skip to content

Instantly share code, notes, and snippets.

View lambdageek's full-sized avatar
🪣

Aleksey Kliger (λgeek) lambdageek

🪣
View GitHub Profile
@lambdageek
lambdageek / gist:72cd5c69aef961e009c7d3451a581e85
Created August 27, 2020 22:43
git default branch for new repos
#! /bin/sh
git config --global init.defaultBranch main
@lambdageek
lambdageek / grr
Last active June 11, 2020 21:45
grr: git run root
#! /bin/bash
function print_usage () {
echo "usage: $0 [-n] COMMAND [ARGS...]"
echo " Runs COMMAND from the toplevel directory of the current git repository"
echo " -n: Don't run, just print the full path of the command"
exit 1
}
if [[ $# -lt 1 ]]; then
print_usage;
@lambdageek
lambdageek / b
Created May 22, 2020 16:08
Run build.sh from any directory
#! /bin/bash
# runs ./build.sh from a parent directory of the current directory
# doesn't run above your home directory
# only runs if it finds an executable script and an eng/ directory next to it
# suppress echo from pushd and popd
function pushd () {
command pushd "$@" > /dev/null
#include <execinfo.h>
#include <stdio.h>
#include <stdlib.h>
#define MONO_NEVER_INLINE __attribute__ ((__noinline__))
#define MONO_API __attribute__((visibility("default")))
MONO_API void call2 (int* x);
static int count;
@lambdageek
lambdageek / run-lldb.sh
Created February 20, 2020 18:50
lldb attach to parent hang
#! /bin/sh
exec /Applications/Xcode.app/Contents/Developer/usr/bin/lldb --debug --batch --no-lldbinit --attach-pid $1 --source /tmp/aleksey.txt < /dev/null 2>&1

!! This PR is a copy of original PR, please do not edit it in this repo !!
!! Do not automatically approve this PR:

  • Consider how the changes affect configurations in this repo,
  • Check effects on files that are not mirrored,
  • Identify test cases that may be needed in this repo.

!! Merge the PR only after the original PR is merged !!


// compiled with:
// csc /target:library /unsafe /O foo.cs
using System;
using System.Runtime.InteropServices;
public struct S {
public int a;
@lambdageek
lambdageek / FoofSql.csproj
Created February 4, 2020 22:05
MySqlConnector sample
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MySqlConnector" Version="0.61.0" />
</ItemGroup>
@lambdageek
lambdageek / Makefile
Created January 29, 2020 21:54
native thread prevents runtime shutdown
SOEXT:=dylib
#SOEXT:=so
all: Prog.exe libFoo.$(SOEXT)
.PHONY: all clean
Prog.exe: Prog.cs
csc $<
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -8
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: false
AlignTrailingComments: false