Skip to content

Instantly share code, notes, and snippets.

View Philosoph228's full-sized avatar
🎧
Capital Cities – Safe And Sound

Philosoph228 Philosoph228

🎧
Capital Cities – Safe And Sound
View GitHub Profile
@mhamilt
mhamilt / wasapi-console.cpp
Last active June 12, 2024 08:23
WASAPI simple console application to play a sine wave
//-----------------------------------------------------------
// Play an audio stream on the default audio rendering
// device. The PlayAudioStream function allocates a shared
// buffer big enough to hold one second of PCM audio data.
// The function uses this buffer to stream data to the
// rendering device. The inner loop runs every 1/2 second.
//-----------------------------------------------------------
#include <iostream>
#include <windows.h>
@carlesloriente
carlesloriente / compile-and-install-glibc_2.18-centos-7.sh
Last active April 22, 2024 03:17
Compile and install GLIBC 2.18 in CentOS 7
# Check gist comments to verify system PATH and or adapt it.
wget https://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz
tar zxvf glibc-2.18.tar.gz
cd glibc-2.18
mkdir build
cd build
../configure --prefix=/opt/glibc-2.18
make -j4
sudo make install
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/glibc-2.18/lib
@seanh
seanh / vimgrep.md
Last active July 17, 2024 15:06
vimgrep cheatsheet

vimgrep

  • Vimcasts on vimgrep

  • Uses native vim regexes (which are slightly different from the regexes used by grep, ack, ag, etc) so the patterns are the same as with vim's within-file search patterns.

You can do a normal within-file search first, then re-use the same pattern to

function agetostr(age) {
var txt;
count = age % 100;
if (count >= 5 && count <= 20) {
txt = 'лет';
} else {
count = count % 10;
if (count == 1) {
txt = 'год';
} else if (count >= 2 && count <= 4) {
@vurdalakov
vurdalakov / strings.h
Created September 30, 2016 02:26
std::string to std::wstring conversion (and vice versa) using Windows API
#pragma once
#include <windows.h>
#include <string>
inline std::wstring multi2wide(const std::string& str, UINT codePage = CP_THREAD_ACP)
{
if (str.empty())
{
return std::wstring();
@noelboss
noelboss / git-deployment.md
Last active July 16, 2024 09:50
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@bugyt
bugyt / ArchCheatSheet.md
Last active June 8, 2024 12:40
ArchLinux Cheat Sheet

ArchLinux Cheat Sheet

Network configuration

  • List network devices
      # ip link
    
  • Enabling and disabling network interfaces
      # ip link set <network interface> up
    

ip link set down

@rossy
rossy / font.c
Last active April 29, 2016 23:14
#include <windows.h>
#include <uxtheme.h>
#include <vssym32.h>
// window is a top-level HWND
static HFONT get_control_font_textstyle(void)
{
HTHEME textstyle = OpenThemeData(window, VSCLASS_TEXTSTYLE);
if (!textstyle)
@roxlu
roxlu / H264_Decoder.cpp
Created March 3, 2014 16:57
LibAV parser and decoder example with openGL (YUV420 -> RGB shader).
#include "H264_Decoder.h"
H264_Decoder::H264_Decoder(h264_decoder_callback frameCallback, void* user)
:codec(NULL)
,codec_context(NULL)
,parser(NULL)
,fp(NULL)
,frame(0)
,cb_frame(frameCallback)
,cb_user(user)