This file contains 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
# Configuration | |
$run_duration_seconds = 10 | |
$read_delay_milliseconds = 500 | |
$log_file = "log.txt" | |
$verbose = $true | |
# Network statistics | |
$statistics = @{} | |
$start_time = Get-Date | |
$end_time = $start_time.addSeconds($run_duration_seconds) |
This file contains 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
# Configuration | |
$src_folder = "./src" | |
$dst_folder = "./dst" | |
$log_file = "log.txt" | |
# Save paths as absolute | |
$dst_folder = (Get-Item $dst_folder).FullName | |
$log_file = (Get-Item $log_file).FullName | |
# Move to source directory | |
Set-Location -Path $src_folder |
This file contains 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
# Hide console | |
Add-Type -Namespace User32 -Name Functions -MemberDefinition @" | |
[DllImport("user32.dll")] | |
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); | |
"@ | |
[User32.Functions]::ShowWindowAsync((Get-Process -Id $pid).MainWindowHandle, 0) | |
# Register form objects from .NET | |
[void][reflection.assembly]::loadwithpartialname("System.Windows.Forms") | |
# Create & show simple dialog |
This file contains 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
/* | |
* The MIT License | |
* | |
* Copyright 2017 Youka. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
This file contains 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
#!/bin/bash | |
# Ask user for channel | |
read -p "Enter Twitch channel name: " channel | |
# Channel name to lowercase | |
channel=${channel,,} | |
# Open Twitch chat | |
read -p "Open chat (y/n): " open_chat | |
if [ "$open_chat" = "y" ] |
This file contains 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
CC= i686-w64-mingw32-gcc | |
CFLAGS= -O3 -Wall -Wextra -std=gnu99 -DLUA_COMPAT_5_2 | |
AR= ar rc | |
MKDIR= mkdir -p | |
RM= rm -rf | |
INSTALL= $(CURDIR)/install | |
SOURCES= lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c | |
OBJECTS= $(subst .c,.o,$(SOURCES)) |
This file contains 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 <thread> | |
#include <atomic> | |
#include <functional> | |
#include <windows.h> | |
static thread_local const std::function<void(WPARAM,DWORD)>* LLKP_data; | |
static LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam){ | |
if(nCode == HC_ACTION) | |
(*LLKP_data)(wParam, reinterpret_cast<PKBDLLHOOKSTRUCT>(lParam)->vkCode); | |
return CallNextHookEx(NULL, nCode, wParam, lParam); |
This file contains 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 <stdlib.h> | |
#include <stdio.h> | |
#ifdef __SSE2__ | |
#include <emmintrin.h> | |
#endif | |
static double calc_pi(unsigned n){ | |
double pi, x; | |
#ifdef __SSE2__ | |
const __m128d four = _mm_set1_pd(4.0); |
This file contains 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 <emmintrin.h> // SSE2 | |
static unsigned short x[8] = {0, 55, 2, 62003, 786, 5555, 123, 32111}; // Dividend | |
__attribute__((noinline)) static void test_div_x86(unsigned i){ | |
for(; i; --i) | |
x[0] /= i, | |
x[1] /= i, | |
x[2] /= i, | |
x[3] /= i, |
This file contains 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
#pragma once | |
#ifdef _MSC_VER | |
#include <intrin.h> | |
#define bit_SSE2 (1 << 26) | |
#define bit_SSE3 (1 << 0) | |
#define bit_AVX (1 << 28) | |
#else | |
#include <cpuid.h> | |
#endif // _MSC_VER |